react-hook-toolkit 1.0.7 → 1.0.9

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
@@ -25,7 +25,8 @@ pnpm add react-hook-toolkit
25
25
  Here's the properly structured documentation with clear purpose explanations:
26
26
 
27
27
  ---------------------------------------------------- **Custom Hooks** ------------------------------------------------
28
- 📌 **useAxios**
28
+
29
+ 📌 **useAxios**
29
30
  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.
30
31
  ```ts
31
32
  const { data, loading, error, makeRequest, cancelRequest } = useAxios({ baseURL: '/api' });
@@ -604,6 +605,47 @@ import React, { lazy } from "react";
604
605
  const MyComponent = DynamicLoader(lazy(() => import("./MyComponent")));
605
606
 
606
607
  ```
608
+ ---
609
+
610
+ ✅ **FilePreview**
611
+ Displays a styled file card with an icon based on file type, filename with ellipsis handling, file size, and an optional download action.
612
+
613
+ ```tsx
614
+ <FilePreview
615
+ primaryKey="file123"
616
+ filename="example.pdf"
617
+ size="2.3 MB"
618
+ onDownload={(id) => console.log("Download:", id)}
619
+ />
620
+ ```
621
+ ---
622
+
623
+ ### ✅ **BindLabel**
624
+ Displays a simple key-value label pair in a single line, with optional styling.
625
+
626
+ ```tsx
627
+ <LabeledValue
628
+ label="Consumer Type"
629
+ value="Residential"
630
+ />
631
+ ```
632
+ ---
633
+
634
+ ### ✅ **DetailsCard**
635
+ Renders a card with a title and grid-based layout of labeled values. It supports custom spacing, responsive behavior, and optional card shadow.
636
+
637
+ ```tsx
638
+ <DetailsCard
639
+ title="Premise Details"
640
+ spacing={2}
641
+ details={[
642
+ { label: 'Consumer Type', value: 'Residential' },
643
+ { label: 'Unit Number', value: '203-B' },
644
+ { label: 'Move in Date', value: '01-Apr-2024' },
645
+ ]}
646
+ />
647
+ ```
648
+
607
649
  ---
608
650
  ✅ **AlertMessage**
609
651
  A functional React component that displays dynamic alerts using the enqueueSnackbar function. It provides a customizable message with a specified type and duration. The alerts can be dismissed manually by clicking a close button, and they support various configurations such as position, auto-hide duration, and duplicate prevention.
