@mantine/hooks 8.0.1 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.cjs +3 -1
- package/cjs/index.cjs.map +1 -1
- package/cjs/use-clipboard/use-clipboard.cjs +4 -4
- package/cjs/use-clipboard/use-clipboard.cjs.map +1 -1
- package/cjs/use-color-scheme/use-color-scheme.cjs.map +1 -1
- package/cjs/use-counter/use-counter.cjs +13 -4
- package/cjs/use-counter/use-counter.cjs.map +1 -1
- package/cjs/use-debounced-callback/use-debounced-callback.cjs +1 -1
- package/cjs/use-debounced-callback/use-debounced-callback.cjs.map +1 -1
- package/cjs/use-debounced-state/use-debounced-state.cjs.map +1 -1
- package/cjs/use-debounced-value/use-debounced-value.cjs.map +1 -1
- package/cjs/use-disclosure/use-disclosure.cjs +5 -6
- package/cjs/use-disclosure/use-disclosure.cjs.map +1 -1
- package/cjs/use-event-listener/use-event-listener.cjs +24 -9
- package/cjs/use-event-listener/use-event-listener.cjs.map +1 -1
- package/cjs/use-eye-dropper/use-eye-dropper.cjs +3 -3
- package/cjs/use-eye-dropper/use-eye-dropper.cjs.map +1 -1
- package/cjs/use-fetch/use-fetch.cjs +0 -3
- package/cjs/use-fetch/use-fetch.cjs.map +1 -1
- package/cjs/use-file-dialog/use-file-dialog.cjs.map +1 -1
- package/cjs/use-focus-return/use-focus-return.cjs +4 -1
- package/cjs/use-focus-return/use-focus-return.cjs.map +1 -1
- package/cjs/use-focus-trap/use-focus-trap.cjs.map +1 -1
- package/cjs/use-focus-within/use-focus-within.cjs +43 -26
- package/cjs/use-focus-within/use-focus-within.cjs.map +1 -1
- package/cjs/use-fullscreen/use-fullscreen.cjs.map +1 -1
- package/cjs/use-hash/use-hash.cjs +3 -1
- package/cjs/use-hash/use-hash.cjs.map +1 -1
- package/cjs/use-headroom/use-headroom.cjs +1 -1
- package/cjs/use-headroom/use-headroom.cjs.map +1 -1
- package/cjs/use-hover/use-hover.cjs +21 -15
- package/cjs/use-hover/use-hover.cjs.map +1 -1
- package/cjs/use-idle/use-idle.cjs +3 -9
- package/cjs/use-idle/use-idle.cjs.map +1 -1
- package/cjs/use-in-viewport/use-in-viewport.cjs.map +1 -1
- package/cjs/use-input-state/use-input-state.cjs.map +1 -1
- package/cjs/use-intersection/use-intersection.cjs.map +1 -1
- package/cjs/use-interval/use-interval.cjs +6 -6
- package/cjs/use-interval/use-interval.cjs.map +1 -1
- package/cjs/use-list-state/use-list-state.cjs.map +1 -1
- package/cjs/use-local-storage/create-storage.cjs +5 -3
- package/cjs/use-local-storage/create-storage.cjs.map +1 -1
- package/cjs/use-local-storage/use-local-storage.cjs.map +1 -1
- package/cjs/use-long-press/use-long-press.cjs +65 -0
- package/cjs/use-long-press/use-long-press.cjs.map +1 -0
- package/cjs/use-media-query/use-media-query.cjs +1 -1
- package/cjs/use-media-query/use-media-query.cjs.map +1 -1
- package/cjs/use-merged-ref/use-merged-ref.cjs.map +1 -1
- package/cjs/use-mouse/use-mouse.cjs +2 -2
- package/cjs/use-mouse/use-mouse.cjs.map +1 -1
- package/cjs/use-move/use-move.cjs +76 -75
- package/cjs/use-move/use-move.cjs.map +1 -1
- package/cjs/use-network/use-network.cjs +1 -3
- package/cjs/use-network/use-network.cjs.map +1 -1
- package/cjs/use-orientation/use-orientation.cjs.map +1 -1
- package/cjs/use-os/use-os.cjs +3 -1
- package/cjs/use-os/use-os.cjs.map +1 -1
- package/cjs/use-pagination/use-pagination.cjs.map +1 -1
- package/cjs/use-queue/use-queue.cjs +4 -1
- package/cjs/use-queue/use-queue.cjs.map +1 -1
- package/cjs/use-radial-move/use-radial-move.cjs +63 -62
- package/cjs/use-radial-move/use-radial-move.cjs.map +1 -1
- package/cjs/use-scroll-into-view/use-scroll-into-view.cjs +84 -8
- package/cjs/use-scroll-into-view/use-scroll-into-view.cjs.map +1 -1
- package/cjs/use-session-storage/use-session-storage.cjs.map +1 -1
- package/cjs/use-set-state/use-set-state.cjs.map +1 -1
- package/cjs/use-state-history/use-state-history.cjs.map +1 -1
- package/cjs/use-throttled-callback/use-throttled-callback.cjs +1 -1
- package/cjs/use-throttled-callback/use-throttled-callback.cjs.map +1 -1
- package/cjs/use-timeout/use-timeout.cjs +2 -2
- package/cjs/use-timeout/use-timeout.cjs.map +1 -1
- package/cjs/use-toggle/use-toggle.cjs.map +1 -1
- package/cjs/use-uncontrolled/use-uncontrolled.cjs.map +1 -1
- package/cjs/use-validated-state/use-validated-state.cjs +4 -4
- package/cjs/use-validated-state/use-validated-state.cjs.map +1 -1
- package/cjs/use-window-scroll/use-window-scroll.cjs +1 -1
- package/cjs/use-window-scroll/use-window-scroll.cjs.map +1 -1
- package/cjs/utils/shallow-equal/shallow-equal.cjs +4 -1
- package/cjs/utils/shallow-equal/shallow-equal.cjs.map +1 -1
- package/cjs/utils/use-callback-ref/use-callback-ref.cjs.map +1 -0
- package/esm/index.mjs +2 -1
- package/esm/index.mjs.map +1 -1
- package/esm/use-clipboard/use-clipboard.mjs +4 -4
- package/esm/use-clipboard/use-clipboard.mjs.map +1 -1
- package/esm/use-color-scheme/use-color-scheme.mjs.map +1 -1
- package/esm/use-counter/use-counter.mjs +14 -5
- package/esm/use-counter/use-counter.mjs.map +1 -1
- package/esm/use-debounced-callback/use-debounced-callback.mjs +1 -1
- package/esm/use-debounced-callback/use-debounced-callback.mjs.map +1 -1
- package/esm/use-debounced-state/use-debounced-state.mjs.map +1 -1
- package/esm/use-debounced-value/use-debounced-value.mjs.map +1 -1
- package/esm/use-disclosure/use-disclosure.mjs +5 -6
- package/esm/use-disclosure/use-disclosure.mjs.map +1 -1
- package/esm/use-event-listener/use-event-listener.mjs +25 -10
- package/esm/use-event-listener/use-event-listener.mjs.map +1 -1
- package/esm/use-eye-dropper/use-eye-dropper.mjs +3 -3
- package/esm/use-eye-dropper/use-eye-dropper.mjs.map +1 -1
- package/esm/use-fetch/use-fetch.mjs +0 -3
- package/esm/use-fetch/use-fetch.mjs.map +1 -1
- package/esm/use-file-dialog/use-file-dialog.mjs.map +1 -1
- package/esm/use-focus-return/use-focus-return.mjs +4 -1
- package/esm/use-focus-return/use-focus-return.mjs.map +1 -1
- package/esm/use-focus-trap/use-focus-trap.mjs.map +1 -1
- package/esm/use-focus-within/use-focus-within.mjs +44 -27
- package/esm/use-focus-within/use-focus-within.mjs.map +1 -1
- package/esm/use-fullscreen/use-fullscreen.mjs.map +1 -1
- package/esm/use-hash/use-hash.mjs +3 -1
- package/esm/use-hash/use-hash.mjs.map +1 -1
- package/esm/use-headroom/use-headroom.mjs +1 -1
- package/esm/use-headroom/use-headroom.mjs.map +1 -1
- package/esm/use-hover/use-hover.mjs +22 -16
- package/esm/use-hover/use-hover.mjs.map +1 -1
- package/esm/use-idle/use-idle.mjs +3 -9
- package/esm/use-idle/use-idle.mjs.map +1 -1
- package/esm/use-in-viewport/use-in-viewport.mjs.map +1 -1
- package/esm/use-input-state/use-input-state.mjs.map +1 -1
- package/esm/use-intersection/use-intersection.mjs.map +1 -1
- package/esm/use-interval/use-interval.mjs +7 -7
- package/esm/use-interval/use-interval.mjs.map +1 -1
- package/esm/use-list-state/use-list-state.mjs.map +1 -1
- package/esm/use-local-storage/create-storage.mjs +5 -3
- package/esm/use-local-storage/create-storage.mjs.map +1 -1
- package/esm/use-local-storage/use-local-storage.mjs.map +1 -1
- package/esm/use-long-press/use-long-press.mjs +63 -0
- package/esm/use-long-press/use-long-press.mjs.map +1 -0
- package/esm/use-media-query/use-media-query.mjs +1 -1
- package/esm/use-media-query/use-media-query.mjs.map +1 -1
- package/esm/use-merged-ref/use-merged-ref.mjs.map +1 -1
- package/esm/use-mouse/use-mouse.mjs +2 -2
- package/esm/use-mouse/use-mouse.mjs.map +1 -1
- package/esm/use-move/use-move.mjs +77 -76
- package/esm/use-move/use-move.mjs.map +1 -1
- package/esm/use-network/use-network.mjs +1 -3
- package/esm/use-network/use-network.mjs.map +1 -1
- package/esm/use-orientation/use-orientation.mjs.map +1 -1
- package/esm/use-os/use-os.mjs +3 -1
- package/esm/use-os/use-os.mjs.map +1 -1
- package/esm/use-pagination/use-pagination.mjs.map +1 -1
- package/esm/use-queue/use-queue.mjs +4 -1
- package/esm/use-queue/use-queue.mjs.map +1 -1
- package/esm/use-radial-move/use-radial-move.mjs +64 -63
- package/esm/use-radial-move/use-radial-move.mjs.map +1 -1
- package/esm/use-scroll-into-view/use-scroll-into-view.mjs +80 -4
- package/esm/use-scroll-into-view/use-scroll-into-view.mjs.map +1 -1
- package/esm/use-session-storage/use-session-storage.mjs.map +1 -1
- package/esm/use-set-state/use-set-state.mjs.map +1 -1
- package/esm/use-state-history/use-state-history.mjs.map +1 -1
- package/esm/use-throttled-callback/use-throttled-callback.mjs +1 -1
- package/esm/use-throttled-callback/use-throttled-callback.mjs.map +1 -1
- package/esm/use-timeout/use-timeout.mjs +2 -2
- package/esm/use-timeout/use-timeout.mjs.map +1 -1
- package/esm/use-toggle/use-toggle.mjs.map +1 -1
- package/esm/use-uncontrolled/use-uncontrolled.mjs.map +1 -1
- package/esm/use-validated-state/use-validated-state.mjs +4 -4
- package/esm/use-validated-state/use-validated-state.mjs.map +1 -1
- package/esm/use-window-scroll/use-window-scroll.mjs +1 -1
- package/esm/use-window-scroll/use-window-scroll.mjs.map +1 -1
- package/esm/utils/shallow-equal/shallow-equal.mjs +4 -1
- package/esm/utils/shallow-equal/shallow-equal.mjs.map +1 -1
- package/esm/utils/use-callback-ref/use-callback-ref.mjs.map +1 -0
- package/lib/index.d.mts +41 -8
- package/lib/index.d.ts +41 -8
- package/lib/use-clipboard/use-clipboard.d.ts +12 -5
- package/lib/use-color-scheme/use-color-scheme.d.ts +2 -1
- package/lib/use-counter/use-counter.d.ts +12 -9
- package/lib/use-debounced-callback/use-debounced-callback.d.ts +6 -2
- package/lib/use-debounced-state/use-debounced-state.d.ts +5 -3
- package/lib/use-debounced-value/use-debounced-value.d.ts +5 -3
- package/lib/use-disclosure/use-disclosure.d.ts +9 -6
- package/lib/use-event-listener/use-event-listener.d.ts +1 -1
- package/lib/use-eye-dropper/use-eye-dropper.d.ts +4 -4
- package/lib/use-fetch/use-fetch.d.ts +4 -3
- package/lib/use-file-dialog/use-file-dialog.d.ts +3 -2
- package/lib/use-focus-return/use-focus-return.d.ts +3 -4
- package/lib/use-focus-trap/use-focus-trap.d.ts +1 -1
- package/lib/use-focus-within/use-focus-within.d.ts +4 -3
- package/lib/use-fullscreen/use-fullscreen.d.ts +6 -5
- package/lib/use-hash/use-hash.d.ts +3 -3
- package/lib/use-headroom/use-headroom.d.ts +3 -4
- package/lib/use-hover/use-hover.d.ts +4 -3
- package/lib/use-idle/use-idle.d.ts +5 -4
- package/lib/use-in-viewport/use-in-viewport.d.ts +4 -3
- package/lib/use-input-state/use-input-state.d.ts +5 -1
- package/lib/use-intersection/use-intersection.d.ts +4 -3
- package/lib/use-interval/use-interval.d.ts +8 -4
- package/lib/use-list-state/use-list-state.d.ts +2 -2
- package/lib/use-local-storage/create-storage.d.ts +8 -3
- package/lib/use-local-storage/use-local-storage.d.ts +3 -3
- package/lib/use-long-press/use-long-press.d.ts +19 -0
- package/lib/use-media-query/use-media-query.d.ts +1 -1
- package/lib/use-merged-ref/use-merged-ref.d.ts +2 -2
- package/lib/use-move/use-move.d.ts +5 -5
- package/lib/use-network/use-network.d.ts +3 -5
- package/lib/use-orientation/use-orientation.d.ts +2 -3
- package/lib/use-os/use-os.d.ts +3 -4
- package/lib/use-pagination/use-pagination.d.ts +13 -5
- package/lib/use-queue/use-queue.d.ts +13 -4
- package/lib/use-radial-move/use-radial-move.d.ts +6 -3
- package/lib/use-reduced-motion/use-reduced-motion.d.ts +1 -1
- package/lib/use-scroll-into-view/use-scroll-into-view.d.ts +7 -7
- package/lib/use-session-storage/use-session-storage.d.ts +3 -3
- package/lib/use-set-state/use-set-state.d.ts +3 -1
- package/lib/use-state-history/use-state-history.d.ts +7 -2
- package/lib/use-timeout/use-timeout.d.ts +6 -4
- package/lib/use-toggle/use-toggle.d.ts +4 -1
- package/lib/use-uncontrolled/use-uncontrolled.d.ts +10 -3
- package/lib/use-validated-state/use-validated-state.d.ts +15 -5
- package/lib/use-window-scroll/use-window-scroll.d.ts +4 -4
- package/lib/utils/index.d.ts +1 -0
- package/package.json +1 -1
- package/cjs/use-callback-ref/use-callback-ref.cjs.map +0 -1
- package/cjs/use-scroll-into-view/utils/ease-in-out-quad.cjs +0 -7
- package/cjs/use-scroll-into-view/utils/ease-in-out-quad.cjs.map +0 -1
- package/cjs/use-scroll-into-view/utils/get-relative-position.cjs +0 -66
- package/cjs/use-scroll-into-view/utils/get-relative-position.cjs.map +0 -1
- package/cjs/use-scroll-into-view/utils/get-scroll-start.cjs +0 -17
- package/cjs/use-scroll-into-view/utils/get-scroll-start.cjs.map +0 -1
- package/cjs/use-scroll-into-view/utils/set-scroll-param.cjs +0 -19
- package/cjs/use-scroll-into-view/utils/set-scroll-param.cjs.map +0 -1
- package/esm/use-callback-ref/use-callback-ref.mjs.map +0 -1
- package/esm/use-scroll-into-view/utils/ease-in-out-quad.mjs +0 -5
- package/esm/use-scroll-into-view/utils/ease-in-out-quad.mjs.map +0 -1
- package/esm/use-scroll-into-view/utils/get-relative-position.mjs +0 -64
- package/esm/use-scroll-into-view/utils/get-relative-position.mjs.map +0 -1
- package/esm/use-scroll-into-view/utils/get-scroll-start.mjs +0 -15
- package/esm/use-scroll-into-view/utils/get-scroll-start.mjs.map +0 -1
- package/esm/use-scroll-into-view/utils/set-scroll-param.mjs +0 -17
- package/esm/use-scroll-into-view/utils/set-scroll-param.mjs.map +0 -1
- package/lib/use-scroll-into-view/utils/ease-in-out-quad.d.ts +0 -1
- package/lib/use-scroll-into-view/utils/get-relative-position.d.ts +0 -1
- package/lib/use-scroll-into-view/utils/get-scroll-start.d.ts +0 -1
- package/lib/use-scroll-into-view/utils/set-scroll-param.d.ts +0 -1
- /package/cjs/{use-callback-ref → utils/use-callback-ref}/use-callback-ref.cjs +0 -0
- /package/esm/{use-callback-ref → utils/use-callback-ref}/use-callback-ref.mjs +0 -0
- /package/lib/{use-callback-ref → utils/use-callback-ref}/use-callback-ref.d.ts +0 -0
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from './utils/index.js';
|
|
2
|
-
export { useCallbackRef } from './use-callback-ref/use-callback-ref';
|
|
3
2
|
export { useDebouncedCallback } from './use-debounced-callback/use-debounced-callback';
|
|
4
3
|
export { useClickOutside } from './use-click-outside/use-click-outside';
|
|
5
4
|
export { useClipboard } from './use-clipboard/use-clipboard';
|
|
@@ -71,12 +70,46 @@ export { useFetch } from './use-fetch/use-fetch';
|
|
|
71
70
|
export { useRadialMove, normalizeRadialValue } from './use-radial-move/use-radial-move';
|
|
72
71
|
export { useScrollSpy } from './use-scroll-spy/use-scroll-spy';
|
|
73
72
|
export { useFileDialog } from './use-file-dialog/use-file-dialog';
|
|
74
|
-
export
|
|
75
|
-
export type { OS } from './use-os/use-os';
|
|
76
|
-
export type { HotkeyItem, HotkeyItemOptions } from './use-hotkeys/use-hotkeys';
|
|
77
|
-
export type { UseListStateHandlers } from './use-list-state/use-list-state';
|
|
78
|
-
export type { EyeDropperOpenReturnType } from './use-eye-dropper/use-eye-dropper';
|
|
73
|
+
export { useLongPress } from './use-long-press/use-long-press';
|
|
79
74
|
export type { UseMediaQueryOptions } from './use-media-query/use-media-query';
|
|
80
|
-
export type {
|
|
81
|
-
export type {
|
|
75
|
+
export type { UseClipboardOptions, UseClipboardReturnValue } from './use-clipboard/use-clipboard';
|
|
76
|
+
export type { UseColorSchemeValue } from './use-color-scheme/use-color-scheme';
|
|
77
|
+
export type { UseCounterOptions, UseCounterHandlers, UseCounterReturnValue, } from './use-counter/use-counter';
|
|
78
|
+
export type { UseDebouncedCallbackOptions, UseDebouncedCallbackReturnValue, } from './use-debounced-callback/use-debounced-callback';
|
|
79
|
+
export type { UseDebouncedStateOptions, UseDebouncedStateReturnValue, } from './use-debounced-state/use-debounced-state';
|
|
80
|
+
export type { UseDebouncedValueOptions, UseDebouncedValueReturnValue, } from './use-debounced-value/use-debounced-value';
|
|
81
|
+
export type { UseDisclosureOptions, UseDisclosureHandlers, UseDisclosureReturnValue, } from './use-disclosure/use-disclosure';
|
|
82
|
+
export type { EyeDropperOpenOptions, EyeDropperOpenReturnType, UseEyeDropperReturnValue, } from './use-eye-dropper/use-eye-dropper';
|
|
83
|
+
export type { UseFetchOptions, UseFetchReturnValue } from './use-fetch/use-fetch';
|
|
84
|
+
export type { UseFileDialogOptions, UseFileDialogReturnValue, } from './use-file-dialog/use-file-dialog';
|
|
85
|
+
export type { UseFocusReturnOptions, UseFocusReturnReturnValue, } from './use-focus-return/use-focus-return';
|
|
86
|
+
export type { UseFocusWithinOptions, UseFocusWithinReturnValue, } from './use-focus-within/use-focus-within';
|
|
87
|
+
export type { UseFullscreenReturnValue } from './use-fullscreen/use-fullscreen';
|
|
88
|
+
export type { UseHashOptions, UseHashReturnValue } from './use-hash/use-hash';
|
|
89
|
+
export type { UseHeadroomOptions } from './use-headroom/use-headroom';
|
|
90
|
+
export type { HotkeyItemOptions, HotkeyItem } from './use-hotkeys/use-hotkeys';
|
|
91
|
+
export type { UseHoverReturnValue } from './use-hover/use-hover';
|
|
92
|
+
export type { UseIdleOptions } from './use-idle/use-idle';
|
|
93
|
+
export type { UseInViewportReturnValue } from './use-in-viewport/use-in-viewport';
|
|
94
|
+
export type { UseInputStateReturnValue } from './use-input-state/use-input-state';
|
|
95
|
+
export type { UseIntersectionReturnValue } from './use-intersection/use-intersection';
|
|
96
|
+
export type { UseIntervalOptions, UseIntervalReturnValue } from './use-interval/use-interval';
|
|
97
|
+
export type { UseListStateReturnValue, UseListStateHandlers, } from './use-list-state/use-list-state';
|
|
98
|
+
export type { UseStorageOptions, UseStorageReturnValue } from './use-local-storage/create-storage';
|
|
99
|
+
export type { UseMovePosition, UseMoveHandlers, UseMoveReturnValue } from './use-move/use-move';
|
|
100
|
+
export type { UserNetworkReturnValue } from './use-network/use-network';
|
|
101
|
+
export type { UseOrientationOptions, UseOrientationReturnType, } from './use-orientation/use-orientation';
|
|
102
|
+
export type { UseOSReturnValue as OS, UseOSReturnValue, UseOsOptions } from './use-os/use-os';
|
|
103
|
+
export type { UsePaginationOptions, UsePaginationReturnValue, } from './use-pagination/use-pagination';
|
|
104
|
+
export type { UseQueueOptions, UseQueueReturnValue } from './use-queue/use-queue';
|
|
105
|
+
export type { UseRadialMoveOptions, UseRadialMoveReturnValue, } from './use-radial-move/use-radial-move';
|
|
106
|
+
export type { UseScrollIntoViewOptions, UseScrollIntoViewReturnValue, } from './use-scroll-into-view/use-scroll-into-view';
|
|
82
107
|
export type { UseScrollSpyOptions, UseScrollSpyHeadingData, UseScrollSpyReturnType, } from './use-scroll-spy/use-scroll-spy';
|
|
108
|
+
export type { UseSetStateCallback, UseSetStateReturnValue } from './use-set-state/use-set-state';
|
|
109
|
+
export type { UseStateHistoryHandlers, UseStateHistoryValue as StateHistory, UseStateHistoryValue, UseStateHistoryReturnValue, } from './use-state-history/use-state-history';
|
|
110
|
+
export type { UseTimeoutOptions, UseTimeoutReturnValue } from './use-timeout/use-timeout';
|
|
111
|
+
export type { UseToggleReturnValue } from './use-toggle/use-toggle';
|
|
112
|
+
export type { UseUncontrolledOptions, UseUncontrolledReturnValue, } from './use-uncontrolled/use-uncontrolled';
|
|
113
|
+
export type { UseValidatedStateValue, UseValidatedStateReturnValue, } from './use-validated-state/use-validated-state';
|
|
114
|
+
export type { UseWindowScrollPosition, UseWindowScrollTo, UseWindowScrollReturnValue, } from './use-window-scroll/use-window-scroll';
|
|
115
|
+
export type { UseLongPressOptions, UseLongPressReturnValue } from './use-long-press/use-long-press';
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export interface UseClipboardOptions {
|
|
2
|
+
/** Time in ms after which the copied state will reset, `2000` by default */
|
|
3
|
+
timeout?: number;
|
|
4
|
+
}
|
|
5
|
+
export interface UseClipboardReturnValue {
|
|
6
|
+
/** Function to copy value to clipboard */
|
|
7
|
+
copy: (value: any) => void;
|
|
8
|
+
/** Function to reset copied state and error */
|
|
5
9
|
reset: () => void;
|
|
10
|
+
/** Error if copying failed */
|
|
6
11
|
error: Error | null;
|
|
12
|
+
/** Boolean indicating if the value was copied successfully */
|
|
7
13
|
copied: boolean;
|
|
8
|
-
}
|
|
14
|
+
}
|
|
15
|
+
export declare function useClipboard(options?: UseClipboardOptions): UseClipboardReturnValue;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { UseMediaQueryOptions } from '../use-media-query/use-media-query';
|
|
2
|
-
export
|
|
2
|
+
export type UseColorSchemeValue = 'dark' | 'light';
|
|
3
|
+
export declare function useColorScheme(initialValue?: UseColorSchemeValue, options?: UseMediaQueryOptions): UseColorSchemeValue;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
export
|
|
2
|
-
min
|
|
3
|
-
max
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
export interface UseCounterOptions {
|
|
2
|
+
min?: number;
|
|
3
|
+
max?: number;
|
|
4
|
+
}
|
|
5
|
+
export interface UseCounterHandlers {
|
|
6
|
+
increment: () => void;
|
|
7
|
+
decrement: () => void;
|
|
8
|
+
set: (value: number) => void;
|
|
9
|
+
reset: () => void;
|
|
10
|
+
}
|
|
11
|
+
export type UseCounterReturnValue = [number, UseCounterHandlers];
|
|
12
|
+
export declare function useCounter(initialValue?: number, options?: UseCounterOptions): [number, UseCounterHandlers];
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface UseDebouncedCallbackOptions {
|
|
2
2
|
delay: number;
|
|
3
3
|
flushOnUnmount?: boolean;
|
|
4
4
|
leading?: boolean;
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
|
+
export type UseDebouncedCallbackReturnValue<T extends (...args: any[]) => any> = ((...args: Parameters<T>) => void) & {
|
|
7
|
+
flush: () => void;
|
|
8
|
+
};
|
|
9
|
+
export declare function useDebouncedCallback<T extends (...args: any[]) => any>(callback: T, options: number | UseDebouncedCallbackOptions): ((...args: Parameters<T>) => void) & {
|
|
6
10
|
flush: () => void;
|
|
7
11
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { SetStateAction } from 'react';
|
|
2
|
-
export
|
|
3
|
-
leading
|
|
4
|
-
}
|
|
2
|
+
export interface UseDebouncedStateOptions {
|
|
3
|
+
leading?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export type UseDebouncedStateReturnValue<T> = [T, (newValue: SetStateAction<T>) => void];
|
|
6
|
+
export declare function useDebouncedState<T = any>(defaultValue: T, wait: number, options?: UseDebouncedStateOptions): UseDebouncedStateReturnValue<T>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
leading
|
|
3
|
-
}
|
|
1
|
+
export interface UseDebouncedValueOptions {
|
|
2
|
+
leading?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export type UseDebouncedValueReturnValue<T> = [T, () => void];
|
|
5
|
+
export declare function useDebouncedValue<T = any>(value: T, wait: number, options?: UseDebouncedValueOptions): UseDebouncedValueReturnValue<T>;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface UseDisclosureOptions {
|
|
2
2
|
onOpen?: () => void;
|
|
3
3
|
onClose?: () => void;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
}
|
|
5
|
+
export interface UseDisclosureHandlers {
|
|
6
|
+
open: () => void;
|
|
7
|
+
close: () => void;
|
|
8
|
+
toggle: () => void;
|
|
9
|
+
}
|
|
10
|
+
export type UseDisclosureReturnValue = [boolean, UseDisclosureHandlers];
|
|
11
|
+
export declare function useDisclosure(initialState?: boolean, options?: UseDisclosureOptions): UseDisclosureReturnValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useEventListener<K extends keyof HTMLElementEventMap, T extends HTMLElement = any>(type: K, listener: (this: HTMLDivElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions):
|
|
1
|
+
export declare function useEventListener<K extends keyof HTMLElementEventMap, T extends HTMLElement = any>(type: K, listener: (this: HTMLDivElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): React.RefCallback<T | null>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
interface EyeDropperOpenOptions {
|
|
1
|
+
export interface EyeDropperOpenOptions {
|
|
2
2
|
signal?: AbortSignal;
|
|
3
3
|
}
|
|
4
4
|
export interface EyeDropperOpenReturnType {
|
|
5
5
|
sRGBHex: string;
|
|
6
6
|
}
|
|
7
|
-
export
|
|
7
|
+
export interface UseEyeDropperReturnValue {
|
|
8
8
|
supported: boolean;
|
|
9
9
|
open: (options?: EyeDropperOpenOptions) => Promise<EyeDropperOpenReturnType | undefined>;
|
|
10
|
-
}
|
|
11
|
-
export
|
|
10
|
+
}
|
|
11
|
+
export declare function useEyeDropper(): UseEyeDropperReturnValue;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export interface UseFetchOptions extends RequestInit {
|
|
2
2
|
autoInvoke?: boolean;
|
|
3
3
|
}
|
|
4
|
-
export
|
|
4
|
+
export interface UseFetchReturnValue<T> {
|
|
5
5
|
data: T | null;
|
|
6
6
|
loading: boolean;
|
|
7
7
|
error: Error | null;
|
|
8
|
-
refetch: () => Promise<any
|
|
8
|
+
refetch: () => Promise<any>;
|
|
9
9
|
abort: () => void;
|
|
10
|
-
}
|
|
10
|
+
}
|
|
11
|
+
export declare function useFetch<T>(url: string, { autoInvoke, ...options }?: UseFetchOptions): UseFetchReturnValue<T>;
|
|
@@ -16,8 +16,9 @@ export interface UseFileDialogOptions {
|
|
|
16
16
|
/** Called when file dialog is canceled */
|
|
17
17
|
onCancel?: () => void;
|
|
18
18
|
}
|
|
19
|
-
export
|
|
19
|
+
export interface UseFileDialogReturnValue {
|
|
20
20
|
files: FileList | null;
|
|
21
21
|
open: () => void;
|
|
22
22
|
reset: () => void;
|
|
23
|
-
}
|
|
23
|
+
}
|
|
24
|
+
export declare function useFileDialog(input?: UseFileDialogOptions): UseFileDialogReturnValue;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
interface
|
|
1
|
+
export interface UseFocusReturnOptions {
|
|
2
2
|
opened: boolean;
|
|
3
3
|
shouldReturnFocus?: boolean;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
export declare function useFocusReturn({ opened, shouldReturnFocus }:
|
|
7
|
-
export {};
|
|
5
|
+
export type UseFocusReturnReturnValue = () => void;
|
|
6
|
+
export declare function useFocusReturn({ opened, shouldReturnFocus, }: UseFocusReturnOptions): UseFocusReturnReturnValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useFocusTrap(active?: boolean):
|
|
1
|
+
export declare function useFocusTrap(active?: boolean): React.RefCallback<HTMLElement | null>;
|
|
@@ -2,7 +2,8 @@ export interface UseFocusWithinOptions {
|
|
|
2
2
|
onFocus?: (event: FocusEvent) => void;
|
|
3
3
|
onBlur?: (event: FocusEvent) => void;
|
|
4
4
|
}
|
|
5
|
-
export
|
|
6
|
-
ref: React.
|
|
5
|
+
export interface UseFocusWithinReturnValue<T extends HTMLElement = any> {
|
|
6
|
+
ref: React.RefCallback<T | null>;
|
|
7
7
|
focused: boolean;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
|
+
export declare function useFocusWithin<T extends HTMLElement = any>({ onBlur, onFocus, }?: UseFocusWithinOptions): UseFocusWithinReturnValue<T>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
1
|
+
export interface UseFullscreenReturnValue<T extends HTMLElement = any> {
|
|
2
|
+
ref: React.RefCallback<T | null>;
|
|
3
|
+
toggle: () => Promise<void>;
|
|
4
|
+
fullscreen: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function useFullscreen<T extends HTMLElement = any>(): UseFullscreenReturnValue<T>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
interface UseHashOptions {
|
|
1
|
+
export interface UseHashOptions {
|
|
2
2
|
getInitialValueInEffect?: boolean;
|
|
3
3
|
}
|
|
4
|
-
export
|
|
5
|
-
export {};
|
|
4
|
+
export type UseHashReturnValue = [string, (value: string) => void];
|
|
5
|
+
export declare function useHash({ getInitialValueInEffect, }?: UseHashOptions): UseHashReturnValue;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export declare const isFixed: (current: number, fixedAt: number) => boolean;
|
|
2
2
|
export declare const isPinned: (current: number, previous: number) => boolean;
|
|
3
3
|
export declare const isReleased: (current: number, previous: number, fixedAt: number) => boolean;
|
|
4
|
-
export declare const isPinnedOrReleased: (current: number, fixedAt: number, isCurrentlyPinnedRef: React.
|
|
4
|
+
export declare const isPinnedOrReleased: (current: number, fixedAt: number, isCurrentlyPinnedRef: React.RefObject<boolean>, isScrollingUp: boolean, onPin?: () => void, onRelease?: () => void) => void;
|
|
5
5
|
export declare const useScrollDirection: () => boolean;
|
|
6
|
-
interface
|
|
6
|
+
export interface UseHeadroomOptions {
|
|
7
7
|
/** Number in px at which element should be fixed */
|
|
8
8
|
fixedAt?: number;
|
|
9
9
|
/** Called when element is pinned */
|
|
@@ -13,5 +13,4 @@ interface UseHeadroomInput {
|
|
|
13
13
|
/** Called when element is unpinned */
|
|
14
14
|
onRelease?: () => void;
|
|
15
15
|
}
|
|
16
|
-
export declare function useHeadroom({ fixedAt, onPin, onFix, onRelease }?:
|
|
17
|
-
export {};
|
|
16
|
+
export declare function useHeadroom({ fixedAt, onPin, onFix, onRelease }?: UseHeadroomOptions): boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
ref: import("react").RefObject<T | null>;
|
|
1
|
+
export interface UseHoverReturnValue<T extends HTMLElement = any> {
|
|
3
2
|
hovered: boolean;
|
|
4
|
-
|
|
3
|
+
ref: React.RefCallback<T | null>;
|
|
4
|
+
}
|
|
5
|
+
export declare function useHover<T extends HTMLElement = any>(): UseHoverReturnValue<T>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
events
|
|
3
|
-
initialState
|
|
4
|
-
}
|
|
1
|
+
export interface UseIdleOptions {
|
|
2
|
+
events?: (keyof DocumentEventMap)[];
|
|
3
|
+
initialState?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function useIdle(timeout: number, options?: UseIdleOptions): boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
ref: (node: T | null) => void;
|
|
1
|
+
export interface UseInViewportReturnValue<T extends HTMLElement = any> {
|
|
3
2
|
inViewport: boolean;
|
|
4
|
-
|
|
3
|
+
ref: React.RefCallback<T | null>;
|
|
4
|
+
}
|
|
5
|
+
export declare function useInViewport<T extends HTMLElement = any>(): UseInViewportReturnValue<T>;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export declare function getInputOnChange<T>(setValue: (value: null | undefined | T | ((current: T) => T)) => void): (val: null | undefined | T | React.ChangeEvent<any> | ((current: T) => T)) => void;
|
|
2
|
-
export
|
|
2
|
+
export type UseInputStateReturnValue<T> = [
|
|
3
|
+
T,
|
|
4
|
+
(value: null | undefined | T | React.ChangeEvent<any>) => void
|
|
5
|
+
];
|
|
6
|
+
export declare function useInputState<T>(initialState: T): UseInputStateReturnValue<T>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
ref:
|
|
1
|
+
export interface UseIntersectionReturnValue<T> {
|
|
2
|
+
ref: React.RefCallback<T | null>;
|
|
3
3
|
entry: IntersectionObserverEntry | null;
|
|
4
|
-
}
|
|
4
|
+
}
|
|
5
|
+
export declare function useIntersection<T extends HTMLElement = any>(options?: IntersectionObserverInit): UseIntersectionReturnValue<T>;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
interface UseIntervalOptions {
|
|
1
|
+
export interface UseIntervalOptions {
|
|
2
2
|
/** If set, the interval will start automatically when the component is mounted, `false` by default */
|
|
3
3
|
autoInvoke?: boolean;
|
|
4
4
|
}
|
|
5
|
-
export
|
|
5
|
+
export interface UseIntervalReturnValue {
|
|
6
|
+
/** Starts the interval */
|
|
6
7
|
start: () => void;
|
|
8
|
+
/** Stops the interval */
|
|
7
9
|
stop: () => void;
|
|
10
|
+
/** Toggles the interval */
|
|
8
11
|
toggle: () => void;
|
|
12
|
+
/** Indicates if the interval is active */
|
|
9
13
|
active: boolean;
|
|
10
|
-
}
|
|
11
|
-
export {};
|
|
14
|
+
}
|
|
15
|
+
export declare function useInterval(fn: () => void, interval: number, { autoInvoke }?: UseIntervalOptions): UseIntervalReturnValue;
|
|
@@ -20,5 +20,5 @@ export interface UseListStateHandlers<T> {
|
|
|
20
20
|
setItemProp: <K extends keyof T, U extends T[K]>(index: number, prop: K, value: U) => void;
|
|
21
21
|
filter: (fn: (item: T, i: number) => boolean) => void;
|
|
22
22
|
}
|
|
23
|
-
export type
|
|
24
|
-
export declare function useListState<T>(initialValue?: T[]):
|
|
23
|
+
export type UseListStateReturnValue<T> = [T[], UseListStateHandlers<T>];
|
|
24
|
+
export declare function useListState<T>(initialValue?: T[]): UseListStateReturnValue<T>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type StorageType = 'localStorage' | 'sessionStorage';
|
|
2
|
-
export interface
|
|
2
|
+
export interface UseStorageOptions<T> {
|
|
3
3
|
/** Storage key */
|
|
4
4
|
key: string;
|
|
5
5
|
/** Default value that will be set if value is not found in storage */
|
|
@@ -13,5 +13,10 @@ export interface StorageProperties<T> {
|
|
|
13
13
|
/** Function to deserialize string value from storage to value */
|
|
14
14
|
deserialize?: (value: string | undefined) => T;
|
|
15
15
|
}
|
|
16
|
-
export
|
|
17
|
-
|
|
16
|
+
export type UseStorageReturnValue<T> = [
|
|
17
|
+
T,
|
|
18
|
+
(val: T | ((prevState: T) => T)) => void,
|
|
19
|
+
() => void
|
|
20
|
+
];
|
|
21
|
+
export declare function createStorage<T>(type: StorageType, hookName: string): ({ key, defaultValue, getInitialValueInEffect, sync, deserialize, serialize, }: UseStorageOptions<T>) => UseStorageReturnValue<T>;
|
|
22
|
+
export declare function readValue(type: StorageType): <T>({ key, defaultValue, deserialize, }: UseStorageOptions<T>) => T;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function useLocalStorage<T = string>(props:
|
|
3
|
-
export declare const readLocalStorageValue: <T>({ key, defaultValue, deserialize, }:
|
|
1
|
+
import { UseStorageOptions } from './create-storage';
|
|
2
|
+
export declare function useLocalStorage<T = string>(props: UseStorageOptions<T>): import("./create-storage").UseStorageReturnValue<T>;
|
|
3
|
+
export declare const readLocalStorageValue: <T>({ key, defaultValue, deserialize, }: UseStorageOptions<T>) => T;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface UseLongPressOptions {
|
|
3
|
+
/** Time in milliseconds to trigger the long press, default is 400ms */
|
|
4
|
+
threshold?: number;
|
|
5
|
+
/** Callback triggered when the long press starts */
|
|
6
|
+
onStart?: (event: React.MouseEvent | React.TouchEvent) => void;
|
|
7
|
+
/** Callback triggered when the long press finishes */
|
|
8
|
+
onFinish?: (event: React.MouseEvent | React.TouchEvent) => void;
|
|
9
|
+
/** Callback triggered when the long press is canceled */
|
|
10
|
+
onCancel?: (event: React.MouseEvent | React.TouchEvent) => void;
|
|
11
|
+
}
|
|
12
|
+
export interface UseLongPressReturnValue {
|
|
13
|
+
onMouseDown: (event: React.MouseEvent) => void;
|
|
14
|
+
onMouseUp: (event: React.MouseEvent) => void;
|
|
15
|
+
onMouseLeave: (event: React.MouseEvent) => void;
|
|
16
|
+
onTouchStart: (event: React.TouchEvent) => void;
|
|
17
|
+
onTouchEnd: (event: React.TouchEvent) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare function useLongPress(onLongPress: (event: React.MouseEvent | React.TouchEvent) => void, options?: UseLongPressOptions): UseLongPressReturnValue;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export interface UseMediaQueryOptions {
|
|
2
2
|
getInitialValueInEffect: boolean;
|
|
3
3
|
}
|
|
4
|
-
export declare function useMediaQuery(query: string, initialValue?: boolean, { getInitialValueInEffect }?: UseMediaQueryOptions): boolean
|
|
4
|
+
export declare function useMediaQuery(query: string, initialValue?: boolean, { getInitialValueInEffect }?: UseMediaQueryOptions): boolean;
|
|
@@ -2,6 +2,6 @@ import { Ref, type RefCallback } from 'react';
|
|
|
2
2
|
type PossibleRef<T> = Ref<T> | undefined;
|
|
3
3
|
type RefCleanup<T> = ReturnType<RefCallback<T>>;
|
|
4
4
|
export declare function assignRef<T>(ref: PossibleRef<T>, value: T): RefCleanup<T>;
|
|
5
|
-
export declare function mergeRefs<T>(...refs: PossibleRef<T>[]):
|
|
6
|
-
export declare function useMergedRef<T>(...refs: PossibleRef<T>[]):
|
|
5
|
+
export declare function mergeRefs<T>(...refs: PossibleRef<T>[]): RefCallback<T>;
|
|
6
|
+
export declare function useMergedRef<T>(...refs: PossibleRef<T>[]): RefCallback<T>;
|
|
7
7
|
export {};
|
|
@@ -6,12 +6,12 @@ export declare function clampUseMovePosition(position: UseMovePosition): {
|
|
|
6
6
|
x: number;
|
|
7
7
|
y: number;
|
|
8
8
|
};
|
|
9
|
-
interface
|
|
9
|
+
export interface UseMoveHandlers {
|
|
10
10
|
onScrubStart?: () => void;
|
|
11
11
|
onScrubEnd?: () => void;
|
|
12
12
|
}
|
|
13
|
-
export
|
|
14
|
-
ref:
|
|
13
|
+
export interface UseMoveReturnValue<T extends HTMLElement = any> {
|
|
14
|
+
ref: React.RefCallback<T | null>;
|
|
15
15
|
active: boolean;
|
|
16
|
-
}
|
|
17
|
-
export
|
|
16
|
+
}
|
|
17
|
+
export declare function useMove<T extends HTMLElement = any>(onChange: (value: UseMovePosition) => void, handlers?: UseMoveHandlers, dir?: 'ltr' | 'rtl'): UseMoveReturnValue<T>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
interface
|
|
1
|
+
export interface UserNetworkReturnValue {
|
|
2
|
+
online: boolean;
|
|
2
3
|
downlink?: number;
|
|
3
4
|
downlinkMax?: number;
|
|
4
5
|
effectiveType?: 'slow-2g' | '2g' | '3g' | '4g';
|
|
@@ -6,7 +7,4 @@ interface NetworkStatus {
|
|
|
6
7
|
saveData?: boolean;
|
|
7
8
|
type?: 'bluetooth' | 'cellular' | 'ethernet' | 'wifi' | 'wimax' | 'none' | 'other' | 'unknown';
|
|
8
9
|
}
|
|
9
|
-
export declare function useNetwork():
|
|
10
|
-
online: boolean;
|
|
11
|
-
} & NetworkStatus;
|
|
12
|
-
export {};
|
|
10
|
+
export declare function useNetwork(): UserNetworkReturnValue;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface UseOrientationOptions {
|
|
1
|
+
export interface UseOrientationOptions {
|
|
2
2
|
/** Default angle value, used until the real can be retrieved
|
|
3
3
|
* (during server side rendering and before js executes on the page)
|
|
4
4
|
* If not provided, the default value is `0`
|
|
@@ -15,9 +15,8 @@ interface UseOrientationOptions {
|
|
|
15
15
|
*/
|
|
16
16
|
getInitialValueInEffect?: boolean;
|
|
17
17
|
}
|
|
18
|
-
interface UseOrientationReturnType {
|
|
18
|
+
export interface UseOrientationReturnType {
|
|
19
19
|
angle: number;
|
|
20
20
|
type: OrientationType;
|
|
21
21
|
}
|
|
22
22
|
export declare function useOrientation({ defaultAngle, defaultType, getInitialValueInEffect, }?: UseOrientationOptions): UseOrientationReturnType;
|
|
23
|
-
export {};
|
package/lib/use-os/use-os.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export type
|
|
2
|
-
interface UseOsOptions {
|
|
1
|
+
export type UseOSReturnValue = 'undetermined' | 'macos' | 'ios' | 'windows' | 'android' | 'linux' | 'chromeos';
|
|
2
|
+
export interface UseOsOptions {
|
|
3
3
|
getValueInEffect: boolean;
|
|
4
4
|
}
|
|
5
|
-
export declare function useOs(options?: UseOsOptions):
|
|
6
|
-
export {};
|
|
5
|
+
export declare function useOs(options?: UseOsOptions): UseOSReturnValue;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const DOTS = "dots";
|
|
2
|
-
export interface
|
|
2
|
+
export interface UsePaginationOptions {
|
|
3
3
|
/** Page selected on initial render, defaults to 1 */
|
|
4
4
|
initialPage?: number;
|
|
5
5
|
/** Controlled active page number */
|
|
@@ -13,12 +13,20 @@ export interface PaginationParams {
|
|
|
13
13
|
/** Callback fired after change of each page */
|
|
14
14
|
onChange?: (page: number) => void;
|
|
15
15
|
}
|
|
16
|
-
export
|
|
17
|
-
|
|
16
|
+
export interface UsePaginationReturnValue {
|
|
17
|
+
/** Array of page numbers and dots */
|
|
18
|
+
range: (number | 'dots')[];
|
|
19
|
+
/** Active page number */
|
|
18
20
|
active: number;
|
|
19
|
-
|
|
21
|
+
/** Function to set active page */
|
|
22
|
+
setPage: (page: number) => void;
|
|
23
|
+
/** Function to go to next page */
|
|
20
24
|
next: () => void;
|
|
25
|
+
/** Function to go to previous page */
|
|
21
26
|
previous: () => void;
|
|
27
|
+
/** Function to go to first page */
|
|
22
28
|
first: () => void;
|
|
29
|
+
/** Function to go to last page */
|
|
23
30
|
last: () => void;
|
|
24
|
-
}
|
|
31
|
+
}
|
|
32
|
+
export declare function usePagination({ total, siblings, boundaries, page, initialPage, onChange, }: UsePaginationOptions): UsePaginationReturnValue;
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface UseQueueOptions<T> {
|
|
2
|
+
/** Initial values to be added to the queue */
|
|
2
3
|
initialValues?: T[];
|
|
4
|
+
/** Maximum number of items in the state */
|
|
3
5
|
limit: number;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
+
}
|
|
7
|
+
export interface UseQueueReturnValue<T> {
|
|
8
|
+
/** Array of items in the queue */
|
|
6
9
|
queue: T[];
|
|
10
|
+
/** Array of items in the state */
|
|
11
|
+
state: T[];
|
|
12
|
+
/** Function to add items to state or queue */
|
|
7
13
|
add: (...items: T[]) => void;
|
|
14
|
+
/** Function to apply updates to current items */
|
|
8
15
|
update: (fn: (state: T[]) => T[]) => void;
|
|
16
|
+
/** Function to clear the queue */
|
|
9
17
|
cleanQueue: () => void;
|
|
10
|
-
}
|
|
18
|
+
}
|
|
19
|
+
export declare function useQueue<T>({ initialValues, limit, }: UseQueueOptions<T>): UseQueueReturnValue<T>;
|
|
@@ -9,7 +9,10 @@ export interface UseRadialMoveOptions {
|
|
|
9
9
|
/** Called in `onMouseUp` and `onTouchEnd` events */
|
|
10
10
|
onScrubEnd?: () => void;
|
|
11
11
|
}
|
|
12
|
-
export
|
|
13
|
-
|
|
12
|
+
export interface UseRadialMoveReturnValue<T extends HTMLElement = any> {
|
|
13
|
+
/** Ref to be passed to the element that should be used for radial move */
|
|
14
|
+
ref: React.RefCallback<T | null>;
|
|
15
|
+
/** Indicates whether the radial move is active */
|
|
14
16
|
active: boolean;
|
|
15
|
-
}
|
|
17
|
+
}
|
|
18
|
+
export declare function useRadialMove<T extends HTMLElement = any>(onChange: (value: number) => void, { step, onChangeEnd, onScrubStart, onScrubEnd }?: UseRadialMoveOptions): UseRadialMoveReturnValue<T>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { UseMediaQueryOptions } from '../use-media-query/use-media-query';
|
|
2
|
-
export declare function useReducedMotion(initialValue?: boolean, options?: UseMediaQueryOptions): boolean
|
|
2
|
+
export declare function useReducedMotion(initialValue?: boolean, options?: UseMediaQueryOptions): boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface UseScrollIntoViewAnimation {
|
|
2
2
|
/** Target element alignment relatively to parent based on current axis */
|
|
3
3
|
alignment?: 'start' | 'end' | 'center';
|
|
4
4
|
}
|
|
5
|
-
interface
|
|
5
|
+
export interface UseScrollIntoViewOptions {
|
|
6
6
|
/** Callback fired after scroll */
|
|
7
7
|
onScrollFinish?: () => void;
|
|
8
8
|
/** Duration of scroll in milliseconds */
|
|
@@ -18,11 +18,11 @@ interface ScrollIntoViewParams {
|
|
|
18
18
|
/** Prevents content jumping in scrolling lists with multiple targets */
|
|
19
19
|
isList?: boolean;
|
|
20
20
|
}
|
|
21
|
-
interface
|
|
22
|
-
scrollableRef: React.RefObject<Parent>;
|
|
23
|
-
targetRef: React.RefObject<Target>;
|
|
24
|
-
scrollIntoView: (params?:
|
|
21
|
+
export interface UseScrollIntoViewReturnValue<Target extends HTMLElement = any, Parent extends HTMLElement | null = null> {
|
|
22
|
+
scrollableRef: React.RefObject<Parent | null>;
|
|
23
|
+
targetRef: React.RefObject<Target | null>;
|
|
24
|
+
scrollIntoView: (params?: UseScrollIntoViewAnimation) => void;
|
|
25
25
|
cancel: () => void;
|
|
26
26
|
}
|
|
27
|
-
export declare function useScrollIntoView<Target extends HTMLElement = any, Parent extends HTMLElement | null = null>({ duration, axis, onScrollFinish, easing, offset, cancelable, isList, }?:
|
|
27
|
+
export declare function useScrollIntoView<Target extends HTMLElement = any, Parent extends HTMLElement | null = null>({ duration, axis, onScrollFinish, easing, offset, cancelable, isList, }?: UseScrollIntoViewOptions): UseScrollIntoViewReturnValue<Target, Parent>;
|
|
28
28
|
export {};
|