react-hook-toolkit 1.1.8 → 1.2.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/dist/chunk1213/chunk158261.d.ts +16 -0
- package/dist/chunk1213/chunk158261.js +41 -0
- package/dist/chunk1213/chunk158862.d.ts +17 -0
- package/dist/chunk1213/chunk158862.js +121 -0
- package/dist/chunk1415/chunk143.d.ts +20 -0
- package/dist/chunk1415/chunk143.js +58 -0
- package/dist/chunk1516/chunk0021.d.ts +109 -0
- package/dist/chunk1516/chunk0021.js +700 -0
- package/dist/chunk1516/chunk0022.d.ts +2 -0
- package/dist/chunk1516/chunk0022.js +381 -0
- package/dist/chunk1516/chunk613852.d.ts +10 -0
- package/dist/chunk1516/chunk613852.js +299 -0
- package/dist/chunk1516/chunk726433.d.ts +58 -0
- package/dist/chunk1516/chunk726433.js +621 -0
- package/dist/chunk1516/chunk940514.d.ts +93 -0
- package/dist/chunk1516/chunk940514.js +817 -0
- package/dist/chunk1617/chunk613555.d.ts +23 -0
- package/dist/chunk1617/chunk613555.js +115 -0
- package/dist/chunk1617/chunk613557.d.ts +3 -0
- package/dist/chunk1617/chunk613557.js +7 -0
- package/dist/index.d.ts +15 -582
- package/dist/index.js +17 -209
- package/dist/type.d.ts +286 -0
- package/dist/type.js +7 -0
- package/dist/utils.d.ts +21 -0
- package/dist/utils.js +104 -0
- package/package.json +34 -47
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -209
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { AsyncFunction, FetchState, MousePosition, ScrollPosition, UseAsyncReturn, UseAxiosConfig, UseAxiosResponse, WindowSize } from '../type';
|
|
3
|
+
export declare const isReady: () => boolean;
|
|
4
|
+
export declare const useAxios: <T>(config?: UseAxiosConfig) => UseAxiosResponse<T>;
|
|
5
|
+
export declare const useDrawer: () => import("../chunk1213/chunk158261").DrawerContextValue;
|
|
6
|
+
export declare const useGenericReducer: <State, Action extends {
|
|
7
|
+
type: string;
|
|
8
|
+
}>(initialState: State, actions: Record<string, (state: State, action: Action) => State>) => (state: State | undefined, action: Action) => State;
|
|
9
|
+
export declare function useRequest<T>(url: string): FetchState<T>;
|
|
10
|
+
export declare function useLocalStorage<T>(key: string, initialValue: T): [T, (value: T) => void];
|
|
11
|
+
export declare function useToggle(initialValue?: boolean): [boolean, () => void];
|
|
12
|
+
export declare function useDebounce<T>(value: T, delay: number): T;
|
|
13
|
+
export declare function useThrottle<T>(value: T, limit: number): T;
|
|
14
|
+
export declare function usePrevious<T>(value: T): T | undefined;
|
|
15
|
+
export declare function useMediaQuery(query: string): boolean;
|
|
16
|
+
export declare function useClipboard(): [boolean, (text: string) => Promise<void>];
|
|
17
|
+
export declare function useInterval(callback: () => void, delay: number | null): void;
|
|
18
|
+
export declare function useWindowSize(): WindowSize;
|
|
19
|
+
export declare function useKeyPress(targetKey: string): boolean;
|
|
20
|
+
export declare function useOnlineStatus(): boolean;
|
|
21
|
+
export declare function useScrollPosition(): ScrollPosition;
|
|
22
|
+
export declare function useTimeout(callback: () => void, delay: number | null): void;
|
|
23
|
+
export declare function useDarkMode(): [boolean, () => void];
|
|
24
|
+
export declare function useForm<T extends Record<string, any>>(initialValues: T): {
|
|
25
|
+
values: T;
|
|
26
|
+
errors: Partial<Record<keyof T, string>>;
|
|
27
|
+
handleChange: (name: keyof T, value: any) => void;
|
|
28
|
+
validate: (validators: Partial<Record<keyof T, (value: any) => string | null>>) => boolean;
|
|
29
|
+
};
|
|
30
|
+
export declare function useArray<T>(initialArray: T[]): {
|
|
31
|
+
array: T[];
|
|
32
|
+
set: import("react").Dispatch<import("react").SetStateAction<T[]>>;
|
|
33
|
+
push: (item: T) => void;
|
|
34
|
+
removeByIndex: (index: number) => void;
|
|
35
|
+
clear: () => void;
|
|
36
|
+
};
|
|
37
|
+
export declare const useStepper: (totalSteps: number) => {
|
|
38
|
+
activeStep: number;
|
|
39
|
+
handleNext: () => void;
|
|
40
|
+
handleBack: () => void;
|
|
41
|
+
handleReset: () => void;
|
|
42
|
+
totalSteps: number;
|
|
43
|
+
isFirstStep: boolean;
|
|
44
|
+
isLastStep: boolean;
|
|
45
|
+
isProccesing: boolean;
|
|
46
|
+
setIsProccesing: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
47
|
+
goto: (step: number) => void;
|
|
48
|
+
};
|
|
49
|
+
export declare const useSteps: (totalSteps: number) => {
|
|
50
|
+
activeStep: number;
|
|
51
|
+
handleNext: () => void;
|
|
52
|
+
handleBack: () => void;
|
|
53
|
+
handleReset: () => void;
|
|
54
|
+
goto: (step: number) => void;
|
|
55
|
+
totalSteps: number;
|
|
56
|
+
isFirstStep: boolean;
|
|
57
|
+
isLastStep: boolean;
|
|
58
|
+
isProcessing: boolean;
|
|
59
|
+
setIsProcessing: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
60
|
+
};
|
|
61
|
+
export declare function useTimeoutFn(callback: () => void, delay: number | null): {
|
|
62
|
+
reset: () => void;
|
|
63
|
+
clear: () => void;
|
|
64
|
+
};
|
|
65
|
+
export declare function useDebouncedCallback(callback: () => void, delay: number): () => void;
|
|
66
|
+
export declare function useScrollLock(lock: boolean): void;
|
|
67
|
+
export declare function useResizeObserver<T extends HTMLElement>(ref: RefObject<T>): WindowSize | null;
|
|
68
|
+
export declare function useMousePosition(): MousePosition;
|
|
69
|
+
type ScrollDirection = 'up' | 'down';
|
|
70
|
+
export declare function useScrollDirection(): ScrollDirection;
|
|
71
|
+
export declare function useImageLoader(src: string): {
|
|
72
|
+
loaded: boolean;
|
|
73
|
+
error: boolean;
|
|
74
|
+
};
|
|
75
|
+
export declare function usePersistedState<T>(key: string, initialValue: T): [T, React.Dispatch<React.SetStateAction<T>>];
|
|
76
|
+
export declare function useReducedMotion(): boolean;
|
|
77
|
+
export declare function useCookie(key: string): [string | null, (value: string, options?: any) => void, () => void];
|
|
78
|
+
export declare function useRequestRetry<T>(url: string, options: RequestInit, retries?: number): {
|
|
79
|
+
data: T | null;
|
|
80
|
+
error: string | null;
|
|
81
|
+
loading: boolean;
|
|
82
|
+
};
|
|
83
|
+
export declare function useDelay<T>(value: T, delay: number): T;
|
|
84
|
+
export declare function useVisibilityChange(): boolean;
|
|
85
|
+
export declare function useDebouncedValue<T>(value: T, delay: number): T;
|
|
86
|
+
export declare function useAsync<T>(asyncFunction: AsyncFunction<T>, immediate?: boolean): UseAsyncReturn<T>;
|
|
87
|
+
export type ScriptStatus = 'loading' | 'ready' | 'error' | 'unknown';
|
|
88
|
+
export declare function useScript(src: string, removeOnUnmount?: boolean): ScriptStatus;
|
|
89
|
+
export declare function useIndexedDB<T>(dbName: string, storeName: string): {
|
|
90
|
+
data: T | null;
|
|
91
|
+
error: Error | null;
|
|
92
|
+
};
|
|
93
|
+
export {};
|