react-hook-toolkit 1.0.1 → 1.0.4

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
@@ -1,125 +1,581 @@
1
+
1
2
  **react-hook-toolkit** package offers a comprehensive set of hooks to simplify React development. It includes hooks for managing state, handling API requests, optimizing performance, and improving user interactions. Key features include data fetching, form handling, local storage management, debouncing/throttling, window size tracking, event listeners, and more. These hooks are designed to enhance productivity by providing reusable, easy-to-use solutions for common tasks.
2
3
 
3
4
  ## Installation
4
5
 
5
- Install the package with npm:
6
+ Install the package:
6
7
 
7
8
  ```bash
8
- npm i react-hook-toolkit
9
+ npm install react-hook-toolkit
10
+ # or
11
+ yarn add react-hook-toolkit
12
+ # or
13
+ pnpm add react-hook-toolkit
9
14
  ```
10
15
 
11
16
  ## Features
17
+ Here's the properly structured documentation with clear purpose explanations:
18
+
19
+ ### **HOOKS** ------------------------------------------------------------------------------------------
20
+ ### 📌 **useAxios**
21
+ 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.
22
+ ```ts
23
+ const { data, loading, error, makeRequest, cancelRequest } = useAxios({ baseURL: '/api' });
24
+
25
+ useEffect(() => {
26
+ makeRequest('/users', 'GET');
27
+ }, []);
28
+ ```
29
+
30
+ ---
31
+
32
+ ### 📌 **useAdvReducer**
33
+ A custom reducer function that takes an `initialState` and an object of actions, returning a new state based on the action type.
34
+
35
+ ```ts
36
+ const reducer = useAdvReducer(initialState, {
37
+ increment: (state) => ({ count: state.count + 1 }),
38
+ });
39
+ const [state, dispatch] = useReducer(reducer, initialState);
40
+ ```
41
+
42
+ ---
43
+
44
+ ### 📌 **useFetch**
45
+ Fetches data from a given URL and manages the loading, error, and data states.
46
+
47
+ ```ts
48
+ const { data, loading, error } = useFetch<User[]>('/api/users');
49
+ ```
50
+
51
+ ---
52
+
53
+ ### 📌 **useLocalStorage**
54
+ A hook to persist state in `localStorage`. It initializes state from `localStorage` and updates it whenever the value changes.
55
+
56
+ ```ts
57
+ const [token, setToken] = useLocalStorage('authToken', '');
58
+ ```
59
+
60
+ ---
61
+
62
+ ### 📌 **useToggle**
63
+ A simple boolean toggle hook that returns a state and a function to toggle its value.
64
+
65
+ ```ts
66
+ const [isOpen, toggle] = useToggle(false);
67
+ ```
68
+
69
+ ---
12
70
 
13
- - **`useAxios`**: 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.
71
+ ### 📌 **useDebounce**
72
+ Delays updating the state until after a specified delay, useful for preventing frequent updates (e.g., handling user input).
14
73
 
15
- - **`useAdvReducer`**: A custom reducer function that takes an `initialState` and an object of actions, returning a new state based on the action type.
74
+ ```ts
75
+ const debouncedSearch = useDebounce(searchText, 500);
76
+ ```
16
77
 
17
- - **`useFetch`**: Fetches data from a given URL and manages the loading, error, and data states.
78
+ ---
18
79
 
19
- - **`useLocalStorage`**: A hook to persist state in `localStorage`. It initializes state from `localStorage` and updates it whenever the value changes.
80
+ ### 📌 **useThrottle**
81
+ Limits how often a value updates within a given time interval, useful for performance optimization.
20
82
 
21
- - **`useToggle`**: A simple boolean toggle hook that returns a state and a function to toggle its value.
83
+ ```ts
84
+ const throttledScroll = useThrottle(scrollValue, 300);
85
+ ```
22
86
 
23
- - **`useDebounce`**: Delays updating the state until after a specified delay, useful for preventing frequent updates (e.g., handling user input).
87
+ ---
24
88
 
25
- - **`useThrottle`**: Limits how often a value updates within a given time interval, useful for performance optimization.
89
+ ### 📌 **usePrevious**
90
+ Returns the previous value of a state or prop.
26
91
 
27
- - **`usePrevious`**: Keeps track of the previous value of a state or prop.
92
+ ```ts
93
+ const prevValue = usePrevious(currentValue);
94
+ ```
28
95
 
29
- - **`useMediaQuery`**: Checks if a media query matches the current viewport size and updates the state accordingly.
96
+ ---
30
97
 
