react-hook-toolkit 1.0.16 → 1.0.18

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 CHANGED
@@ -10,28 +10,25 @@ 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
 
16
+ ### **Authors**
17
+
18
+ ![NPM](https://img.shields.io/badge/Author-React_Developers-red)   ![npm](https://img.shields.io/npm/v/react-hook-toolkit?color=1C939D)   ![npm](https://img.shields.io/npm/dt/react-hook-toolkit)   ![NPM](https://img.shields.io/npm/l/react-hook-toolkit)   ![NPM Unpacked Size](https://img.shields.io/npm/unpacked-size/react-hook-toolkit)
19
+
18
20
  ### **Browser Support**
19
21
 
20
22
  | ![Firefox](https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox_48x48.png) | ![Chrome](https://raw.githubusercontent.com/alrra/browser-logos/main/src/chrome/chrome_48x48.png) | ![Safari](https://raw.githubusercontent.com/alrra/browser-logos/main/src/safari/safari_48x48.png) | ![Opera](https://raw.githubusercontent.com/alrra/browser-logos/main/src/opera/opera_48x48.png) | ![Edge](https://raw.githubusercontent.com/alrra/browser-logos/main/src/edge/edge_48x48.png)
21
23
  | ------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
22
24
  | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
23
25
 
24
- ### **Authors**
25
-
26
- ![NPM](https://img.shields.io/badge/Author-NPM_Teams-red)   ![npm](https://img.shields.io/npm/v/react-hook-toolkit?color=1C939D)   ![npm](https://img.shields.io/npm/dt/react-hook-toolkit)   ![NPM](https://img.shields.io/npm/l/react-hook-toolkit)   ![NPM Unpacked Size](https://img.shields.io/npm/unpacked-size/react-hook-toolkit)
27
-
28
26
 
29
- ## Features
27
+ ### **Features**
30
28
  Here's the properly structured documentation with clear purpose explanations:
31
29
 
32
30
  ------------------------------------------ **Custom Hooks** ------------------------------------------------
33
31
 
34
- ### 🌐 **API / Async**
35
32
 
36
33
  📌 **useAxios**
37
34
  A custom hook for making API requests using Axios. It manages request states (`loading`, `error`, `data`) and provides a function (`makeRequest`) to initiate a request.
@@ -132,8 +129,6 @@ useTimeout(() => {
132
129
 
133
130
  ---
134
131
 
135
- ### 📝 **Form / Validation**
136
-
137
132
  📌 **useForm**
138
133
  Manages form state, handles input changes, and performs validation using provided validators.
139
134
 
@@ -230,8 +225,6 @@ reset(); // Clears storage
230
225
 
231
226
  ---
232
227
 
233
- ### 🎯 **Event / Interaction**
234
-
235
228
  📌 **useEventListener**
236
229
  Listens for a specified event on an element or window, and triggers the handler function when the event is fired. It ensures proper cleanup when the component is unmounted.
237
230
 
@@ -316,9 +309,6 @@ const { items, dragStart, dragOver, drop } = useDragReorder(initialItems);
316
309
 
317
310
  ---
318
311
 
319
- ### 📦 **State / Logic**
320
-
321
-
322
312
  📌 **useToggle**
323
313
  A simple boolean toggle hook that returns a state and a function to toggle its value.
324
314
 
@@ -419,8 +409,6 @@ remove(0); // Remove first item
419
409
 
420
410
  ---
421
411
 
422
- ### 🧭 **Browser / Storage**
423
-
424
412
  📌 **useLocalStorage**
425
413
  A hook to persist state in `localStorage`. It initializes state from `localStorage` and updates it whenever the value changes.
426
414
 
@@ -475,6 +463,19 @@ goBack();
475
463
  goForward();
476
464
  ```
477
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
+ ```
478
479
  ---
479
480
  📌 **useHistoryState**
480
481
  Manages state history with undo/redo capabilities.
@@ -516,8 +517,6 @@ const { data, setData } = useIndexedDB('dbName');
516
517
  ```
517
518
  ---
518
519
 
519
- ### 🧱 **DOM / UI**
520
-
521
520
  📌 **useMediaQuery**
522
521
  Checks if a media query condition matches the current viewport, useful for responsive design.
523
522
 
@@ -593,8 +592,6 @@ const { isLoading, image } = useImageLoader('imageURL');
593
592
 
594
593
  ---
595
594
 
596
- ### 📱 **Device / Sensors**
597
-
598
595
  📌 **useBattery**
599
596
  Monitors the battery status of the device, including level, charging status, and remaining charging or discharging time.
600
597
 
@@ -626,8 +623,6 @@ const isOnline = useOnlineStatus();
626
623
 
627
624
  ---
628
625
 
629
- ### 🎵 **Media / Audio / Visual**
630
-
631
626
  📌 **useSound**
632
627
  Controls the playback of an audio file, including play, pause, and stop functionalities, while also managing the audio volume and handling any errors.
633
628
 
@@ -671,8 +666,6 @@ const { count, error } = useCountDown(10); // counts down from 10
671
666
 
672
667
  ---
673
668
 
674
- ### 🔄 **Networking / Real-time**
675
-
676
669
  📌 **useWebSocket**
677
670
  Manages WebSocket connections with auto-reconnect.
678
671
 
@@ -786,6 +779,18 @@ A functional React component that displays dynamic alerts using the enqueueSnack
786
779
  ```jsx
787
780
  <AlertMessage type="success" msg="Data saved successfully!" />
788
781
  ```
782
+ ---
783
+ ✅ **FieldSkeleton**
784
+ Simulates form field placeholders with optional label skeletons, useful for loading states in forms or input sections.
785
+
786
+ ```jsx
787
+ <FieldSkeleton
788
+ length={3}
789
+ spacing={2}
790
+ isLabel={true}
791
+ responsive={{ xs: 12, sm: 6, md: 4 }}
792
+ />
793
+ ```
789
794
  ---
790
795
 
791
796
  ✅ **FileSkeleton**
@@ -842,4 +847,4 @@ Displays a skeleton placeholder for a pie chart inside a card layout. Includes a
842
847
 
843
848
  **License**
844
849
 
845
- [MIT](https://www.npmjs.com/products/teams) © (2022-2024)
850
+ [MIT](https://docs.npmjs.com/policies/npm-license) © (2022-2024)
@@ -126,7 +126,7 @@ export var FilePreview = function (_a) {
126
126
  overflow: 'hidden',
127
127
  textOverflow: 'ellipsis',
128
128
  maxWidth: width - 120,
129
- }, children: filename })), _jsx(Typography, { variant: "caption", color: "text.secondary", children: size })] }), _jsx(IconButton, { disabled: onDownload === undefined, "aria-label": "download", onClick: function () { return onDownload(primaryKey); }, sx: { color: '#dfdfdf', '&:hover': { color: 'primary.main' } }, children: isDownloading ? (_jsx(CircularProgress, { color: "success", size: 20 })) : (_jsx(Download, { fontSize: "small", color: "primary" })) })] }) }));
129
+ }, children: filename })), _jsx(Typography, { variant: "caption", color: "text.secondary", children: size })] }), _jsx(IconButton, { disabled: onDownload === undefined, "aria-label": "download", onClick: function () { return onDownload(primaryKey); }, sx: { color: '#dfdfdf', '&:hover': { color: 'primary.main' } }, children: isDownloading ? (_jsx(CircularProgress, { color: "success", size: 20 })) : (_jsx(Download, { fontSize: "small", color: onDownload ? 'primary' : 'inherit' })) })] }) }));
130
130
  };
131
131
  var VisuallyHiddenInput = forwardRef(function (props, ref) { return (_jsx("input", __assign({ ref: ref, type: "file", style: {
132
132
  position: 'absolute',
@@ -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
+ };
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import 'nprogress/nprogress.css';
2
2
  import { ReactHooksWrapper, getHook, setHook } from "./hookExecuter/chunk143";
3
3
  import { DynamicLoader, AlertMessage, FilePreview, LabeledValue, DetailsCard, UploadFile, DownloadFile } from './hooks/chunk613852';
4
4
  import { FileSkeleton, TableSkeleton, PieChartSkeleton, CardSkeleton, LineChartSkeleton, FieldSkeleton } from './skeletons/chunk613555';
5
- import { useHistoryState, useIdle, useIsFirstRender, useList, useLockBodyScroll, useLongPress } from './hooks/chunk726433';
5
+ import { useHistoryState, useIdle, useIsFirstRender, useList, useLockBodyScroll, useLongPress, useRecentSearch } from './hooks/chunk726433';
6
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 './hooks/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 };
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import 'nprogress/nprogress.css';
2
2
  import { ReactHooksWrapper, getHook, setHook } from "./hookExecuter/chunk143";
3
3
  import { DynamicLoader, AlertMessage, FilePreview, LabeledValue, DetailsCard, UploadFile, DownloadFile } from './hooks/chunk613852';
4
4
  import { FileSkeleton, TableSkeleton, PieChartSkeleton, CardSkeleton, LineChartSkeleton, FieldSkeleton } from './skeletons/chunk613555';
5
- import { useHistoryState, useIdle, useIsFirstRender, useList, useLockBodyScroll, useLongPress } from './hooks/chunk726433';
5
+ import { useHistoryState, useIdle, useIsFirstRender, useList, useLockBodyScroll, useLongPress, useRecentSearch } from './hooks/chunk726433';
6
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 './hooks/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 };
@@ -10,10 +10,14 @@ export declare const TableSkeleton: ({ rows, columns }: {
10
10
  export declare const LineChartSkeleton: () => import("react/jsx-runtime").JSX.Element;
11
11
  export declare const CardSkeleton: () => import("react/jsx-runtime").JSX.Element;
12
12
  export declare const PieChartSkeleton: React.FC;
13
- export declare const FieldSkeleton: ({ length, width, spacing, isLabel, itemsPerRow, }: {
13
+ export declare const FieldSkeleton: ({ length, width, spacing, isLabel, responsive, }: {
14
14
  length?: number | undefined;
15
15
  width?: string | undefined;
16
16
  spacing?: number | undefined;
17
17
  isLabel?: boolean | undefined;
18
- itemsPerRow?: number | undefined;
18
+ responsive?: {
19
+ xs: number;
20
+ sm: number;
21
+ md: number;
22
+ } | undefined;
19
23
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,15 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { createElement as _createElement } from "react";
1
13
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
14
  import { Box, Card, CardContent, CardHeader, Grid, IconButton, Skeleton, Table, TableBody, TableCell, TableHead, TableRow, Toolbar, Tooltip, } from "@mui/material";
3
15
  import { Download } from "@mui/icons-material";
@@ -88,7 +100,7 @@ export var PieChartSkeleton = function () {
88
100
  }, children: _jsx(Skeleton, { variant: "circular", width: 200, height: 200, sx: { marginBottom: '16px' } }) })] }) })] }));
89
101
  };
90
102
  export var FieldSkeleton = function (_a) {
91
- var _b = _a.length, length = _b === void 0 ? 1 : _b, _c = _a.width, width = _c === void 0 ? '100%' : _c, _d = _a.spacing, spacing = _d === void 0 ? 2 : _d, _e = _a.isLabel, isLabel = _e === void 0 ? false : _e, _f = _a.itemsPerRow, itemsPerRow = _f === void 0 ? 2 : _f;
92
- var columnSize = Math.floor(12 / itemsPerRow);
93
- return (_jsx(Grid, { container: true, spacing: spacing, children: Array.from({ length: length }).map(function (_, index) { return (_jsx(Grid, { item: true, xs: 12, sm: columnSize, children: _jsxs(Box, { sx: { width: '100%', margin: 2 }, children: [isLabel && _jsx(Skeleton, { variant: "text", width: "40%", height: 20, sx: { marginBottom: 1 } }), _jsx(Skeleton, { variant: "rectangular", width: width, height: 40, sx: { borderRadius: 1 } })] }) }, index.toString())); }) }));
103
+ var _b = _a.length, length = _b === void 0 ? 1 : _b, _c = _a.width, width = _c === void 0 ? '100%' : _c, _d = _a.spacing, spacing = _d === void 0 ? 2 : _d, _e = _a.isLabel, isLabel = _e === void 0 ? false : _e, _f = _a.responsive, responsive = _f === void 0 ? { xs: 12, sm: 6, md: 4 } : _f;
104
+ return (_jsx(Grid, { container: true, spacing: spacing, children: Array.from({ length: length }).map(function (_, index) { return (_createElement(Grid, __assign({ item: true }, responsive, { key: index.toString() }),
105
+ _jsxs(Box, { sx: { width: '100%', margin: 2 }, children: [isLabel && _jsx(Skeleton, { variant: "text", width: "40%", height: 20, sx: { marginBottom: 1 } }), _jsx(Skeleton, { variant: "rectangular", width: width, height: 40, sx: { borderRadius: 1 } })] }))); }) }));
94
106
  };
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.16",
3
+ "version": "1.0.18",
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",