react-hook-toolkit 1.0.0 → 1.0.3
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/README.md +1 -4
- package/dist/hookExecuter/hookExecuter.d.ts +20 -0
- package/dist/hookExecuter/hookExecuter.js +58 -0
- package/dist/hooks/hooksComp.d.ts +8 -37
- package/dist/hooks/hooksComp.js +55 -193
- package/dist/index.d.ts +5 -2
- package/dist/index.js +5 -2
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +1 -0
- package/package.json +11 -3
package/README.md
CHANGED
|
@@ -116,10 +116,7 @@ Install the package with npm:
|
|
|
116
116
|
|
|
117
117
|
- **`useUpdateEffect`**: Executes a side effect on updates after the initial render, skipping the effect during the first render to avoid unnecessary executions.
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
- **Shivaji** : (Sr. React Developer)
|
|
122
|
-
- **Shyamal** : (Sr. React Developer)
|
|
119
|
+
- **`DynamicLoader`**: A Higher-Order Component (HOC) that dynamically loads a React component using `React.lazy()` with `Suspense`, while wrapping it in an `ErrorBoundary` to handle potential errors gracefully. It ensures that the component is loaded only when needed, reducing the initial bundle size and improving performance.
|
|
123
120
|
|
|
124
121
|
## License
|
|
125
122
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license HEXE
|
|
3
|
+
* Copyright (c) 2020-2024 Shivaji & Collaborators
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
type HookFunction = () => any;
|
|
9
|
+
declare class HEXE {
|
|
10
|
+
private hs;
|
|
11
|
+
private ss;
|
|
12
|
+
constructor();
|
|
13
|
+
setHook(name: string, hookFunction: HookFunction): this;
|
|
14
|
+
private putHooks;
|
|
15
|
+
component(): React.FC;
|
|
16
|
+
getHook(name: string): any;
|
|
17
|
+
}
|
|
18
|
+
declare const ReactHooksWrapper: React.FC<{}>;
|
|
19
|
+
declare const getHook: (name: string) => any, setHook: (name: string, hookFunction: HookFunction) => HEXE;
|
|
20
|
+
export { ReactHooksWrapper, getHook, setHook };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license HEXE
|
|
3
|
+
* Copyright (c) 2020-2024 Shivaji & Collaborators
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
var HEXE = /** @class */ (function () {
|
|
9
|
+
function HEXE() {
|
|
10
|
+
this.hs = {};
|
|
11
|
+
this.ss = {};
|
|
12
|
+
this.setHook = this.setHook.bind(this);
|
|
13
|
+
this.getHook = this.getHook.bind(this);
|
|
14
|
+
this.putHooks = this.putHooks.bind(this);
|
|
15
|
+
}
|
|
16
|
+
HEXE.prototype.setHook = function (name, hookFunction) {
|
|
17
|
+
[
|
|
18
|
+
{ value: name, id: 'name', type: 'string' },
|
|
19
|
+
{ value: hookFunction, id: 'hook', type: 'function' },
|
|
20
|
+
].forEach(function (_a) {
|
|
21
|
+
var value = _a.value, id = _a.id, type = _a.type;
|
|
22
|
+
if (type === 'string' && typeof value !== 'string') {
|
|
23
|
+
throw new TypeError("\"".concat(id, "\" expected to be of type ").concat(type));
|
|
24
|
+
}
|
|
25
|
+
if (type === 'function' && typeof value !== 'function') {
|
|
26
|
+
throw new TypeError("\"".concat(id, "\" expected to be of type ").concat(type));
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
this.hs[name] = {
|
|
30
|
+
name: name,
|
|
31
|
+
hook: hookFunction,
|
|
32
|
+
};
|
|
33
|
+
return this;
|
|
34
|
+
};
|
|
35
|
+
HEXE.prototype.putHooks = function (name, value) {
|
|
36
|
+
this.ss[name] = value;
|
|
37
|
+
};
|
|
38
|
+
HEXE.prototype.component = function () {
|
|
39
|
+
var _this = this;
|
|
40
|
+
/* Author: Shivaji & Shyamal */
|
|
41
|
+
var Component = function () {
|
|
42
|
+
Object.values(_this.hs).forEach(function (_a) {
|
|
43
|
+
var name = _a.name, hook = _a.hook;
|
|
44
|
+
_this.putHooks(name, hook());
|
|
45
|
+
});
|
|
46
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null);
|
|
47
|
+
};
|
|
48
|
+
return Component;
|
|
49
|
+
};
|
|
50
|
+
HEXE.prototype.getHook = function (name) {
|
|
51
|
+
return this.ss[name];
|
|
52
|
+
};
|
|
53
|
+
return HEXE;
|
|
54
|
+
}());
|
|
55
|
+
var o = new HEXE();
|
|
56
|
+
var ReactHooksWrapper = o.component();
|
|
57
|
+
var getHook = o.getHook, setHook = o.setHook;
|
|
58
|
+
export { ReactHooksWrapper, getHook, setHook };
|
|
@@ -1,38 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
threshold?: number | number[];
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export declare const DynamicLoader: (Component: any) => (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
interface PropsType {
|
|
4
|
+
type: string;
|
|
5
|
+
msg: string;
|
|
6
|
+
duration?: number;
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
export interface DragDropState {
|
|
12
|
-
isDragging: boolean;
|
|
13
|
-
isOver: boolean;
|
|
14
|
-
draggedItemId: string | null;
|
|
15
|
-
overDropId: string | null;
|
|
16
|
-
}
|
|
17
|
-
export declare const useDragDrop: (onDrop: (dragId: string, dropId: string) => void) => {
|
|
18
|
-
state: DragDropState;
|
|
19
|
-
bindDrag: (dragId: string) => {
|
|
20
|
-
draggable: boolean;
|
|
21
|
-
onDragStart: (e: React.DragEvent) => void;
|
|
22
|
-
};
|
|
23
|
-
bindDrop: (dropId: string) => {
|
|
24
|
-
onDragOver: (e: React.DragEvent) => void;
|
|
25
|
-
onDragEnter: (e: React.DragEvent) => void;
|
|
26
|
-
onDragLeave: (e: React.DragEvent) => void;
|
|
27
|
-
onDrop: (e: React.DragEvent) => void;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
export declare function useFocusTrap(ref: React.RefObject<HTMLElement>): void;
|
|
31
|
-
export declare function useFocus<T extends HTMLElement>(): [React.RefObject<T>, boolean];
|
|
32
|
-
interface WindowSize {
|
|
33
|
-
width: number;
|
|
34
|
-
height: number;
|
|
35
|
-
}
|
|
36
|
-
export declare function useElementSize<T extends HTMLElement = HTMLDivElement>(): [(node: T | null) => void, WindowSize];
|
|
37
|
-
export declare function useLockBodyScroll(lock?: boolean): void;
|
|
38
|
-
export {};
|
|
8
|
+
declare const AlertMessage: FC<PropsType>;
|
|
9
|
+
export default AlertMessage;
|
package/dist/hooks/hooksComp.js
CHANGED
|
@@ -9,204 +9,66 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
node.addEventListener('mouseout', handleMouseOut);
|
|
24
|
-
return function () {
|
|
25
|
-
node.removeEventListener('mouseover', handleMouseOver);
|
|
26
|
-
node.removeEventListener('mouseout', handleMouseOut);
|
|
27
|
-
};
|
|
28
|
-
}, []);
|
|
29
|
-
return [ref, isHovered];
|
|
30
|
-
}
|
|
31
|
-
export function useOnClickOutside(ref, handler) {
|
|
32
|
-
useEffect(function () {
|
|
33
|
-
var listener = function (event) {
|
|
34
|
-
if (!ref.current || ref.current.contains(event.target))
|
|
35
|
-
return;
|
|
36
|
-
handler(event);
|
|
37
|
-
};
|
|
38
|
-
document.addEventListener('mousedown', listener);
|
|
39
|
-
document.addEventListener('touchstart', listener);
|
|
40
|
-
return function () {
|
|
41
|
-
document.removeEventListener('mousedown', listener);
|
|
42
|
-
document.removeEventListener('touchstart', listener);
|
|
43
|
-
};
|
|
44
|
-
}, [ref, handler]);
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useEffect, useCallback, useRef, Suspense } from 'react';
|
|
14
|
+
import { Box, Alert, AlertTitle, IconButton } from '@mui/material';
|
|
15
|
+
import { Close } from '@mui/icons-material';
|
|
16
|
+
import NProgress from 'nprogress';
|
|
17
|
+
import { ErrorBoundary } from 'react-error-boundary';
|
|
18
|
+
import { promise } from '../utils';
|
|
19
|
+
import { getHook } from '../hookExecuter/hookExecuter';
|
|
20
|
+
function Fallback(_a) {
|
|
21
|
+
var error = _a.error;
|
|
22
|
+
return (_jsxs(Box, { sx: { padding: 2 }, children: [process.env.NODE_ENV === 'production' && (_jsxs(Alert, { sx: { py: 0, borderLeft: '2px solid #00abff !important', border: '1px solid #d0cfcf' }, severity: "info", children: [_jsx(AlertTitle, { children: "Page Loading Error" }), "Please check your network connection..."] })), process.env.NODE_ENV !== 'production' && (_jsxs(Alert, { severity: "error", sx: { py: 0, borderTop: '2px solid #791212ad !important', border: '1px solid #d0cfcf' }, children: [_jsx(AlertTitle, { children: "Error" }), error.message] }))] }));
|
|
45
23
|
}
|
|
46
|
-
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
rootMargin: rootMargin,
|
|
56
|
-
threshold: threshold,
|
|
57
|
-
});
|
|
58
|
-
var current = ref.current;
|
|
59
|
-
if (current)
|
|
60
|
-
observer.observe(current);
|
|
61
|
-
return function () {
|
|
62
|
-
if (current)
|
|
63
|
-
observer.unobserve(current);
|
|
64
|
-
};
|
|
65
|
-
}, [ref, root, rootMargin, threshold]);
|
|
66
|
-
return isIntersecting;
|
|
67
|
-
}
|
|
68
|
-
export function useHoverIntent() {
|
|
69
|
-
var _a = useState(false), isHovering = _a[0], setIsHovering = _a[1];
|
|
70
|
-
var ref = useRef(null);
|
|
71
|
-
useEffect(function () {
|
|
72
|
-
var node = ref.current;
|
|
73
|
-
if (!node)
|
|
74
|
-
return;
|
|
75
|
-
var timeout;
|
|
76
|
-
var handleMouseEnter = function () {
|
|
77
|
-
timeout = setTimeout(function () { return setIsHovering(true); }, 100);
|
|
78
|
-
};
|
|
79
|
-
var handleMouseLeave = function () {
|
|
80
|
-
clearTimeout(timeout);
|
|
81
|
-
setIsHovering(false);
|
|
82
|
-
};
|
|
83
|
-
node.addEventListener('mouseenter', handleMouseEnter);
|
|
84
|
-
node.addEventListener('mouseleave', handleMouseLeave);
|
|
85
|
-
return function () {
|
|
86
|
-
node.removeEventListener('mouseenter', handleMouseEnter);
|
|
87
|
-
node.removeEventListener('mouseleave', handleMouseLeave);
|
|
88
|
-
};
|
|
89
|
-
}, []);
|
|
90
|
-
return [ref, isHovering];
|
|
91
|
-
}
|
|
92
|
-
export var useDragDrop = function (onDrop) {
|
|
93
|
-
var _a = useState({
|
|
94
|
-
isDragging: false,
|
|
95
|
-
isOver: false,
|
|
96
|
-
draggedItemId: null,
|
|
97
|
-
overDropId: null,
|
|
98
|
-
}), state = _a[0], setState = _a[1];
|
|
99
|
-
var handleDragStart = useCallback(function (e, dragId) {
|
|
100
|
-
e.dataTransfer.setData('text/plain', dragId);
|
|
101
|
-
e.dataTransfer.effectAllowed = 'move';
|
|
102
|
-
setState({ isDragging: true, isOver: false, draggedItemId: dragId, overDropId: null });
|
|
103
|
-
}, []);
|
|
104
|
-
var handleDragOver = useCallback(function (e, dropId) {
|
|
105
|
-
e.preventDefault();
|
|
106
|
-
if (state.overDropId !== dropId) {
|
|
107
|
-
setState(function (s) { return (__assign(__assign({}, s), { isOver: true, overDropId: dropId })); });
|
|
24
|
+
var Error = function (_a) {
|
|
25
|
+
var children = _a.children;
|
|
26
|
+
var firstRender = useRef(false);
|
|
27
|
+
var handleReload = useCallback(function () {
|
|
28
|
+
if (!firstRender.current) {
|
|
29
|
+
firstRender.current = true; // Ensure this runs only once
|
|
30
|
+
promise(1500).then(function () {
|
|
31
|
+
window.location.reload();
|
|
32
|
+
});
|
|
108
33
|
}
|
|
109
|
-
}, [state.overDropId]);
|
|
110
|
-
var handleDragEnter = useCallback(function (e, dropId) {
|
|
111
|
-
e.preventDefault();
|
|
112
|
-
setState(function (s) { return (__assign(__assign({}, s), { isOver: true, overDropId: dropId })); });
|
|
113
34
|
}, []);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
setState(function (s) { return (__assign(__assign({}, s), { isOver: false, overDropId: null })); });
|
|
118
|
-
}
|
|
119
|
-
}, [state.overDropId]);
|
|
120
|
-
var handleDrop = useCallback(function (e, dropId) {
|
|
121
|
-
e.preventDefault();
|
|
122
|
-
var dragId = e.dataTransfer.getData('text/plain');
|
|
123
|
-
setState({ isDragging: false, isOver: false, draggedItemId: dragId, overDropId: dropId });
|
|
124
|
-
onDrop(dragId, dropId);
|
|
125
|
-
}, [onDrop]);
|
|
126
|
-
return {
|
|
127
|
-
state: state,
|
|
128
|
-
bindDrag: function (dragId) { return ({
|
|
129
|
-
draggable: true,
|
|
130
|
-
onDragStart: function (e) { return handleDragStart(e, dragId); },
|
|
131
|
-
}); },
|
|
132
|
-
bindDrop: function (dropId) { return ({
|
|
133
|
-
onDragOver: function (e) { return handleDragOver(e, dropId); },
|
|
134
|
-
onDragEnter: function (e) { return handleDragEnter(e, dropId); },
|
|
135
|
-
onDragLeave: function (e) { return handleDragLeave(e, dropId); },
|
|
136
|
-
onDrop: function (e) { return handleDrop(e, dropId); },
|
|
137
|
-
}); },
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
export function useFocusTrap(ref) {
|
|
141
|
-
useEffect(function () {
|
|
142
|
-
var handleFocus = function (event) {
|
|
143
|
-
var _a, _b, _c;
|
|
144
|
-
if (!((_a = ref.current) === null || _a === void 0 ? void 0 : _a.contains(event.target))) {
|
|
145
|
-
var focusableElements = (_b = ref.current) === null || _b === void 0 ? void 0 : _b.querySelectorAll('a, button, input, textarea, select, [tabindex]:not([tabindex="-1"])');
|
|
146
|
-
(_c = focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements[0]) === null || _c === void 0 ? void 0 : _c.focus();
|
|
147
|
-
event.preventDefault();
|
|
35
|
+
return (_jsx(ErrorBoundary, { FallbackComponent: Fallback, onError: function () {
|
|
36
|
+
if (process.env.NODE_ENV === 'production') {
|
|
37
|
+
handleReload();
|
|
148
38
|
}
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
document.removeEventListener('focusin', handleFocus);
|
|
153
|
-
};
|
|
154
|
-
}, [ref]);
|
|
155
|
-
}
|
|
156
|
-
export function useFocus() {
|
|
157
|
-
var _a = useState(false), isFocused = _a[0], setIsFocused = _a[1];
|
|
158
|
-
var ref = useRef(null);
|
|
39
|
+
}, children: children }));
|
|
40
|
+
};
|
|
41
|
+
var LoadingScreen = function () {
|
|
159
42
|
useEffect(function () {
|
|
160
|
-
|
|
161
|
-
if (!element)
|
|
162
|
-
return;
|
|
163
|
-
var handleFocus = function () { return setIsFocused(true); };
|
|
164
|
-
var handleBlur = function () { return setIsFocused(false); };
|
|
165
|
-
element.addEventListener('focus', handleFocus);
|
|
166
|
-
element.addEventListener('blur', handleBlur);
|
|
43
|
+
NProgress.start();
|
|
167
44
|
return function () {
|
|
168
|
-
|
|
169
|
-
element.removeEventListener('blur', handleBlur);
|
|
45
|
+
NProgress.done();
|
|
170
46
|
};
|
|
171
47
|
}, []);
|
|
172
|
-
return
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
if (typeof document === 'undefined') {
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
var originalStyle = window.getComputedStyle(document.body).overflow;
|
|
203
|
-
if (lock) {
|
|
204
|
-
document.body.style.overflow = 'hidden';
|
|
205
|
-
}
|
|
206
|
-
return function () {
|
|
207
|
-
if (lock) {
|
|
208
|
-
document.body.style.overflow = originalStyle;
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
}, [lock]);
|
|
212
|
-
}
|
|
48
|
+
return (_jsx(Box, { sx: {
|
|
49
|
+
backgroundColor: 'background.paper',
|
|
50
|
+
minHeight: '100%',
|
|
51
|
+
} }));
|
|
52
|
+
};
|
|
53
|
+
// prettier-ignore
|
|
54
|
+
export var DynamicLoader = function (Component) { return function (props) { return (_jsx(Error, { children: _jsx(Suspense, { fallback: _jsx(LoadingScreen, {}), children: _jsx(Component, __assign({}, props)) }) })); }; };
|
|
55
|
+
var AlertMessage = function (_a) {
|
|
56
|
+
var type = _a.type, msg = _a.msg, duration = _a.duration;
|
|
57
|
+
var _b = getHook('snackBar'), enqueueSnackbar = _b.enqueueSnackbar, closeSnackbar = _b.closeSnackbar;
|
|
58
|
+
if (msg !== undefined && msg !== '') {
|
|
59
|
+
enqueueSnackbar(msg !== null && msg !== void 0 ? msg : '', {
|
|
60
|
+
anchorOrigin: {
|
|
61
|
+
// @shivaji perpose dyanamic global alert.
|
|
62
|
+
horizontal: 'right',
|
|
63
|
+
vertical: 'top',
|
|
64
|
+
},
|
|
65
|
+
variant: type,
|
|
66
|
+
preventDuplicate: true,
|
|
67
|
+
// persist: true, whenever you want to close.
|
|
68
|
+
action: function (key) { return (_jsx(IconButton, { "aria-label": "close", size: "small", onClick: function () { return closeSnackbar(key); }, children: _jsx(Close, { fontSize: "small", sx: { color: '#fff' } }) })); },
|
|
69
|
+
autoHideDuration: duration !== null && duration !== void 0 ? duration : 6000,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
};
|
|
74
|
+
export default AlertMessage;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import 'nprogress/nprogress.css';
|
|
2
|
+
import { ReactHooksWrapper, getHook, setHook } from "./hookExecuter/hookExecuter";
|
|
3
|
+
import { DynamicLoader } from './hooks/hooksComp';
|
|
1
4
|
import { useAxios, useAdvReducer, useFetch, useLocalStorage, useToggle, useDebounce, useThrottle, usePrevious, useMediaQuery, useClipboard, useInterval, useWindowSize, useKeyPress, useOnlineStatus, useScrollPosition, useTimeout, useDarkMode, useForm, useArray, useStepper, useUpdateEffect, useTouch, useSound, useSessionStorage, usePreferredLanguage, useHistory, useEventListener, useBattery, useDebouncedCallback, useScrollLock, useResizeObserver, useMousePosition, useScrollDirection, useImageLoader, usePersistedState, useReducedMotion, useCookie, useFetchRetry, useDelay, useVisibilityChange, useDebouncedValue, useAsync, useScript, useIndexedDB, useGeoLocation, useTimer, useIsMounted, useCss, useSpeak, useCountUp, useCountDown } from './hooks/hooks';
|
|
2
|
-
|
|
3
|
-
export { useAxios, useAdvReducer,
|
|
5
|
+
export default ReactHooksWrapper;
|
|
6
|
+
export { getHook, setHook, useAxios, useAdvReducer, useFetch, useLocalStorage, useToggle, useDebounce, useThrottle, usePrevious, useMediaQuery, useClipboard, useInterval, useWindowSize, useKeyPress, useOnlineStatus, useScrollPosition, useTimeout, useDarkMode, useForm, useArray, useStepper, useUpdateEffect, useTouch, useSound, useSessionStorage, usePreferredLanguage, useHistory, useEventListener, useBattery, useDebouncedCallback, useScrollLock, useResizeObserver, useMousePosition, useScrollDirection, useImageLoader, usePersistedState, useReducedMotion, useCookie, useFetchRetry, useDelay, useVisibilityChange, useDebouncedValue, useAsync, useScript, useIndexedDB, useGeoLocation, useTimer, useIsMounted, useCss, useSpeak, useCountUp, useCountDown, DynamicLoader };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import 'nprogress/nprogress.css';
|
|
2
|
+
import { ReactHooksWrapper, getHook, setHook } from "./hookExecuter/hookExecuter";
|
|
3
|
+
import { DynamicLoader } from './hooks/hooksComp';
|
|
1
4
|
import { useAxios, useAdvReducer, useFetch, useLocalStorage, useToggle, useDebounce, useThrottle, usePrevious, useMediaQuery, useClipboard, useInterval, useWindowSize, useKeyPress, useOnlineStatus, useScrollPosition, useTimeout, useDarkMode, useForm, useArray, useStepper, useUpdateEffect, useTouch, useSound, useSessionStorage, usePreferredLanguage, useHistory, useEventListener, useBattery, useDebouncedCallback, useScrollLock, useResizeObserver, useMousePosition, useScrollDirection, useImageLoader, usePersistedState, useReducedMotion, useCookie, useFetchRetry, useDelay, useVisibilityChange, useDebouncedValue, useAsync, useScript, useIndexedDB, useGeoLocation, useTimer, useIsMounted, useCss, useSpeak, useCountUp, useCountDown, } from './hooks/hooks';
|
|
2
|
-
|
|
3
|
-
export { useAxios, useAdvReducer,
|
|
5
|
+
export default ReactHooksWrapper;
|
|
6
|
+
export { getHook, setHook, useAxios, useAdvReducer, useFetch, useLocalStorage, useToggle, useDebounce, useThrottle, usePrevious, useMediaQuery, useClipboard, useInterval, useWindowSize, useKeyPress, useOnlineStatus, useScrollPosition, useTimeout, useDarkMode, useForm, useArray, useStepper, useUpdateEffect, useTouch, useSound, useSessionStorage, usePreferredLanguage, useHistory, useEventListener, useBattery, useDebouncedCallback, useScrollLock, useResizeObserver, useMousePosition, useScrollDirection, useImageLoader, usePersistedState, useReducedMotion, useCookie, useFetchRetry, useDelay, useVisibilityChange, useDebouncedValue, useAsync, useScript, useIndexedDB, useGeoLocation, useTimer, useIsMounted, useCss, useSpeak, useCountUp, useCountDown, DynamicLoader };
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const promise: (time: number) => Promise<unknown>;
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var promise = function (time) { return new Promise(function (res) { return setTimeout(res, time); }); };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-hook-toolkit",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Ultimate package for React developers, offering a powerful collection of hooks to enhance their development experience.",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "Ultimate package for React developers, offering a powerful collection of hooks and components to enhance their development experience.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -19,12 +19,20 @@
|
|
|
19
19
|
],
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"devDependencies": {
|
|
22
|
+
"@types/node": "^22.13.10",
|
|
23
|
+
"@types/nprogress": "^0.2.3",
|
|
22
24
|
"@types/react": "^18.2.14",
|
|
23
25
|
"tslib": "^2.6.3",
|
|
24
26
|
"typescript": "^5.2.2"
|
|
25
27
|
},
|
|
26
28
|
"dependencies": {
|
|
29
|
+
"@emotion/react": "^11.14.0",
|
|
30
|
+
"@emotion/styled": "^11.14.0",
|
|
31
|
+
"@mui/icons-material": "^7.0.1",
|
|
32
|
+
"@mui/material": "^5.14.0",
|
|
27
33
|
"axios": "^1.7.8",
|
|
28
|
-
"
|
|
34
|
+
"nprogress": "^0.2.0",
|
|
35
|
+
"react": "^18.2.0",
|
|
36
|
+
"react-error-boundary": "^4.0.13"
|
|
29
37
|
}
|
|
30
38
|
}
|