31
- - **`useClipboard`**: Copies text to the clipboard and provides a state to indicate if copying was successful.
98
+ ### 📌 **useMediaQuery**
99
+ Checks if a media query matches the current viewport size and updates the state accordingly.
32
100
 
33
- - **`useInterval`**: Runs a callback function at a specified time interval and clears it when the delay is null or the component unmounts.
101
+ ```ts
102
+ const isMobile = useMediaQuery('(max-width: 768px)');
103
+ ```
34
104
 
35
- - **`useWindowSize`**: Tracks the width and height of the browser window and updates when resized.
105
+ ---
36
106
 
37
- - **`useKeyPress`**: Detects whether a specific key is being pressed or released.
107
+ ### 📌 **useClipboard**
108
+ Copies text to the clipboard and provides a state to indicate if copying was successful.
38
109
 
39
- - **`useOnlineStatus`**: Monitors the user's network connection status (online/offline).
110
+ ```ts
111
+ const [copied, copyToClipboard] = useClipboard();
112
+ copyToClipboard('Text to copy');
113
+ ```
40
114
 
41
- - **`useScrollPosition`**: Tracks the horizontal (x) and vertical (y) scroll positions of the window.
115
+ ---
42
116
 
43
- - **`useTimeout`**: Executes a function after a specified delay and cleans up automatically when dependencies change.
117
+ ### 📌 **useInterval**
118
+ Runs a callback function at a specified time interval and clears it when the delay is null or the component unmounts.
44
119
 
45
- - **`useDarkMode`**: Detects and toggles dark mode based on the user's system preference.
120
+ ```ts
121
+ useInterval(() => {
122
+ console.log('Tick');
123
+ }, 1000);
124
+ ```
46
125
 
47
- - **`useForm`**: Manages form state, handles input changes, and performs validation using provided validators.
126
+ ---
48
127
 
49
- - **`useArray<T>`**: Provides an array state with helper functions to manipulate it, including setting, adding, removing by index, and clearing elements.
128
+ ### 📌 **useWindowSize**
129
+ Tracks the width and height of the browser window and updates when resized.
50
130
 
51
- - **`useStepper`**: Manages step-based navigation by keeping track of the current step index and providing functions to move forward, backward, and reset.
131
+ ```ts
132
+ const { width, height } = useWindowSize();
133
+ ```
52
134
 
53
- - **`useTimeoutFn`**: Executes a callback function after a specified delay and provides functions to reset or clear the timeout.
135
+ ---
54
136
 
55
- - **`useDebouncedCallback`**: Delays the execution of a callback function until after a specified delay, resetting the delay on each call to prevent frequent execution.
137
+ ### 📌 **useKeyPress**
138
+ Detects whether a specific key is being pressed or released.
56
139
 
57
- - **`useScrollLock`**: Locks or unlocks scrolling on the webpage when the `lock` parameter changes.
140
+ ```ts
141
+ const isEnterPressed = useKeyPress('Enter');
142
+ ```
58
143
 
59
- - **`useResizeObserver<T>`**: Observes and returns the dimensions of an HTML element using the `ResizeObserver` API.
144
+ ---
60
145
 
61
- - **`useMousePosition`**: Tracks the user's mouse position in real-time and returns the coordinates.
146
+ ### 📌 **useOnlineStatus**
147
+ Monitors the user's network connection status (online/offline).
62
148
 
63
- - **`useScrollDirection`**: Determines whether the user is scrolling up or down based on window scroll position changes.
149
+ ```ts
150
+ const isOnline = useOnlineStatus();
151
+ ```
64
152
 
65
- - **`useImageLoader`**: Loads an image and provides `loaded` and `error` states to track its loading status.
153
+ ---
66
154
 
67
- - **`usePersistedState<T>`**: Stores and retrieves state from `localStorage` to persist data across page reloads.
155
+ ### 📌 **useScrollPosition**
156
+ Tracks the horizontal (x) and vertical (y) scroll positions of the window.
68
157
 
69
- - **`useReducedMotion`**: Detects if the user has enabled the "Reduce Motion" accessibility setting in their system preferences.
158
+ ```ts
159
+ const { x, y } = useScrollPosition();
160
+ ```
70
161
 
71
- - **`useCookie`**: Manages cookies by providing functions to get, set, and delete a specific cookie by its key.
162
+ ---
72
163
 
73
- - **`useFetchRetry`**: Performs an HTTP request with retry logic, retrying a specified number of times upon failure before returning an error.
164
+ ### 📌 **useTimeout**
165
+ Executes a function after a specified delay and cleans up automatically when dependencies change.
74
166
 
