react-hook-toolkit 1.0.16 → 1.0.17

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
@@ -15,23 +15,22 @@ yarn add react-hook-toolkit
15
15
  pnpm add react-hook-toolkit
16
16
  ```
17
17
 
18
+ ### **Authors**
19
+
20
+ ![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)
21
+
18
22
  ### **Browser Support**
19
23
 
20
24
  | ![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
25
  | ------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
22
26
  | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |
23
27
 
24
- ### **Authors**
25
28
 
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
-
29
- ## Features
29
+ ### **Features**
30
30
  Here's the properly structured documentation with clear purpose explanations:
31
31
 
32
32
  ------------------------------------------ **Custom Hooks** ------------------------------------------------
33
33
 
34
- ### 🌐 **API / Async**
35
34
 
36
35
  📌 **useAxios**
37
36
  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 +131,6 @@ useTimeout(() => {
132
131
 
133
132
  ---
134
133
 
135
- ### 📝 **Form / Validation**
136
-
137
134
  📌 **useForm**
138
135
  Manages form state, handles input changes, and performs validation using provided validators.
139
136
 
@@ -230,8 +227,6 @@ reset(); // Clears storage
230
227
 
231
228
  ---
232
229
 
233
- ### 🎯 **Event / Interaction**
234
-
235
230
  📌 **useEventListener**
236
231
  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
232
 
@@ -316,9 +311,6 @@ const { items, dragStart, dragOver, drop } = useDragReorder(initialItems);
316
311
 
317
312
  ---
318
313
 
319
- ### 📦 **State / Logic**
320
-
321
-
322
314
  📌 **useToggle**
323
315
  A simple boolean toggle hook that returns a state and a function to toggle its value.
324
316
 
@@ -419,8 +411,6 @@ remove(0); // Remove first item
419
411
 
420
412
  ---
421
413
 
422
- ### 🧭 **Browser / Storage**
423
-
424
414
  📌 **useLocalStorage**
425
415
  A hook to persist state in `localStorage`. It initializes state from `localStorage` and updates it whenever the value changes.
426
416
 
@@ -516,8 +506,6 @@ const { data, setData } = useIndexedDB('dbName');
516
506
  ```
517
507
  ---
518
508
 
519
- ### 🧱 **DOM / UI**
520
-
521
509
  📌 **useMediaQuery**
522
510
  Checks if a media query condition matches the current viewport, useful for responsive design.
523
511
 
@@ -593,8 +581,6 @@ const { isLoading, image } = useImageLoader('imageURL');
593
581
 
594
582
  ---
595
583
 
596
- ### 📱 **Device / Sensors**
597
-
598
584
  📌 **useBattery**
599
585
  Monitors the battery status of the device, including level, charging status, and remaining charging or discharging time.
600
586
 
@@ -626,8 +612,6 @@ const isOnline = useOnlineStatus();
626
612
 
627
613
  ---
628
614
 
629
- ### 🎵 **Media / Audio / Visual**
630
-
631
615
  📌 **useSound**
632
616
  Controls the playback of an audio file, including play, pause, and stop functionalities, while also managing the audio volume and handling any errors.
633
617
 
@@ -671,8 +655,6 @@ const { count, error } = useCountDown(10); // counts down from 10
671
655
 
672
656
  ---
673
657
 
674
- ### 🔄 **Networking / Real-time**
675
-
676
658
  📌 **useWebSocket**
677
659
  Manages WebSocket connections with auto-reconnect.
678
660
 
@@ -786,6 +768,18 @@ A functional React component that displays dynamic alerts using the enqueueSnack
786
768
  ```jsx
787
769
  <AlertMessage type="success" msg="Data saved successfully!" />
788
770
  ```
771
+ ---
772
+ ✅ **FieldSkeleton**
773
+ Simulates form field placeholders with optional label skeletons, useful for loading states in forms or input sections.
774
+
775
+ ```jsx
776
+ <FieldSkeleton
777
+ length={3}
778
+ spacing={2}
779
+ isLabel={true}
780
+ responsive={{ xs: 12, sm: 6, md: 4 }}
781
+ />
782
+ ```
789
783
  ---
790
784
 
791
785
  ✅ **FileSkeleton**
@@ -842,4 +836,4 @@ Displays a skeleton placeholder for a pie chart inside a card layout. Includes a
842
836
 
843
837
  **License**
844
838
 
845
- [MIT](https://www.npmjs.com/products/teams) © (2022-2024)
839
+ [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',
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-hook-toolkit",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
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",