@@ -613,6 +655,58 @@ A functional React component that displays dynamic alerts using the enqueueSnack
613
655
  ```
614
656
  ---
615
657
 
658
+ ### ✅ **FileSkeleton**
659
+ Displays one or more placeholder file cards mimicking the layout of file previews. Useful during file list loading.
660
+
661
+ ```tsx
662
+ <FileSkeleton
663
+ length={3}
664
+ width={350}
665
+ borderColor="#dfdfdf"
666
+ />
667
+ ```
668
+
669
+ ---
670
+
671
+ ### ✅ **TableSkeleton**
672
+ Shows a full table layout with skeleton headers and rows. Includes a toolbar area for filters or search bars.
673
+
674
+ ```tsx
675
+ <TableSkeleton
676
+ rows={6}
677
+ columns={6}
678
+ />
679
+ ```
680
+
681
+ ---
682
+
683
+ ### ✅ **LineChartSkeleton**
684
+ Represents a placeholder for a line chart with gridlines and axis lines to simulate loading of chart data.
685
+
686
+ ```tsx
687
+ <LineChartSkeleton />
688
+ ```
689
+
690
+ ---
691
+
692
+ ### ✅ **CardSkeleton**
693
+ Simulates a card layout with a title and multiple row placeholders, ideal for stat or summary cards.
694
+
695
+ ```tsx
696
+ <CardSkeleton />
697
+ ```
698
+
699
+ ---
700
+
701
+ ### ✅ **PieChartSkeleton**
702
+ Displays a skeleton placeholder for a pie chart inside a card layout. Includes a title and circular loading element.
703
+
704
+ ```tsx
705
+ <PieChartSkeleton />
706
+ ```
707
+
708
+ ---
709
+
616
710
  ✏️ **Authors**
617
711
 
618
712
  ![NPM](https://img.shields.io/badge/Author-React%20Expert-red) &nbsp; ![npm](https://img.shields.io/npm/v/react-hook-toolkit?color=1C939D) &nbsp; ![npm](https://img.shields.io/npm/dt/react-hook-toolkit) &nbsp; ![NPM](https://img.shields.io/npm/l/react-hook-toolkit) &nbsp; ![NPM Unpacked Size](https://img.shields.io/npm/unpacked-size/react-hook-toolkit)
@@ -6,4 +6,23 @@ interface PropsType {
6
6
  duration?: number;
7
7
  }
8
8
  export declare const AlertMessage: FC<PropsType>;
9
- export default AlertMessage;
9
+ interface DetailsCardProps {
10
+ title: string;
11
+ details: any;
12
+ spacing?: number;
13
+ boxShadow?: string;
14
+ background?: string;
15
+ }
16
+ export declare const DetailsCard: ({ title, details, spacing, boxShadow, background, }: DetailsCardProps) => import("react/jsx-runtime").JSX.Element;
17
+ export declare const LabeledValue: ({ label, value, style }: any) => import("react/jsx-runtime").JSX.Element;
18
+ interface FileComponentProps {
19
+ primaryKey: string | number;
20
+ filename: string;
21
+ size: string | number;
22
+ onDownload?: any;
23
+ width?: number;
24
+ borderColor?: string;
25
+ fileColor?: 'inherit' | 'primary' | 'secondary' | 'error' | 'disabled' | 'action';
26
+ }
27
+ export declare const FilePreview: ({ primaryKey, filename, size, onDownload, width, borderColor, fileColor, }: FileComponentProps) => import("react/jsx-runtime").JSX.Element;
28
+ export {};
@@ -9,14 +9,15 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
13
  import { useEffect, useCallback, useRef, Suspense } from 'react';
14
- import { Box, Alert, AlertTitle, IconButton } from '@mui/material';
15
- import { Close } from '@mui/icons-material';
14
+ import { Box, Alert, AlertTitle, IconButton, CardContent, Tooltip, Typography, Card, Grid, } from '@mui/material';
15
+ import { Close, InsertDriveFile, Image, Description, Download } from '@mui/icons-material';
16
16
  import NProgress from 'nprogress';
17
17
  import { ErrorBoundary } from 'react-error-boundary';
18
18
  import { promise } from '../utils';
19
19
  import { getHook } from '../hookExecuter/hookExecuter';
20
+ import { useWindowSize } from './hooks';
20
21
  function Fallback(_a) {
21
22
  var error = _a.error;
22
23
  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] }))] }));
@@ -71,4 +72,58 @@ export var AlertMessage = function (_a) {
71
72
  }
72
73
  return null;
73
74
  };
74
- export default AlertMessage;
75
+ export var DetailsCard = function (_a) {
76
+ var title = _a.title, details = _a.details, _b = _a.spacing, spacing = _b === void 0 ? 2 : _b, _c = _a.boxShadow, boxShadow = _c === void 0 ? '0px 0px 2px 2px #d8d8d8' : _c, _d = _a.background, background = _d === void 0 ? '#eee' : _d;
77
+ var width = useWindowSize().width;
78
+ return (_jsx(Card, { sx: { boxShadow: boxShadow }, children: _jsxs(CardContent, { children: [_jsx(Typography, { variant: "h6", sx: { background: background, padding: '4px' }, children: title }), _jsx(Grid, { container: true, spacing: spacing, sx: { mt: 1 }, children: details.filter(Boolean).map(function (item, index) { return (_jsxs(Grid, { item: true, xs: 12, sm: 6, md: 6, lg: width < 1367 ? 6 : 4, children: [_jsxs(Typography, { fontWeight: "bold", component: "span", sx: { fontSize: '14px' }, children: [item === null || item === void 0 ? void 0 : item.label, ": \u00A0"] }), _jsx(Typography, { component: "span", sx: { fontSize: '14px' }, children: (item === null || item === void 0 ? void 0 : item.value) || 'N/A' })] }, index.toString())); }) })] }) }));
79
+ };
80
+ export var LabeledValue = function (_a) {
81
+ var label = _a.label, value = _a.value, _b = _a.style, style = _b === void 0 ? undefined : _b;
82
+ return (_jsx(_Fragment, { children: _jsx(Typography, { sx: style !== null && style !== void 0 ? style : { padding: '5px' }, children: _jsxs("span", { style: { fontSize: '13px' }, children: [_jsxs("b", { children: [label, " "] }), ": ", value !== null && value !== void 0 ? value : 'N/A'] }) }) }));
83
+ };
84
+ export var FilePreview = function (_a) {
85
+ var primaryKey = _a.primaryKey, filename = _a.filename, size = _a.size, _b = _a.onDownload, onDownload = _b === void 0 ? undefined : _b, _c = _a.width, width = _c === void 0 ? 350 : _c, _d = _a.borderColor, borderColor = _d === void 0 ? '#dfdfdf' : _d, _e = _a.fileColor, fileColor = _e === void 0 ? 'primary' : _e;
86
+ // Icon mapping configuration
87
+ var iconMap = {
88
+ pdf: _jsx(InsertDriveFile, { fontSize: "large", color: fileColor }),
89
+ image: _jsx(Image, { fontSize: "large", color: fileColor }),
90
+ doc: _jsx(Description, { fontSize: "large", color: fileColor }),
91
+ default: _jsx(Description, { fontSize: "large", color: fileColor }),
92
+ };
93
+ // Determine file type from filename extension
94
+ var getFileType = function (filenames) {
95
+ var extension = filenames.split('.').pop().toLowerCase();
96
+ if (['pdf'].includes(extension))
97
+ return 'pdf';
98
+ if (['jpg', 'jpeg', 'png', 'gif'].includes(extension))
99
+ return 'image';
100
+ if (['doc', 'docx', 'txt'].includes(extension))
101
+ return 'doc';
102
+ return 'default';
103
+ };
104
+ return (_jsx(Card, { variant: "outlined", sx: {
105
+ maxWidth: width,
106
+ minWidth: width,
107
+ border: "1px solid ".concat(borderColor),
108
+ borderRadius: 1,
109
+ '&:hover': { boxShadow: 2 },
110
+ marginLeft: 1,
111
+ }, children: _jsxs(CardContent, { sx: {
112
+ display: 'flex',
113
+ alignItems: 'center',
114
+ gap: 2,
115
+ padding: '8px !important',
116
+ }, children: [iconMap[getFileType(filename)], _jsxs(Box, { sx: { flexGrow: 1 }, children: [filename.length > 33 ? (_jsx(Tooltip, { title: filename, placement: "top", arrow: true, children: _jsx(Typography, { sx: {
117
+ fontSize: '14px',
118
+ whiteSpace: 'nowrap',
119
+ overflow: 'hidden',
120
+ textOverflow: 'ellipsis',
121
+ maxWidth: width - 120,
122
+ }, variant: "body1", fontWeight: "medium", children: filename }) })) : (_jsx(Typography, { sx: {
123
+ fontSize: '14px',
124
+ whiteSpace: 'nowrap',
125
+ overflow: 'hidden',
126
+ textOverflow: 'ellipsis',
127
+ maxWidth: width - 120,
128
+ }, 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: _jsx(Download, { fontSize: "small", color: "primary" }) })] }) }));
129
+ };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import 'nprogress/nprogress.css';
2
2
  import { ReactHooksWrapper, getHook, setHook } from "./hookExecuter/hookExecuter";
3
- import { DynamicLoader, AlertMessage } from './hooks/hooksComp';
3
+ import { DynamicLoader, AlertMessage, FilePreview, LabeledValue, DetailsCard } from './hooks/hooksComp';
4
+ import { FileSkeleton, TableSkeleton, PieChartSkeleton, CardSkeleton, LineChartSkeleton, FieldSkeleton } from './skeletons/skeletons';
4
5
  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
6
  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, AlertMessage };
7
+ 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, AlertMessage, FilePreview, FileSkeleton, TableSkeleton, PieChartSkeleton, CardSkeleton, LineChartSkeleton, FieldSkeleton, LabeledValue, DetailsCard };
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import 'nprogress/nprogress.css';
2
2
  import { ReactHooksWrapper, getHook, setHook } from "./hookExecuter/hookExecuter";
3
- import { DynamicLoader, AlertMessage } from './hooks/hooksComp';
3
+ import { DynamicLoader, AlertMessage, FilePreview, LabeledValue, DetailsCard } from './hooks/hooksComp';
4
+ import { FileSkeleton, TableSkeleton, PieChartSkeleton, CardSkeleton, LineChartSkeleton, FieldSkeleton } from './skeletons/skeletons';
4
5
  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
6
  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, AlertMessage };
7
+ 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, AlertMessage, FilePreview, FileSkeleton, TableSkeleton, PieChartSkeleton, CardSkeleton, LineChartSkeleton, FieldSkeleton, LabeledValue, DetailsCard };
@@ -0,0 +1,19 @@
1
+ export declare const FileSkeleton: ({ length, width, borderColor }: {
2
+ length?: number | undefined;
3
+ width?: number | undefined;
4
+ borderColor?: string | undefined;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const TableSkeleton: ({ rows, columns }: {
7
+ rows?: number | undefined;
8
+ columns?: number | undefined;
9
+ }) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const LineChartSkeleton: () => import("react/jsx-runtime").JSX.Element;
11
+ export declare const CardSkeleton: () => import("react/jsx-runtime").JSX.Element;
12
+ export declare const PieChartSkeleton: React.FC;
13
+ export declare const FieldSkeleton: ({ length, width, spacing, isLabel, itemsPerRow, }: {
14
+ length?: number | undefined;
15
+ width?: string | undefined;
16
+ spacing?: number | undefined;
17
+ isLabel?: boolean | undefined;
18
+ itemsPerRow?: number | undefined;
19
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,94 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Box, Card, CardContent, CardHeader, Grid, IconButton, Skeleton, Table, TableBody, TableCell, TableHead, TableRow, Toolbar, Tooltip, } from "@mui/material";
3
+ import { Download } from "@mui/icons-material";
4
+ export var FileSkeleton = function (_a) {
5
+ var _b = _a.length, length = _b === void 0 ? 1 : _b, _c = _a.width, width = _c === void 0 ? 350 : _c, _d = _a.borderColor, borderColor = _d === void 0 ? '#dfdfdf' : _d;
6
+ return (_jsx(Grid, { container: true, spacing: 2, children: Array.from({ length: length }).map(function (_, index) { return (_jsx(Grid, { item: true, children: _jsx(Card, { variant: "outlined", sx: {
7
+ maxWidth: width,
8
+ minWidth: width,
9
+ border: "1px solid ".concat(borderColor),
10
+ borderRadius: 1,
11
+ '&:hover': { boxShadow: 2 },
12
+ marginLeft: 3,
13
+ }, children: _jsxs(CardContent, { sx: {
14
+ display: 'flex',
15
+ alignItems: 'center',
16
+ gap: 2,
17
+ padding: '8px !important',
18
+ }, children: [_jsx(Skeleton, { variant: "rectangular", width: 50, height: 40 }), _jsxs(Box, { sx: { flexGrow: 1 }, children: [_jsx(Skeleton, { variant: "text", width: width - 120, height: 20 }), _jsx(Skeleton, { variant: "text", width: 60, height: 14 })] }), _jsx(IconButton, { disabled: true, sx: { color: '#dfdfdf' }, children: _jsx(Download, { fontSize: "small", color: "disabled" }) })] }) }) }, index.toString())); }) }));
19
+ };
20
+ export var TableSkeleton = function (_a) {
21
+ var _b = _a.rows, rows = _b === void 0 ? 6 : _b, _c = _a.columns, columns = _c === void 0 ? 6 : _c;
22
+ return (_jsxs(Box, { sx: { width: '100%', overflowX: 'auto' }, children: [_jsxs(Toolbar, { sx: {
23
+ display: 'flex',
24
+ justifyContent: 'space-between',
25
+ p: 1,
26
+ borderBottom: '1px solid #dbdbdb',
27
+ }, children: [_jsx(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1 }, children: _jsx(Skeleton, { variant: "rectangular", width: 200, height: 40 }) }), _jsx(Box, { children: _jsx(Tooltip, { title: "Filter", children: _jsx(IconButton, { children: _jsx(Skeleton, { variant: "circular", width: 40, height: 40 }) }) }) })] }), _jsxs(Table, { "aria-label": "loading table", children: [_jsx(TableHead, { children: _jsx(TableRow, { children: Array.from({ length: columns }).map(function (_, index) { return (_jsx(TableCell, { children: _jsx(Skeleton, { variant: "rectangular", height: 20 }) }, "head-".concat(index))); }) }) }), _jsx(TableBody, { children: Array.from({ length: rows }).map(function (_, rowIndex) { return (_jsx(TableRow, { children: Array.from({ length: columns }).map(function (_, colIndex) { return (_jsx(TableCell, { children: _jsx(Skeleton, { animation: "wave", variant: "text", width: "100%" }) }, "cell-".concat(rowIndex, "-").concat(colIndex))); }) }, "row-".concat(rowIndex))); }) })] })] }));
28
+ };
29
+ export var LineChartSkeleton = function () {
30
+ return (_jsxs(Box, { sx: { width: '100%', height: '300px', position: 'relative', padding: '16px' }, children: [_jsx(Skeleton, { variant: "text", width: "30%", height: 30, sx: { position: 'absolute', top: 10, left: '50%', transform: 'translateX(-50%)' } }), _jsx(Skeleton, { variant: "rectangular", width: "calc(100% - 40px)", height: 4, sx: { position: 'absolute', bottom: 40, left: 20 } }), _jsx(Skeleton, { variant: "rectangular", width: 2, height: "calc(100% - 40px)", sx: { position: 'absolute', top: 0, bottom: 40, left: 20 } }), _jsx(Skeleton, { variant: "rectangular", width: 2, height: "calc(100% - 40px)", sx: { position: 'absolute', top: 0, bottom: 40, right: 20 } }), [1, 2, 3, 4].map(function (_, index) { return (_jsx(Skeleton, { variant: "rectangular", width: "calc(100% - 40px)", height: 4, sx: { position: 'absolute', bottom: "".concat(40 + index * 50, "px"), left: '20px' } }, index.toString())); }), _jsx(Skeleton, { variant: "rectangular", width: "calc(100% - 40px)", height: 2, sx: {
31
+ position: 'absolute',
32
+ left: '20px',
33
+ top: '85%',
34
+ transform: 'rotate(-7deg)',
35
+ transformOrigin: 'left center',
36
+ } })] }));
37
+ };
38
+ export var CardSkeleton = function () {
39
+ var skeletonStyles = {
40
+ boxShadow: '0px 1px 8px -2px #444444de',
41
+ borderRadius: '10px',
42
+ overflow: 'hidden',
43
+ padding: '12px',
44
+ transition: '0.3s',
45
+ background: 'linear-gradient(to top left, #fff 20%, #f5f5f5 80%)',
46
+ width: {
47
+ xs: '90%',
48
+ sm: '70%',
49
+ md: '150%',
50
+ lg: '195%',
51
+ xl: '200%',
52
+ },
53
+ maxWidth: '600px',
54
+ };
55
+ 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: { marginBottom: '12px', borderRadius: '4px', background: 'linear-gradient(to left, #e0e0e0 10%, #cfcfcf 100%)', } }), _jsx(Box, { children: Array.from(new Array(4)).map(function (__, index) { return (_jsxs(Box, { sx: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: index !== 3 ? 1 : 0, }, children: [_jsx(Skeleton, { variant: "text", width: "70%", height: 20 }), _jsx(Skeleton, { variant: "text", width: "20%", height: 20 })] }, index.toString())); }) })] }) }));
56
+ };
57
+ export var PieChartSkeleton = function () {
58
+ return (_jsxs(_Fragment, { children: [_jsx(Grid, { item: true, xs: 12, sm: 6, md: 6, lg: 6, sx: { padding: '10px' }, children: _jsxs(Card, { sx: {
59
+ borderRadius: '6px',
60
+ height: '100%',
61
+ display: 'flex',
62
+ flexDirection: 'column',
63
+ justifyContent: 'space-between',
64
+ cursor: 'default',
65
+ }, children: [_jsx(CardHeader, { title: (_jsx(Skeleton, { variant: "rectangular", width: "80%", height: "20px", sx: { margin: '0 auto', borderRadius: '4px' } })), sx: {
66
+ background: '#dbe7f2',
67
+ padding: '8px',
68
+ } }), _jsx(CardContent, { sx: {
69
+ display: 'flex',
70
+ justifyContent: 'center',
71
+ alignItems: 'center',
72
+ height: '320px',
73
+ }, children: _jsx(Skeleton, { variant: "circular", width: 200, height: 200, sx: { marginBottom: '16px' } }) })] }) }), _jsx(Grid, { item: true, xs: 12, sm: 6, md: 6, lg: 6, sx: { padding: '10px' }, children: _jsxs(Card, { sx: {
74
+ borderRadius: '6px',
75
+ height: '100%',
76
+ display: 'flex',
77
+ flexDirection: 'column',
78
+ justifyContent: 'space-between',
79
+ cursor: 'default',
80
+ }, children: [_jsx(CardHeader, { title: (_jsx(Skeleton, { variant: "rectangular", width: "80%", height: "20px", sx: { margin: '0 auto', borderRadius: '4px' } })), sx: {
81
+ background: '#dbe7f2',
82
+ padding: '8px',
83
+ } }), _jsx(CardContent, { sx: {
84
+ display: 'flex',
85
+ justifyContent: 'center',
86
+ alignItems: 'center',
87
+ height: '320px',
88
+ }, children: _jsx(Skeleton, { variant: "circular", width: 200, height: 200, sx: { marginBottom: '16px' } }) })] }) })] }));
89
+ };
90
+ 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())); }) }));
94
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-hook-toolkit",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
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",