75
- - **`useDelay`**: Delays the update of a value for a specified amount of time before reflecting it in the state.
167
+ ```ts
168
+ useTimeout(() => {
169
+ console.log('Time\'s up!');
170
+ }, 2000);
171
+ ```
76
172
 
77
- - **`useVisibilityChange`**: Tracks the visibility state of the document and returns whether the page is currently visible or hidden.
173
+ ---
78
174
 
79
- - **`useDebouncedValue`**: Debounces a value to avoid immediate changes, returning the delayed value after a specified delay.
175
+ ### 📌 **useDarkMode**
176
+ Detects and toggles dark mode based on the user's system preference.
80
177
 
81
- - **`useAsync`**: Handles the state of an asynchronous function, including loading, success, and error states, with the ability to trigger the execution of the async operation.
178
+ ```ts
179
+ const [isDarkMode, toggleDarkMode] = useDarkMode();
180
+ ```
181
+
182
+ ---
183
+
184
+ ### 📌 **useForm**
185
+ Manages form state, handles input changes, and performs validation using provided validators.
186
+
187
+ ```ts
188
+ const { values, errors, handleChange, validate } = useForm({ name: '', email: '' });
189
+
190
+ handleChange('name', 'John');
82
191
 
83
- - **`useScript`**: Dynamically loads an external script, managing its loading, ready, and error states, and optionally removes the script on unmount.
192
+ validate({
193
+ name: (val) => (!val ? 'Required' : null),
194
+ email: (val) => (!val.includes('@') ? 'Invalid email' : null),
195
+ });
196
+ ```
84
197
 
85
- - **`useReducedMotion`**: Detects if the user has enabled the "Reduce Motion" accessibility setting and returns a boolean indicating whether reduced motion is preferred.
198
+ ---
86
199
 
87
- - **`useIndexedDB`**: Fetches data from an IndexedDB store, handling errors and updating the state with the fetched data.
200
+ ### 📌 **useArray**
201
+ Provides an array state with helper functions to manipulate it, including setting, adding, removing by index, and clearing elements.
88
202
 
89
- - **`useGeoLocation`**: Retrieves the user's current geographic location and returns it along with any error encountered.
203
+ ```ts
204
+ const { array, set, push, removeByIndex, clear } = useArray([1, 2, 3]);
90
205
 
91
- - **`useTimer`**: Starts a countdown timer that updates the time every second, returning the current time and any errors.
206
+ push(4); // [1, 2, 3, 4]
207
+ removeByIndex(1); // ➝ [1, 3, 4]
208
+ clear(); // ➝ []
209
+ ```
92
210
 
93
- - **`useIsMounted`**: Tracks whether the component is mounted or unmounted, returning a boolean value indicating the component's mount status.
211
+ ---
94
212
 
95
- - **`useCss`**: Dynamically applies custom CSS to the document and removes it when the component unmounts, handling any errors during the process.
213
+ ### 📌 **useStepper**
214
+ Manages step-based navigation by keeping track of the current step index and providing functions to move forward, backward, and reset.
96
215
 
97
- - **`useSpeak`**: Converts text to speech using the Web Speech API, allowing the text to be spoken and handling errors.
216
+ ```ts
217
+ const { activeStep, handleNext, handleBack, handleReset, isFirstStep, isLastStep } = useStepper(5);
98
218
 
99
- - **`useCountUp`**: Animates a counter that counts up from 0 to a target value within a specified duration, returning the current count and any errors.
219
+ handleNext(); // advances step
220
+ handleBack(); // ➝ goes back
221
+ handleReset(); // ➝ step 0
222
+ ```
100
223
 
101
- - **`useCountDown`**: Counts down from a specified start value to zero, updating every second and returning the current count and any errors.
224
+ ---
102
225
 
103
- - **`useBattery`**: Monitors the battery status of the device, including level, charging status, and remaining charging or discharging time.
226
+ ### 📌 **useTimeoutFn**
227
+ Executes a callback function after a specified delay and provides functions to reset or clear the timeout.
104
228
 
105
- - **`useEventListener`**: 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.
229
+ ```ts
230
+ const { reset, clear } = useTimeoutFn(() => doSomething(), 1000);
106
231
 
107
- - **`useHistory`**: Provides methods to navigate the browser history, including pushing and replacing history states, as well as moving back and forward in the history stack.
232
+ reset(); // restarts timeout
233
+ clear(); // ➝ clears timeout
234
+ ```
108
235
 
109
- - **`usePreferredLanguage`**: Retrieves the user's preferred language and languages from the browser, and checks if the browser supports the language APIs.
236
+ ---
110
237
 
