react-hook-toolkit 1.0.17 → 1.0.19
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 +35 -3
- package/dist/{hooks → chunk1516}/chunk613852.d.ts +16 -0
- package/dist/{hooks → chunk1516}/chunk613852.js +91 -2
- package/dist/{hooks → chunk1516}/chunk726433.d.ts +12 -0
- package/dist/{hooks → chunk1516}/chunk726433.js +42 -0
- package/dist/{hooks → chunk1516}/chunk940514.d.ts +1 -1
- package/dist/{hooks → chunk1516}/chunk940514.js +1 -1
- package/dist/{skeletons → chunk1617}/chunk613555.js +12 -3
- package/dist/index.d.ts +6 -6
- package/dist/index.js +6 -6
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +11 -0
- package/package.json +1 -1
- /package/dist/{contexts → chunk1213}/chunk158261.d.ts +0 -0
- /package/dist/{contexts → chunk1213}/chunk158261.js +0 -0
- /package/dist/{hookExecuter → chunk1415}/chunk143.d.ts +0 -0
- /package/dist/{hookExecuter → chunk1415}/chunk143.js +0 -0
- /package/dist/{skeletons → chunk1617}/chunk613555.d.ts +0 -0
package/README.md
CHANGED
|
@@ -10,14 +10,12 @@ Install the package:
|
|
|
10
10
|
```bash
|
|
11
11
|
npm install react-hook-toolkit
|
|
12
12
|
# or
|
|
13
|
-
yarn add react-hook-toolkit
|
|
14
|
-
# or
|
|
15
13
|
pnpm add react-hook-toolkit
|
|
16
14
|
```
|
|
17
15
|
|
|
18
16
|
### **Authors**
|
|
19
17
|
|
|
20
|
-
    
