react-hook-toolkit 1.0.7 → 1.0.8
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 +67 -1
- package/dist/hooks/hooksComp.d.ts +11 -1
- package/dist/hooks/hooksComp.js +48 -3
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/skeletons/skeletons.d.ts +19 -0
- package/dist/skeletons/skeletons.js +94 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ pnpm add react-hook-toolkit
|
|
|
24
24
|
## Features
|
|
25
25
|
Here's the properly structured documentation with clear purpose explanations:
|
|
26
26
|
|
|
27
|
-
---------------------------------------------------- **Custom Hooks**
|
|
27
|
+
---------------------------------------------------- **Custom Hooks** --------------------------------------------------
|
|
28
28
|
📌 **useAxios**
|
|
29
29
|
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
30
|
```ts
|
|
@@ -604,6 +604,20 @@ import React, { lazy } from "react";
|
|
|
604
604
|
const MyComponent = DynamicLoader(lazy(() => import("./MyComponent")));
|
|
605
605
|
|
|
606
606
|
```
|
|
607
|
+
---
|
|
608
|
+
|
|
609
|
+
✅ **FilePreview**
|
|
610
|
+
Displays a styled file card with an icon based on file type, filename with ellipsis handling, file size, and an optional download action.
|
|
611
|
+
|
|
612
|
+
```tsx
|
|
613
|
+
<FilePreview
|
|
614
|
+
primaryKey="file123"
|
|
615
|
+
filename="example.pdf"
|
|
616
|
+
size="2.3 MB"
|
|
617
|
+
onDownload={(id) => console.log("Download:", id)}
|
|
618
|
+
/>
|
|
619
|
+
```
|
|
620
|
+
|
|
607
621
|
---
|
|
608
622
|
✅ **AlertMessage**
|
|
609
623
|
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 +627,58 @@ A functional React component that displays dynamic alerts using the enqueueSnack
|
|
|
613
627
|
```
|
|
614
628
|
---
|
|
615
629
|
|
|
630
|
+
### ✅ **FileSkeleton**
|
|
631
|
+
Displays one or more placeholder file cards mimicking the layout of file previews. Useful during file list loading.
|
|
632
|
+
|
|
633
|
+
```tsx
|
|
634
|
+
<FileSkeleton
|
|
635
|
+
length={3}
|
|
636
|
+
width={350}
|
|
637
|
+
borderColor="#dfdfdf"
|
|
638
|
+
/>
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
---
|
|
642
|
+
|
|
643
|
+
### ✅ **TableSkeleton**
|
|
644
|
+
Shows a full table layout with skeleton headers and rows. Includes a toolbar area for filters or search bars.
|
|
645
|
+
|
|
646
|
+
```tsx
|
|
647
|
+
<TableSkeleton
|
|
648
|
+
rows={6}
|
|
649
|
+
columns={6}
|
|
650
|
+
/>
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
---
|
|
654
|
+
|
|
655
|
+
### ✅ **LineChartSkeleton**
|
|
656
|
+
Represents a placeholder for a line chart with gridlines and axis lines to simulate loading of chart data.
|
|
657
|
+
|
|
658
|
+
```tsx
|
|
659
|
+
<LineChartSkeleton />
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
---
|
|
663
|
+
|
|
664
|
+
### ✅ **CardSkeleton**
|
|
665
|
+
Simulates a card layout with a title and multiple row placeholders, ideal for stat or summary cards.
|
|
666
|
+
|
|
667
|
+
```tsx
|
|
668
|
+
<CardSkeleton />
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
---
|
|
672
|
+
|
|
673
|
+
### ✅ **PieChartSkeleton**
|
|
674
|
+
Displays a skeleton placeholder for a pie chart inside a card layout. Includes a title and circular loading element.
|
|
675
|
+
|
|
676
|
+
```tsx
|
|
677
|
+
<PieChartSkeleton />
|
|
678
|
+
```
|
|
679
|
+
|
|
680
|
+
---
|
|
681
|
+
|
|
616
682
|
✏️ **Authors**
|
|
617
683
|
|
|
618
684
|
    
|
|
@@ -6,4 +6,14 @@ interface PropsType {
|
|
|
6
6
|
duration?: number;
|
|
7
7
|
}
|
|
8
8
|
export declare const AlertMessage: FC<PropsType>;
|
|
9
|
-
|
|
9
|
+
interface FileComponentProps {
|
|
10
|
+
primaryKey: string | number;
|
|
11
|
+
filename: string;
|
|
12
|
+
size: string | number;
|
|
13
|
+
onDownload?: any;
|
|
14
|
+
width?: number;
|
|
15
|
+
borderColor?: string;
|
|
16
|
+
fileColor?: 'inherit' | 'primary' | 'secondary' | 'error' | 'disabled' | 'action';
|
|
17
|
+
}
|
|
18
|
+
export declare const FilePreview: ({ primaryKey, filename, size, onDownload, width, borderColor, fileColor, }: FileComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
package/dist/hooks/hooksComp.js
CHANGED
|
@@ -11,8 +11,8 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } 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, } 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';
|
|
@@ -71,4 +71,49 @@ export var AlertMessage = function (_a) {
|
|
|
71
71
|
}
|
|
72
72
|
return null;
|
|
73
73
|
};
|
|
74
|
-
export
|
|
74
|
+
export var FilePreview = function (_a) {
|
|
75
|
+
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;
|
|
76
|
+
// Icon mapping configuration
|
|
77
|
+
var iconMap = {
|
|
78
|
+
pdf: _jsx(InsertDriveFile, { fontSize: "large", color: fileColor }),
|
|
79
|
+
image: _jsx(Image, { fontSize: "large", color: fileColor }),
|
|
80
|
+
doc: _jsx(Description, { fontSize: "large", color: fileColor }),
|
|
81
|
+
default: _jsx(Description, { fontSize: "large", color: fileColor }),
|
|
82
|
+
};
|
|
83
|
+
// Determine file type from filename extension
|
|
84
|
+
var getFileType = function (filenames) {
|
|
85
|
+
var extension = filenames.split('.').pop().toLowerCase();
|
|
86
|
+
if (['pdf'].includes(extension))
|
|
87
|
+
return 'pdf';
|
|
88
|
+
if (['jpg', 'jpeg', 'png', 'gif'].includes(extension))
|
|
89
|
+
return 'image';
|
|
90
|
+
if (['doc', 'docx', 'txt'].includes(extension))
|
|
91
|
+
return 'doc';
|
|
92
|
+
return 'default';
|
|
93
|
+
};
|
|
94
|
+
return (_jsx(Card, { variant: "outlined", sx: {
|
|
95
|
+
maxWidth: width,
|
|
96
|
+
minWidth: width,
|
|
97
|
+
border: "1px solid ".concat(borderColor),
|
|
98
|
+
borderRadius: 1,
|
|
99
|
+
'&:hover': { boxShadow: 2 },
|
|
100
|
+
marginLeft: 1,
|
|
101
|
+
}, children: _jsxs(CardContent, { sx: {
|
|
102
|
+
display: 'flex',
|
|
103
|
+
alignItems: 'center',
|
|
104
|
+
gap: 2,
|
|
105
|
+
padding: '8px !important',
|
|
106
|
+
}, 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: {
|
|
107
|
+
fontSize: '14px',
|
|
108
|
+
whiteSpace: 'nowrap',
|
|
109
|
+
overflow: 'hidden',
|
|
110
|
+
textOverflow: 'ellipsis',
|
|
111
|
+
maxWidth: width - 120,
|
|
112
|
+
}, variant: "body1", fontWeight: "medium", children: filename }) })) : (_jsx(Typography, { sx: {
|
|
113
|
+
fontSize: '14px',
|
|
114
|
+
whiteSpace: 'nowrap',
|
|
115
|
+
overflow: 'hidden',
|
|
116
|
+
textOverflow: 'ellipsis',
|
|
117
|
+
maxWidth: width - 120,
|
|
118
|
+
}, 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" }) })] }) }));
|
|
119
|
+
};
|
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 } 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 };
|
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, } 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 };
|
|
@@ -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.
|
|
3
|
+
"version": "1.0.8",
|
|
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",
|