111
- - **`useSessionStorage`**: Stores and retrieves data from the `sessionStorage` API, persisting the data during the session. It provides a getter and setter for session-based data.
238
+ ### 📌 **useDebouncedCallback**
239
+ Delays the execution of a callback function until after a specified delay, resetting the delay on each call to prevent frequent execution.
112
240
 
113
- - **`useSound`**: Controls the playback of an audio file, including play, pause, and stop functionalities, while also managing the audio volume and handling any errors.
241
+ ```ts
242
+ const debounced = useDebouncedCallback(() => search(input), 300);
114
243
 
115
- - **`useTouch`**: Tracks touch events on a given DOM element, returning the touch positions for `touchstart`, `touchmove`, and `touchend`.
244
+ input.onChange = debounced;
245
+ ```
116
246
 
117
- - **`useUpdateEffect`**: Executes a side effect on updates after the initial render, skipping the effect during the first render to avoid unnecessary executions.
247
+ ---
248
+
249
+ ### 📌 **useScrollLock**
250
+ Locks or unlocks scrolling on the webpage when the `lock` parameter changes.
251
+
252
+ ```ts
253
+ useScrollLock(true); // ➝ disables body scroll
254
+ ```
255
+
256
+ ---
257
+
258
+ ### 📌 **useResizeObserver**
259
+ Observes and returns the dimensions of an HTML element using the `ResizeObserver` API.
260
+
261
+ ```ts
262
+ const size = useResizeObserver(ref);
263
+
264
+ // size = { width: 200, height: 100 }
265
+ ```
266
+
267
+ ---
268
+
269
+ ### 📌 **useMousePosition**
270
+ Tracks the user's mouse position in real-time and returns the coordinates.
271
+
272
+ ```ts
273
+ const { x, y } = useMousePosition();
274
+ ```
275
+
276
+ ---
277
+
278
+ ### 📌 **useScrollDirection**
279
+ Determines whether the user is scrolling up or down based on window scroll position changes.
280
+
281
+ ```ts
282
+ const direction = useScrollDirection(); // ➝ 'up' | 'down'
283
+ ```
284
+
285
+ ---
286
+
287
+ ### 📌 **useImageLoader**
288
+ Loads an image and provides `loaded` and `error` states to track its loading status.
289
+
290
+ ```ts
291
+ const { loaded, error } = useImageLoader('/logo.png');
292
+ ```
293
+
294
+ ---
295
+
296
+ ### 📌 **usePersistedState**
297
+ Stores and retrieves state from `localStorage` to persist data across page reloads.
298
+
299
+ ```ts
300
+ const [theme, setTheme] = usePersistedState('theme', 'light');
301
+ ```
302
+
303
+ ---
304
+
305
+ ### 📌 **useReducedMotion**
306
+ Detects if the user has enabled the "Reduce Motion" accessibility setting in their system preferences.
307
+
308
+ ```ts
309
+ const prefersReduced = useReducedMotion(); // ➝ true | false
310
+ ```
311
+
312
+ ---
313
+
314
+ ### 📌 **useCookie**
315
+ Manages cookies by providing functions to get, set, and delete a specific cookie by its key.
316
+
317
+ ```ts
318
+ const [token, setToken, deleteToken] = useCookie('token');
319
+
320
+ setToken('abc123');
321
+ deleteToken();
322
+ ```
323
+
324
+ ---
325
+
326
+ ### 📌 **useFetchRetry**
327
+ Performs an HTTP request with retry logic, retrying a specified number of times upon failure before returning an error.
328
+
329
+ ```ts
330
+ const { data, loading, error } = useFetchRetry('/api/user', { method: 'GET' }, 3);
331
+ ```
332
+
333
+ ---
334
+
335
+ ### 📌 **useDelay**
336
+ Delays the update of a value for a specified amount of time before reflecting it in the state.
337
+
338
+ ```ts
339
+ const delayedValue = useDelay(value, 500);
340
+ ```
118
341
 
119
- ## Authors
342
+ ---
120
343
 