|
|
21
19
|
|
|
22
20
|
### **Browser Support**
|
|
23
21
|
|
|
@@ -465,6 +463,19 @@ goBack();
|
|
|
465
463
|
goForward();
|
|
466
464
|
```
|
|
467
465
|
|
|
466
|
+
---
|
|
467
|
+
📌 **useRecentSearch**
|
|
468
|
+
Return and manage recent searched history.
|
|
469
|
+
|
|
470
|
+
```ts
|
|
471
|
+
const { recentSearches, addSearch, clearSearch, hasSearch } = useRecentSearch<SearchItem>({
|
|
472
|
+
key: 'myRecentItems',
|
|
473
|
+
limit: 5,
|
|
474
|
+
uniqueKey: 'id',
|
|
475
|
+
excludeEmpty: true,
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
```
|
|
468
479
|
---
|
|
469
480
|
📌 **useHistoryState**
|
|
470
481
|
Manages state history with undo/redo capabilities.
|
|
@@ -680,6 +691,27 @@ const MyComponent = DynamicLoader(lazy(() => import("./MyComponent")));
|
|
|
680
691
|
```
|
|
681
692
|
---
|
|
682
693
|
|
|
694
|
+
✅ **ContextMenuWrapper**
|
|
695
|
+
Displays a customizable context menu with support for light/dark themes, keyboard navigation, accessibility compliance, and automatic positioning. Handles items, dividers, icons, shortcuts, and click events.
|
|
696
|
+
|
|
697
|
+
```tsx
|
|
698
|
+
<ContextMenuWrapper
|
|
699
|
+
items={[
|
|
700
|
+
{ label: 'Edit', icon: <EditIcon />, onClick: handleEdit },
|
|
701
|
+
{ label: 'Copy', shortcut: '⌘C', onClick: handleCopy },
|
|
702
|
+
'divider',
|
|
703
|
+
{ label: 'Delete', disabled: true, onClick: handleDelete }
|
|
704
|
+
]}
|
|
705
|
+
theme="dark"
|
|
706
|
+
onShow={() => console.log('Menu opened')}
|
|
707
|
+
onHide={() => console.log('Menu closed')}
|
|
708
|
+
currentInstance={this}
|
|
709
|
+
>
|
|
710
|
+
<div>Right-click here</div>
|
|
711
|
+
</ContextMenu>
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
---
|
|
683
715
|
✅ **FilePreview**
|
|
684
716
|
Displays a styled file card with an icon based on file type, filename with ellipsis handling, file size, and an optional download action.
|
|
685
717
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
|
+
import '../css/chunkcss9876.css';
|
|
2
3
|
export declare const DynamicLoader: (Component: any) => (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
interface PropsType {
|
|
4
5
|
type: string;
|
|
@@ -52,4 +53,19 @@ interface DownloadFileProps {
|
|
|
52
53
|
onDownload: () => void;
|
|
53
54
|
}
|
|
54
55
|
export declare const DownloadFile: React.FC<DownloadFileProps>;
|
|
56
|
+
type MenuPosition = 'auto' | 'fixed';
|
|
57
|
+
type Theme = 'light' | 'dark';
|
|
58
|
+
interface ContextMenuProps {
|
|
59
|
+
options: any;
|
|
60
|
+
children: React.ReactNode;
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
className?: string;
|
|
63
|
+
menuClassName?: string;
|
|
64
|
+
position?: MenuPosition;
|
|
65
|
+
onShow?: () => void;
|
|
66
|
+
onHide?: () => void;
|
|
67
|
+
currentInstance?: any;
|
|
68
|
+
theme?: Theme;
|
|
69
|
+
}
|
|
70
|
+
export declare const ContextMenuWrapper: React.FC<ContextMenuProps>;
|
|
55
71
|
export {};
|
|
@@ -10,14 +10,15 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
-
import { forwardRef } from 'react';
|
|
13
|
+
import { forwardRef, useState } from 'react';
|
|
14
14
|
import { useEffect, useCallback, useRef, Suspense } from 'react';
|
|
15
15
|
import { Box, Alert, AlertTitle, IconButton, CardContent, Tooltip, Typography, Card, Grid, Skeleton, CircularProgress, } from '@mui/material';
|
|
16
16
|
import { Close, InsertDriveFile, Image, Description, Download, CheckCircleOutlined, ErrorOutlineOutlined, Upload, } from '@mui/icons-material';
|
|
17
|
+
import '../css/chunkcss9876.css';
|
|
17
18
|
import NProgress from 'nprogress';
|
|
18
19
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
19
20
|
import { promise } from '../utils';
|
|
20
|
-
import { getHook } from '../
|
|
21
|
+
import { getHook } from '../chunk1415/chunk143';
|
|
21
22
|
import { useWindowSize } from './chunk940514';
|
|
22
23
|
function Fallback(_a) {
|
|
23
24
|
var error = _a.error;
|
|
@@ -166,3 +167,91 @@ export var DownloadFile = function (_a) {
|
|
|
166
167
|
zIndex: 1,
|
|
167
168
|
} }))] }) }));
|
|
168
169
|
};
|
|
170
|
+
export var ContextMenuWrapper = function (_a) {
|
|
171
|
+
var options = _a.options, children = _a.children, disabled = _a.disabled, className = _a.className, menuClassName = _a.menuClassName, _b = _a.position, position = _b === void 0 ? 'auto' : _b, onShow = _a.onShow, onHide = _a.onHide, currentInstance = _a.currentInstance, _c = _a.theme, theme = _c === void 0 ? 'light' : _c;
|
|
172
|
+
var _d = useState(false), isVisible = _d[0], setIsVisible = _d[1];
|
|
173
|
+
var _e = useState({ x: 0, y: 0 }), menuPosition = _e[0], setMenuPosition = _e[1];
|
|
174
|
+
var menuRef = useRef(null);
|
|
175
|
+
var triggerRef = useRef(null);
|
|
176
|
+
var menuClasses = "context-menu ".concat(menuClassName || '', " context-menu-").concat(theme);
|
|
177
|
+
var itemClasses = function (item) {
|
|
178
|
+
return "context-menu-item ".concat(item.disabled ? 'context-menu-item--disabled' : '', " ").concat(item.className || '', " context-menu-item-").concat(theme);
|
|
179
|
+
};
|
|
180
|
+
var handleContextMenu = function (e) {
|
|
181
|
+
var _a, _b;
|
|
182
|
+
e.preventDefault();
|
|
183
|
+
if (disabled)
|
|
184
|
+
return;
|
|
185
|
+
var x = e.clientX;
|
|
186
|
+
var y = e.clientY;
|
|
187
|
+
if (position === 'auto') {
|
|
188
|
+
var viewportWidth = window.innerWidth;
|
|
189
|
+
var viewportHeight = window.innerHeight;
|
|
190
|
+
var menuWidth = ((_a = menuRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 200;
|
|
191
|
+
var menuHeight = ((_b = menuRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 200;
|
|
192
|
+
if (x + menuWidth > viewportWidth) {
|
|
193
|
+
x = viewportWidth - menuWidth - 5;
|
|
194
|
+
}
|
|
195
|
+
if (y + menuHeight > viewportHeight) {
|
|
196
|
+
y = viewportHeight - menuHeight - 5;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
setMenuPosition({ x: x, y: y });
|
|
200
|
+
setIsVisible(true);
|
|
201
|
+
onShow === null || onShow === void 0 ? void 0 : onShow();
|
|
202
|
+
};
|
|
203
|
+
var closeMenu = function () {
|
|
204
|
+
setIsVisible(false);
|
|
205
|
+
onHide === null || onHide === void 0 ? void 0 : onHide();
|
|
206
|
+
};
|
|
207
|
+
var handleClickOutside = function (e) {
|
|
208
|
+
if (menuRef.current &&
|
|
209
|
+
!menuRef.current.contains(e.target) &&
|
|
210
|
+
triggerRef.current &&
|
|
211
|
+
!triggerRef.current.contains(e.target)) {
|
|
212
|
+
closeMenu();
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
var handleKeyDown = function (e) {
|
|
216
|
+
if (e.key === 'Escape') {
|
|
217
|
+
closeMenu();
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
var handleItemClick = function (item) {
|
|
221
|
+
var _a;
|
|
222
|
+
if (item.disabled)
|
|
223
|
+
return;
|
|
224
|
+
(_a = item.onClick) === null || _a === void 0 ? void 0 : _a.call(item, currentInstance !== null && currentInstance !== void 0 ? currentInstance : item);
|
|
225
|
+
closeMenu();
|
|
226
|
+
};
|
|
227
|
+
useEffect(function () {
|
|
228
|
+
if (isVisible) {
|
|
229
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
230
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
234
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
235
|
+
}
|
|
236
|
+
return function () {
|
|
237
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
238
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
239
|
+
};
|
|
240
|
+
}, [isVisible]);
|
|
241
|
+
return (_jsxs("div", { ref: triggerRef, className: "context-menu-trigger ".concat(className || ''), onContextMenu: handleContextMenu, children: [children, isVisible && (_jsx("div", { ref: menuRef, className: menuClasses, style: {
|
|
242
|
+
position: 'fixed',
|
|
243
|
+
left: "".concat(menuPosition.x, "px"),
|
|
244
|
+
top: "".concat(menuPosition.y, "px"),
|
|
245
|
+
zIndex: 9999,
|
|
246
|
+
}, role: "menu", children: _jsx("ul", { className: "context-menu-list context-menu-list-".concat(theme), children: options.map(function (item, index) {
|
|
247
|
+
if (item === 'divider') {
|
|
248
|
+
return (_jsx("li", { className: "context-menu-divider context-menu-divider-".concat(theme) }, "divider-".concat(index.toString())));
|
|
249
|
+
}
|
|
250
|
+
return (_jsxs("li", { className: itemClasses(item), onClick: function () { return handleItemClick(item); }, onKeyDown: function (e) {
|
|
251
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
252
|
+
e.preventDefault();
|
|
253
|
+
handleItemClick(item);
|
|
254
|
+
}
|
|
255
|
+
}, role: "menuitem", tabIndex: item.disabled ? -1 : 0, "aria-disabled": item.disabled, children: [item.icon && _jsx("span", { className: "context-menu-icon context-menu-icon-".concat(theme), children: item.icon }), _jsx("span", { className: "context-menu-text context-menu-text-".concat(theme), children: item.label }), item.shortcut && (_jsx("span", { className: "context-menu-shortcut context-menu-shortcut-".concat(theme), children: item.shortcut }))] }, item.key || index));
|
|
256
|
+
}) }) }))] }));
|
|
257
|
+
};
|
|
@@ -37,4 +37,16 @@ export declare function useLongPress(callback: (event: Event) => void, options?:
|
|
|
37
37
|
onTouchStart: any;
|
|
38
38
|
onTouchEnd: any;
|
|
39
39
|
};
|
|
40
|
+
type UseRecentSearchOptions = {
|
|
41
|
+
key?: string;
|
|
42
|
+
limit?: number;
|
|
43
|
+
uniqueKey?: string;
|
|
44
|
+
excludeEmpty?: boolean;
|
|
45
|
+
};
|
|
46
|
+
export declare const useRecentSearch: (options?: UseRecentSearchOptions) => {
|
|
47
|
+
recentSearches: any;
|
|
48
|
+
addSearch: (item: any) => void;
|
|
49
|
+
clearSearch: () => void;
|
|
50
|
+
hasSearch: (value: string) => any;
|
|
51
|
+
};
|
|
40
52
|
export {};
|
|
@@ -265,3 +265,45 @@ export function useLongPress(callback, options) {
|
|
|
265
265
|
onTouchEnd: cancel,
|
|
266
266
|
}); }, [start, cancel]);
|
|
267
267
|
}
|
|
268
|
+
export var useRecentSearch = function (options) {
|
|
269
|
+
if (options === void 0) { options = {}; }
|
|
270
|
+
var _a = options.key, key = _a === void 0 ? 'recentSearches' : _a, _b = options.limit, limit = _b === void 0 ? 3 : _b, _c = options.uniqueKey, uniqueKey = _c === void 0 ? 'index' : _c, _d = options.excludeEmpty, excludeEmpty = _d === void 0 ? true : _d;
|
|
271
|
+
var _e = useState([]), recentSearches = _e[0], setRecentSearches = _e[1];
|
|
272
|
+
useEffect(function () {
|
|
273
|
+
var saved = localStorage.getItem(key);
|
|
274
|
+
if (saved) {
|
|
275
|
+
try {
|
|
276
|
+
var parsed = JSON.parse(saved);
|
|
277
|
+
if (Array.isArray(parsed)) {
|
|
278
|
+
setRecentSearches(parsed.slice(0, limit));
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
catch (e) {
|
|
282
|
+
console.error('Failed to parse recent searches', e);
|
|
283
|
+
localStorage.removeItem(key);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}, [key, limit]);
|
|
287
|
+
var addSearch = useCallback(function (item) {
|
|
288
|
+
if (excludeEmpty && !item[uniqueKey])
|
|
289
|
+
return;
|
|
290
|
+
try {
|
|
291
|
+
setRecentSearches(function (prev) {
|
|
292
|
+
var updated = __spreadArray([item], prev.filter(function (p) { return p[uniqueKey] !== item[uniqueKey]; }), true).slice(0, limit);
|
|
293
|
+
localStorage.setItem(key, JSON.stringify(updated));
|
|
294
|
+
return updated;
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
catch (error) {
|
|
298
|
+
console.error('Failed to update recent searches:', error);
|
|
299
|
+
}
|
|
300
|
+
}, [excludeEmpty, uniqueKey, key, limit]);
|
|
301
|
+
var hasSearch = function (value) {
|
|
302
|
+
return recentSearches.some(function (item) { var _a; return ((_a = item[uniqueKey]) === null || _a === void 0 ? void 0 : _a.toString().trim()) === value.trim(); });
|
|
303
|
+
};
|
|
304
|
+
var clearSearch = function () {
|
|
305
|
+
localStorage.removeItem(key);
|
|
306
|
+
setRecentSearches([]);
|
|
307
|
+
};
|
|
308
|
+
return { recentSearches: recentSearches, addSearch: addSearch, clearSearch: clearSearch, hasSearch: hasSearch };
|
|
309
|
+
};
|
|
@@ -14,7 +14,7 @@ interface UseAxiosConfig extends AxiosRequestConfig {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
export declare const useAxios: <T>(config?: UseAxiosConfig) => UseAxiosResponse<T>;
|
|
17
|
-
export declare const useDrawer: () => import("../
|
|
17
|
+
export declare const useDrawer: () => import("../chunk1213/chunk158261").DrawerContextValue;
|
|
18
18
|
export declare const useAdvReducer: <State, Action extends {
|
|
19
19
|
type: string;
|
|
20
20
|
}>(initialState: State, actions: Record<string, (state: State, action: Action) => State>) => (state: State | undefined, action: Action) => State;
|
|
@@ -56,7 +56,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
56
56
|
};
|
|
57
57
|
import { useState, useEffect, useCallback, useRef, useContext, createContext, useMemo } from 'react';
|
|
58
58
|
import axios, { AxiosError } from 'axios';
|
|
59
|
-
import DrawerContext from '../
|
|
59
|
+
import DrawerContext from '../chunk1213/chunk158261';
|
|
60
60
|
var isReady = function () {
|
|
61
61
|
return typeof window !== "undefined" && typeof window.document !== "undefined"
|
|
62
62
|
? true
|
|
@@ -64,7 +64,16 @@ export var CardSkeleton = function () {
|
|
|
64
64
|
},
|
|
65
65
|
maxWidth: '600px',
|
|
66
66
|
};
|
|
67
|
-
return (_jsx(Grid, { item: true, xs: 12, sm: 6, md: 6, children: _jsxs(Box, { sx: skeletonStyles, children: [_jsx(Skeleton, { variant: "rectangular", width: "100%", height: 30, sx: {
|
|
67
|
+
return (_jsx(Grid, { item: true, xs: 12, sm: 6, md: 6, children: _jsxs(Box, { sx: skeletonStyles, children: [_jsx(Skeleton, { variant: "rectangular", width: "100%", height: 30, sx: {
|
|
68
|
+
marginBottom: '12px',
|
|
69
|
+
borderRadius: '4px',
|
|
70
|
+
background: 'linear-gradient(to left, #e0e0e0 10%, #cfcfcf 100%)',
|
|
71
|
+
} }), _jsx(Box, { children: Array.from(new Array(4)).map(function (__, index) { return (_jsxs(Box, { sx: {
|
|
72
|
+
display: 'flex',
|
|
73
|
+
justifyContent: 'space-between',
|
|
74
|
+
alignItems: 'center',
|
|
75
|
+
marginBottom: index !== 3 ? 1 : 0,
|
|
76
|
+
}, children: [_jsx(Skeleton, { variant: "text", width: "70%", height: 20 }), _jsx(Skeleton, { variant: "text", width: "20%", height: 20 })] }, index.toString())); }) })] }) }));
|
|
68
77
|
};
|
|
69
78
|
export var PieChartSkeleton = function () {
|
|
70
79
|
return (_jsxs(_Fragment, { children: [_jsx(Grid, { item: true, xs: 12, sm: 6, md: 6, lg: 6, sx: { padding: '10px' }, children: _jsxs(Card, { sx: {
|
|
@@ -74,7 +83,7 @@ export var PieChartSkeleton = function () {
|
|
|
74
83
|
flexDirection: 'column',
|
|
75
84
|
justifyContent: 'space-between',
|
|
76
85
|
cursor: 'default',
|
|
77
|
-
}, children: [_jsx(CardHeader, { title:
|
|
86
|
+
}, children: [_jsx(CardHeader, { title: _jsx(Skeleton, { variant: "rectangular", width: "80%", height: "20px", sx: { margin: '0 auto', borderRadius: '4px' } }), sx: {
|
|
78
87
|
background: '#dbe7f2',
|
|
79
88
|
padding: '8px',
|
|
80
89
|
} }), _jsx(CardContent, { sx: {
|
|
@@ -89,7 +98,7 @@ export var PieChartSkeleton = function () {
|
|
|
89
98
|
flexDirection: 'column',
|
|
90
99
|
justifyContent: 'space-between',
|
|
91
100
|
cursor: 'default',
|
|
92
|
-
}, children: [_jsx(CardHeader, { title:
|
|
101
|
+
}, children: [_jsx(CardHeader, { title: _jsx(Skeleton, { variant: "rectangular", width: "80%", height: "20px", sx: { margin: '0 auto', borderRadius: '4px' } }), sx: {
|
|
93
102
|
background: '#dbe7f2',
|
|
94
103
|
padding: '8px',
|
|
95
104
|
} }), _jsx(CardContent, { sx: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'nprogress/nprogress.css';
|
|
2
|
-
import { ReactHooksWrapper, getHook, setHook } from "./
|
|
3
|
-
import { DynamicLoader, AlertMessage, FilePreview, LabeledValue, DetailsCard, UploadFile, DownloadFile } from './
|
|
4
|
-
import { FileSkeleton, TableSkeleton, PieChartSkeleton, CardSkeleton, LineChartSkeleton, FieldSkeleton } from './
|
|
5
|
-
import { useHistoryState, useIdle, useIsFirstRender, useList, useLockBodyScroll, useLongPress } from './
|
|
6
|
-
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, usePersistedForm, useCrossFieldValidation, useFieldArray, useFormSubmit, useSmartForm, useUndo, useFormWizard, useWebSocket, useDragReorder, useInfiniteScroll, useEventListeners, createOptimizedContext } from './
|
|
2
|
+
import { ReactHooksWrapper, getHook, setHook } from "./chunk1415/chunk143";
|
|
3
|
+
import { DynamicLoader, AlertMessage, FilePreview, LabeledValue, DetailsCard, UploadFile, DownloadFile, ContextMenuWrapper } from './chunk1516/chunk613852';
|
|
4
|
+
import { FileSkeleton, TableSkeleton, PieChartSkeleton, CardSkeleton, LineChartSkeleton, FieldSkeleton } from './chunk1617/chunk613555';
|
|
5
|
+
import { useHistoryState, useIdle, useIsFirstRender, useList, useLockBodyScroll, useLongPress, useRecentSearch } from './chunk1516/chunk726433';
|
|
6
|
+
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, usePersistedForm, useCrossFieldValidation, useFieldArray, useFormSubmit, useSmartForm, useUndo, useFormWizard, useWebSocket, useDragReorder, useInfiniteScroll, useEventListeners, createOptimizedContext } from './chunk1516/chunk940514';
|
|
7
7
|
export default ReactHooksWrapper;
|
|
8
|
-
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, usePersistedForm, useCrossFieldValidation, useFieldArray, useFormSubmit, useSmartForm, useUndo, useFormWizard, useWebSocket, useDragReorder, useInfiniteScroll, useEventListeners, useHistoryState, useIdle, useIsFirstRender, useList, useLockBodyScroll, useLongPress, createOptimizedContext, DynamicLoader, AlertMessage, FilePreview, FileSkeleton, TableSkeleton, PieChartSkeleton, CardSkeleton, LineChartSkeleton, FieldSkeleton, LabeledValue, DetailsCard, UploadFile, DownloadFile };
|
|
8
|
+
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, usePersistedForm, useCrossFieldValidation, useFieldArray, useFormSubmit, useSmartForm, useUndo, useFormWizard, useWebSocket, useDragReorder, useInfiniteScroll, useEventListeners, useHistoryState, useIdle, useIsFirstRender, useList, useLockBodyScroll, useLongPress, useRecentSearch, createOptimizedContext, DynamicLoader, AlertMessage, FilePreview, FileSkeleton, TableSkeleton, PieChartSkeleton, CardSkeleton, LineChartSkeleton, FieldSkeleton, LabeledValue, DetailsCard, UploadFile, DownloadFile, ContextMenuWrapper };
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'nprogress/nprogress.css';
|
|
2
|
-
import { ReactHooksWrapper, getHook, setHook } from "./
|
|
3
|
-
import { DynamicLoader, AlertMessage, FilePreview, LabeledValue, DetailsCard, UploadFile, DownloadFile } from './
|
|
4
|
-
import { FileSkeleton, TableSkeleton, PieChartSkeleton, CardSkeleton, LineChartSkeleton, FieldSkeleton } from './
|
|
5
|
-
import { useHistoryState, useIdle, useIsFirstRender, useList, useLockBodyScroll, useLongPress } from './
|
|
6
|
-
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, usePersistedForm, useCrossFieldValidation, useFieldArray, useFormSubmit, useSmartForm, useUndo, useFormWizard, useWebSocket, useDragReorder, useInfiniteScroll, useEventListeners, createOptimizedContext } from './
|
|
2
|
+
import { ReactHooksWrapper, getHook, setHook } from "./chunk1415/chunk143";
|
|
3
|
+
import { DynamicLoader, AlertMessage, FilePreview, LabeledValue, DetailsCard, UploadFile, DownloadFile, ContextMenuWrapper } from './chunk1516/chunk613852';
|
|
4
|
+
import { FileSkeleton, TableSkeleton, PieChartSkeleton, CardSkeleton, LineChartSkeleton, FieldSkeleton } from './chunk1617/chunk613555';
|
|
5
|
+
import { useHistoryState, useIdle, useIsFirstRender, useList, useLockBodyScroll, useLongPress, useRecentSearch } from './chunk1516/chunk726433';
|
|
6
|
+
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, usePersistedForm, useCrossFieldValidation, useFieldArray, useFormSubmit, useSmartForm, useUndo, useFormWizard, useWebSocket, useDragReorder, useInfiniteScroll, useEventListeners, createOptimizedContext } from './chunk1516/chunk940514';
|
|
7
7
|
export default ReactHooksWrapper;
|
|
8
|
-
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, usePersistedForm, useCrossFieldValidation, useFieldArray, useFormSubmit, useSmartForm, useUndo, useFormWizard, useWebSocket, useDragReorder, useInfiniteScroll, useEventListeners, useHistoryState, useIdle, useIsFirstRender, useList, useLockBodyScroll, useLongPress, createOptimizedContext, DynamicLoader, AlertMessage, FilePreview, FileSkeleton, TableSkeleton, PieChartSkeleton, CardSkeleton, LineChartSkeleton, FieldSkeleton, LabeledValue, DetailsCard, UploadFile, DownloadFile };
|
|
8
|
+
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, usePersistedForm, useCrossFieldValidation, useFieldArray, useFormSubmit, useSmartForm, useUndo, useFormWizard, useWebSocket, useDragReorder, useInfiniteScroll, useEventListeners, useHistoryState, useIdle, useIsFirstRender, useList, useLockBodyScroll, useLongPress, useRecentSearch, createOptimizedContext, DynamicLoader, AlertMessage, FilePreview, FileSkeleton, TableSkeleton, PieChartSkeleton, CardSkeleton, LineChartSkeleton, FieldSkeleton, LabeledValue, DetailsCard, UploadFile, DownloadFile, ContextMenuWrapper };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const promise: (time: number) => Promise<unknown>;
|
|
2
2
|
export declare function throttle<T extends (...args: any[]) => void>(func: T, limit: number): T;
|
|
3
|
+
export declare const debounceUtils: <T extends (...args: any[]) => void>(func: T, delay: number) => (...args: Parameters<T>) => void;
|
package/dist/utils.js
CHANGED
|
@@ -23,3 +23,14 @@ export function throttle(func, limit) {
|
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
+
export var debounceUtils = function (func, delay) {
|
|
27
|
+
var timeoutId;
|
|
28
|
+
return function () {
|
|
29
|
+
var args = [];
|
|
30
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
31
|
+
args[_i] = arguments[_i];
|
|
32
|
+
}
|
|
33
|
+
clearTimeout(timeoutId);
|
|
34
|
+
timeoutId = setTimeout(function () { return func.apply(void 0, args); }, delay);
|
|
35
|
+
};
|
|
36
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-hook-toolkit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
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",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|