121
- - **Shivaji** : (Sr. React Developer)
122
- - **Shyamal** : (Sr. React Developer)
344
+ ### 📌 **useVisibilityChange**
345
+ Tracks the visibility state of the document and returns whether the page is currently visible or hidden.
346
+
347
+ ```ts
348
+ const isVisible = useVisibilityChange(); // ➝ true | false
349
+ ```
350
+
351
+ ---
352
+
353
+ ### 📌 **useDebouncedValue**
354
+ Debounces a value to avoid immediate changes, returning the delayed value after a specified delay.
355
+
356
+ ```ts
357
+ const debouncedSearch = useDebouncedValue(input, 300);
358
+ ```
359
+
360
+ ---
361
+
362
+ ### 📌 **useAsync**
363
+ Handles the state of an asynchronous function, including loading, success, and error states, with the ability to trigger the execution of the async operation.
364
+
365
+ ```ts
366
+ const { execute, status, value, error } = useAsync(fetchUser);
367
+
368
+ execute(); // ➝ runs the async function
369
+ ```
370
+
371
+ ---
372
+
373
+ ### 📌 **useScript**
374
+ Dynamically loads an external script, managing its loading, ready, and error states, and optionally removes the script on unmount.
375
+
376
+ ```ts
377
+ const status = useScript('https://js.stripe.com/v3');
378
+
379
+ // status ➝ 'loading' | 'ready' | 'error'
380
+ ```
381
+
382
+ ---
383
+
384
+ ### 📌 **useIndexedDB**
385
+ Fetches data from an IndexedDB store, handling errors and updating the state with the fetched data.
386
+
387
+ ```ts
388
+ const { data, error } = useIndexedDB<MyType>('myDB', 'myStore');
389
+ ```
390
+
391
+ ---
392
+
393
+ ### 📌 **useGeoLocation**
394
+ Retrieves the user's current geographic location and returns it along with any error encountered.
395
+
396
+ ```ts
397
+ const { position, error } = useGeoLocation();
398
+ ```
399
+
400
+ ---
401
+
402
+ ### 📌 **useTimer**
403
+ Starts a countdown timer that updates the time every second, returning the current time and any errors.
404
+
405
+ ```ts
406
+ const { time, error } = useTimer(60); // starts from 60 and counts down
407
+ ```
408
+
409
+ ---
410
+
411
+ ### 📌 **useIsMounted**
412
+ Tracks whether the component is mounted or unmounted, returning a boolean value indicating the component's mount status.
413
+
414
+ ```ts
415
+ const isMounted = useIsMounted();
416
+ ```
417
+
418
+ ---
419
+
420
+ ### 📌 **useCss**
421
+ Dynamically applies custom CSS to the document and removes it when the component unmounts, handling any errors during the process.
422
+
423
+ ```ts
424
+ const { error } = useCss('body { background: #f5f5f5; }');
425
+ ```
426
+
427
+ ---
428
+
429
+ ### 📌 **useSpeak**
430
+ Converts text to speech using the Web Speech API, allowing the text to be spoken and handling errors.
431
+ ```ts
432
+ const { speak, error } = useSpeak('Hello world!');
433
+ speak();
434
+ ```
435
+
436
+ ---
437
+
438
+ ### 📌 **useCountUp**
439
+ Animates a counter that counts up from 0 to a target value within a specified duration, returning the current count and any errors.
440
+
441
+ ```ts
442
+ const { count, error } = useCountUp(100, 5000); // counts up to 100 in 5s
443
+ ```
444
+
445
+ ---
446
+
447
+ ### 📌 **useCountDown**
448
+ Counts down from a specified start value to zero, updating every second and returning the current count and any errors.
449
+
450
+ ```ts
451
+ const { count, error } = useCountDown(10); // counts down from 10
452
+ ```
453
+
454
+ ---
455
+
456
+ ### 📌 **useBattery**
457
+ Monitors the battery status of the device, including level, charging status, and remaining charging or discharging time.
458
+
459
+ ```ts
460
+ const { level, charging, supported, loading, chargingTime, dischargingTime } = useBattery();
461
+ ```
462
+
463
+ ---
464
+
465
+ ### 📌 **useEventListener**
466
+ 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.
467
+
468
+ ```ts
469
+ useEventListener('resize', (e) => {
470
+ console.log('Window resized');
471
+ });
472
+ ```
473
+
474
+ ---
475
+
476
+ ### 📌 **useHistory**
477
+ Provides methods to navigate the browser history, including pushing and replacing history states, as well as moving back and forward in the history stack.
478
+
479
+ ```ts
480
+ const {
481
+ history,
482
+ state,
483
+ push,
484
+ replace,
485
+ goBack,
486
+ goForward
487
+ } = useHistory();
488
+
489
+ push('/about', { from: 'home' });
490
+ replace('/profile');
491
+ goBack();
492
+ goForward();
493
+ ```
494
+
495
+ ---
496
+
497
+ ### 📌 **usePreferredLanguage**
498
+ Retrieves the user's preferred language and languages from the browser, and checks if the browser supports the language APIs.
499
+
500
+ ```ts
501
+ const {
502
+ language,
503
+ languages,
504
+ isSupported
505
+ } = usePreferredLanguage();
506
+
507
+ console.log(language); // e.g., "en-US"
508
+ ```
509
+
510
+ ---
511
+
512
+ ### 📌 **useSessionStorage**
513
+ Stores and retrieves data from the `sessionStorage` API, persisting the data during the session. It provides a getter and setter for session-based data.
514
+
515
+ ```ts
516
+ const [value, setValue] = useSessionStorage("myKey", "default");
517
+
518
+ setValue("newValue");
519
+ console.log(value);
520
+ ```
521
+
522
+ ---
523
+
524
+ ### 📌 **useSound**
525
+ Controls the playback of an audio file, including play, pause, and stop functionalities, while also managing the audio volume and handling any errors.
526
+
527
+ ```ts
528
+ const {
529
+ play,
530
+ pause,
531
+ stop,
532
+ setVolume,
533
+ isPlaying,
534
+ error
535
+ } = useSound("/sound.mp3");
536
+
537
+ play();
538
+ pause();
539
+ stop();
540
+ setVolume(0.5);
541
+ ```
542
+
543
+ ---
544
+
545
+ ### 📌 **useTouch**
546
+ Tracks touch events on a given DOM element, returning the touch positions for `touchstart`, `touchmove`, and `touchend`.
547
+
548
+ ```ts
549
+ const ref = useRef(null);
550
+ const {
551
+ touchStart,
552
+ touchMove,
553
+ touchEnd
554
+ } = useTouch(ref);
555
+
556
+ <div ref={ref}>Swipe here</div>
557
+ ```
558
+
559
+ ---
560
+
561
+ ### 📌 **useUpdateEffect**
562
+ Executes a side effect on updates after the initial render, skipping the effect during the first render to avoid unnecessary executions.
563
+
564
+ ```ts
565
+ useUpdateEffect(() => {
566
+ console.log("This runs only on updates.");
567
+ }, [value]);
568
+ ```
569
+
570
+ ### **COMPONENTS** -------------------------------------------------------------------------------------------
571
+ ### ✅ **DynamicLoader**
572
+ 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.
573
+
574
+ ```ts
575
+ import React, { lazy } from "react";
576
+ const MyComponent = DynamicLoader(lazy(() => import("./MyComponent")));
577
+
578
+ ```
123
579
 
124
580
  ## License
125
581
 
@@ -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,39 +1,9 @@
1
- import { RefObject } from 'react';
2
- export declare function useHover<T extends HTMLElement>(): [RefObject<T>, boolean];
3
- export declare function useOnClickOutside<T extends HTMLElement>(ref: RefObject<T>, handler: (event: MouseEvent | TouchEvent) => void): void;
4
- interface IntersectionObserverArgs {
5
- root?: Element | null;
6
- rootMargin?: string;
7
- threshold?: number | number[];
8
- }
9
- export declare function useIntersectionObserver<T extends HTMLElement>(ref: RefObject<T>, { root, rootMargin, threshold }?: IntersectionObserverArgs): boolean;
10
- export declare function useHoverIntent<T extends HTMLElement>(): [RefObject<T>, boolean];
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;
1
+ import { FC } from 'react';
38
2
  export declare const DynamicLoader: (Component: any) => (props: any) => import("react/jsx-runtime").JSX.Element;
39
- export {};
3
+ interface PropsType {
4
+ type: string;
5
+ msg: string;
6
+ duration?: number;
7
+ }
8
+ declare const AlertMessage: FC<PropsType>;
9
+ export default AlertMessage;
@@ -10,211 +10,13 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { useState, useEffect, useCallback, useRef, useLayoutEffect, Suspense } from 'react';
14
- import { Box, Alert, AlertTitle } from '@mui/material';
13
+ import { useEffect, useCallback, useRef, Suspense } from 'react';
14
+ import { Box, Alert, AlertTitle, IconButton } from '@mui/material';
15
+ import { Close } from '@mui/icons-material';
15
16
  import NProgress from 'nprogress';
16
17
  import { ErrorBoundary } from 'react-error-boundary';
17
18
  import { promise } from '../utils';
18
- export function useHover() {
19
- var _a = useState(false), isHovered = _a[0], setIsHovered = _a[1];
20
- var ref = useRef(null);
21
- useEffect(function () {
22
- var node = ref.current;
23
- if (!node)
24
- return;
25
- var handleMouseOver = function () { return setIsHovered(true); };
26
- var handleMouseOut = function () { return setIsHovered(false); };
27
- node.addEventListener('mouseover', handleMouseOver);
28
- node.addEventListener('mouseout', handleMouseOut);
29
- return function () {
30
- node.removeEventListener('mouseover', handleMouseOver);
31
- node.removeEventListener('mouseout', handleMouseOut);
32
- };
33
- }, []);
34
- return [ref, isHovered];
35
- }
36
- export function useOnClickOutside(ref, handler) {
37
- useEffect(function () {
38
- var listener = function (event) {
39
- if (!ref.current || ref.current.contains(event.target))
40
- return;
41
- handler(event);
42
- };
43
- document.addEventListener('mousedown', listener);
44
- document.addEventListener('touchstart', listener);
45
- return function () {
46
- document.removeEventListener('mousedown', listener);
47
- document.removeEventListener('touchstart', listener);
48
- };
49
- }, [ref, handler]);
50
- }
51
- export function useIntersectionObserver(ref, _a) {
52
- var _b = _a === void 0 ? {} : _a, _c = _b.root, root = _c === void 0 ? null : _c, _d = _b.rootMargin, rootMargin = _d === void 0 ? '0px' : _d, _e = _b.threshold, threshold = _e === void 0 ? 0 : _e;
53
- var _f = useState(false), isIntersecting = _f[0], setIsIntersecting = _f[1];
54
- useEffect(function () {
55
- var observer = new IntersectionObserver(function (_a) {
56
- var entry = _a[0];
57
- return setIsIntersecting(entry.isIntersecting);
58
- }, {
59
- root: root,
60
- rootMargin: rootMargin,
61
- threshold: threshold,
62
- });
63
- var current = ref.current;
64
- if (current)
65
- observer.observe(current);
66
- return function () {
67
- if (current)
68
- observer.unobserve(current);
69
- };
70
- }, [ref, root, rootMargin, threshold]);
71
- return isIntersecting;
72
- }
73
- export function useHoverIntent() {
74
- var _a = useState(false), isHovering = _a[0], setIsHovering = _a[1];
75
- var ref = useRef(null);
76
- useEffect(function () {
77
- var node = ref.current;
78
- if (!node)
79
- return;
80
- var timeout;
81
- var handleMouseEnter = function () {
82
- timeout = setTimeout(function () { return setIsHovering(true); }, 100);
83
- };
84
- var handleMouseLeave = function () {
85
- clearTimeout(timeout);
86
- setIsHovering(false);
87
- };
88
- node.addEventListener('mouseenter', handleMouseEnter);
89
- node.addEventListener('mouseleave', handleMouseLeave);
90
- return function () {
91
- node.removeEventListener('mouseenter', handleMouseEnter);
92
- node.removeEventListener('mouseleave', handleMouseLeave);
93
- };
94
- }, []);
95
- return [ref, isHovering];
96
- }
97
- export var useDragDrop = function (onDrop) {
98
- var _a = useState({
99
- isDragging: false,
100
- isOver: false,
101
- draggedItemId: null,
102
- overDropId: null,
103
- }), state = _a[0], setState = _a[1];
104
- var handleDragStart = useCallback(function (e, dragId) {
105
- e.dataTransfer.setData('text/plain', dragId);
106
- e.dataTransfer.effectAllowed = 'move';
107
- setState({ isDragging: true, isOver: false, draggedItemId: dragId, overDropId: null });
108
- }, []);
109
- var handleDragOver = useCallback(function (e, dropId) {
110
- e.preventDefault();
111
- if (state.overDropId !== dropId) {
112
- setState(function (s) { return (__assign(__assign({}, s), { isOver: true, overDropId: dropId })); });
113
- }
114
- }, [state.overDropId]);
115
- var handleDragEnter = useCallback(function (e, dropId) {
116
- e.preventDefault();
117
- setState(function (s) { return (__assign(__assign({}, s), { isOver: true, overDropId: dropId })); });
118
- }, []);
119
- var handleDragLeave = useCallback(function (e, dropId) {
120
- e.preventDefault();
121
- if (state.overDropId === dropId) {
122
- setState(function (s) { return (__assign(__assign({}, s), { isOver: false, overDropId: null })); });
123
- }
124
- }, [state.overDropId]);
125
- var handleDrop = useCallback(function (e, dropId) {
126
- e.preventDefault();
127
- var dragId = e.dataTransfer.getData('text/plain');
128
- setState({ isDragging: false, isOver: false, draggedItemId: dragId, overDropId: dropId });
129
- onDrop(dragId, dropId);
130
- }, [onDrop]);
131
- return {
132
- state: state,
133
- bindDrag: function (dragId) { return ({
134
- draggable: true,
135
- onDragStart: function (e) { return handleDragStart(e, dragId); },
136
- }); },
137
- bindDrop: function (dropId) { return ({
138
- onDragOver: function (e) { return handleDragOver(e, dropId); },
139
- onDragEnter: function (e) { return handleDragEnter(e, dropId); },
140
- onDragLeave: function (e) { return handleDragLeave(e, dropId); },
141
- onDrop: function (e) { return handleDrop(e, dropId); },
142
- }); },
143
- };
144
- };
145
- export function useFocusTrap(ref) {
146
- useEffect(function () {
147
- var handleFocus = function (event) {
148
- var _a, _b, _c;
149
- if (!((_a = ref.current) === null || _a === void 0 ? void 0 : _a.contains(event.target))) {
150
- var focusableElements = (_b = ref.current) === null || _b === void 0 ? void 0 : _b.querySelectorAll('a, button, input, textarea, select, [tabindex]:not([tabindex="-1"])');
151
- (_c = focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements[0]) === null || _c === void 0 ? void 0 : _c.focus();
152
- event.preventDefault();
153
- }
154
- };
155
- document.addEventListener('focusin', handleFocus);
156
- return function () {
157
- document.removeEventListener('focusin', handleFocus);
158
- };
159
- }, [ref]);
160
- }
161
- export function useFocus() {
162
- var _a = useState(false), isFocused = _a[0], setIsFocused = _a[1];
163
- var ref = useRef(null);
164
- useEffect(function () {
165
- var element = ref.current;
166
- if (!element)
167
- return;
168
- var handleFocus = function () { return setIsFocused(true); };
169
- var handleBlur = function () { return setIsFocused(false); };
170
- element.addEventListener('focus', handleFocus);
171
- element.addEventListener('blur', handleBlur);
172
- return function () {
173
- element.removeEventListener('focus', handleFocus);
174
- element.removeEventListener('blur', handleBlur);
175
- };
176
- }, []);
177
- return [ref, isFocused];
178
- }
179
- export function useElementSize() {
180
- var _a = useState(null), ref = _a[0], setRef = _a[1];
181
- var _b = useState({ width: 0, height: 0 }), size = _b[0], setSize = _b[1];
182
- var handleSize = useCallback(function () {
183
- if (ref) {
184
- setSize({
185
- width: ref.offsetWidth,
186
- height: ref.offsetHeight,
187
- });
188
- }
189
- }, [ref]);
190
- var useEnviromentEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
191
- useEnviromentEffect(function () {
192
- if (!ref)
193
- return;
194
- handleSize();
195
- var resizeObserver = new ResizeObserver(handleSize);
196
- resizeObserver.observe(ref);
197
- return function () { return resizeObserver.disconnect(); };
198
- }, [ref, handleSize]);
199
- return [setRef, size];
200
- }
201
- export function useLockBodyScroll(lock) {
202
- if (lock === void 0) { lock = true; }
203
- useLayoutEffect(function () {
204
- if (typeof document === 'undefined') {
205
- return;
206
- }
207
- var originalStyle = window.getComputedStyle(document.body).overflow;
208
- if (lock) {
209
- document.body.style.overflow = 'hidden';
210
- }
211
- return function () {
212
- if (lock) {
213
- document.body.style.overflow = originalStyle;
214
- }
215
- };
216
- }, [lock]);
217
- }
19
+ import { getHook } from '../hookExecuter/hookExecuter';
218
20
  function Fallback(_a) {
219
21
  var error = _a.error;
220
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] }))] }));
@@ -250,3 +52,23 @@ var LoadingScreen = function () {
250
52
  };
251
53
  // prettier-ignore
252
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,4 +1,6 @@
1
1
  import 'nprogress/nprogress.css';
2
- 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
+ import { ReactHooksWrapper, getHook, setHook } from "./hookExecuter/hookExecuter";
3
3
  import { DynamicLoader } from './hooks/hooksComp';
4
- export { 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 };
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';
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,4 +1,6 @@
1
1
  import 'nprogress/nprogress.css';
2
- 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
+ import { ReactHooksWrapper, getHook, setHook } from "./hookExecuter/hookExecuter";
3
3
  import { DynamicLoader } from './hooks/hooksComp';
4
- export { 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 };
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';
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-hook-toolkit",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
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",
@@ -28,6 +28,7 @@
28
28
  "dependencies": {
29
29
  "@emotion/react": "^11.14.0",
30
30
  "@emotion/styled": "^11.14.0",
31
+ "@mui/icons-material": "^7.0.1",
31
32
  "@mui/material": "^5.14.0",
32
33
  "axios": "^1.7.8",
33
34
  "nprogress": "^0.2.0",