react-hook-toolkit 1.0.14 → 1.0.15

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.
@@ -1,55 +0,0 @@
1
- import React, { FC } from 'react';
2
- export declare const DynamicLoader: (Component: any) => (props: any) => import("react/jsx-runtime").JSX.Element;
3
- interface PropsType {
4
- type: string;
5
- msg: string;
6
- duration?: number;
7
- }
8
- export declare const AlertMessage: FC<PropsType>;
9
- interface DetailsCardProps {
10
- isLoading?: boolean;
11
- title: string;
12
- details: any[];
13
- spacing?: number;
14
- boxShadow?: string;
15
- background?: string;
16
- loaderType?: 'skeleton' | 'circular';
17
- displayType?: 'flex' | 'block';
18
- }
19
- export declare const DetailsCard: ({ isLoading, title, details, spacing, boxShadow, background, loaderType, displayType, }: DetailsCardProps) => import("react/jsx-runtime").JSX.Element;
20
- export declare const LabeledValue: ({ label, value, style }: any) => import("react/jsx-runtime").JSX.Element;
21
- interface FileComponentProps {
22
- primaryKey: string | number;
23
- filename: string;
24
- size: string | number;
25
- onDownload?: any;
26
- width?: number;
27
- borderColor?: string;
28
- fileColor?: 'inherit' | 'primary' | 'secondary' | 'error' | 'disabled' | 'action';
29
- isDownloading: boolean;
30
- }
31
- export declare const FilePreview: ({ primaryKey, filename, size, onDownload, width, borderColor, fileColor, isDownloading, }: FileComponentProps) => import("react/jsx-runtime").JSX.Element;
32
- interface UploadButtonProps {
33
- isUpload?: boolean;
34
- color?: 'inherit' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning';
35
- state?: {
36
- isUploaded?: boolean;
37
- isUploadError?: boolean;
38
- isLoadingUpload?: boolean;
39
- };
40
- onFileSelect: (file: File) => void;
41
- }
42
- export declare const UploadFile: React.FC<UploadButtonProps>;
43
- interface DownloadButtonState {
44
- isDownloaded?: boolean;
45
- isDownloadError?: boolean;
46
- isLoadingDownload?: boolean;
47
- }
48
- interface DownloadFileProps {
49
- isDownload?: boolean;
50
- color?: 'inherit' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning';
51
- state?: DownloadButtonState;
52
- onDownload: () => void;
53
- }
54
- export declare const DownloadFile: React.FC<DownloadFileProps>;
55
- export {};
@@ -1,168 +0,0 @@
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 { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
- import { forwardRef } from 'react';
14
- import { useEffect, useCallback, useRef, Suspense } from 'react';
15
- import { Box, Alert, AlertTitle, IconButton, CardContent, Tooltip, Typography, Card, Grid, Skeleton, CircularProgress, } from '@mui/material';
16
- import { Close, InsertDriveFile, Image, Description, Download, CheckCircleOutlined, ErrorOutlineOutlined, Upload, } from '@mui/icons-material';
17
- import NProgress from 'nprogress';
18
- import { ErrorBoundary } from 'react-error-boundary';
19
- import { promise } from '../utils';
20
- import { getHook } from '../hookExecuter/hookExecuter';
21
- import { useWindowSize } from './hooks';
22
- function Fallback(_a) {
23
- var error = _a.error;
24
- 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] }))] }));
25
- }
26
- var Error = function (_a) {
27
- var children = _a.children;
28
- var firstRender = useRef(false);
29
- var handleReload = useCallback(function () {
30
- if (!firstRender.current) {
31
- firstRender.current = true; // Ensure this runs only once
32
- promise(1500).then(function () {
33
- window.location.reload();
34
- });
35
- }
36
- }, []);
37
- return (_jsx(ErrorBoundary, { FallbackComponent: Fallback, onError: function () {
38
- if (process.env.NODE_ENV === 'production') {
39
- handleReload();
40
- }
41
- }, children: children }));
42
- };
43
- var LoadingScreen = function () {
44
- useEffect(function () {
45
- NProgress.start();
46
- return function () {
47
- NProgress.done();
48
- };
49
- }, []);
50
- return (_jsx(Box, { sx: {
51
- backgroundColor: 'background.paper',
52
- minHeight: '100%',
53
- } }));
54
- };
55
- // prettier-ignore
56
- export var DynamicLoader = function (Component) { return function (props) { return (_jsx(Error, { children: _jsx(Suspense, { fallback: _jsx(LoadingScreen, {}), children: _jsx(Component, __assign({}, props)) }) })); }; };
57
- export var AlertMessage = function (_a) {
58
- var type = _a.type, msg = _a.msg, duration = _a.duration;
59
- var _b = getHook('snackBar'), enqueueSnackbar = _b.enqueueSnackbar, closeSnackbar = _b.closeSnackbar;
60
- if (msg !== undefined && msg !== '') {
61
- enqueueSnackbar(msg !== null && msg !== void 0 ? msg : '', {
62
- anchorOrigin: {
63
- // @shivaji perpose dyanamic global alert.
64
- horizontal: 'right',
65
- vertical: 'top',
66
- },
67
- variant: type,
68
- preventDuplicate: true,
69
- // persist: true, whenever you want to close.
70
- action: function (key) { return (_jsx(IconButton, { "aria-label": "close", size: "small", onClick: function () { return closeSnackbar(key); }, children: _jsx(Close, { fontSize: "small", sx: { color: '#fff' } }) })); },
71
- autoHideDuration: duration !== null && duration !== void 0 ? duration : 6000,
72
- });
73
- }
74
- return null;
75
- };
76
- export var DetailsCard = function (_a) {
77
- var _b = _a.isLoading, isLoading = _b === void 0 ? false : _b, title = _a.title, details = _a.details, _c = _a.spacing, spacing = _c === void 0 ? 2 : _c, _d = _a.boxShadow, boxShadow = _d === void 0 ? '0px 0px 2px 2px #d8d8d8' : _d, _e = _a.background, background = _e === void 0 ? '#eee' : _e, _f = _a.loaderType, loaderType = _f === void 0 ? 'skeleton' : _f, _g = _a.displayType, displayType = _g === void 0 ? 'flex' : _g;
78
- var width = useWindowSize().width;
79
- 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 (_jsx(Grid, { item: true, xs: 12, sm: 6, md: 6, lg: width < 1367 ? 6 : 4, children: _jsxs(Box, { display: displayType, alignItems: "center", sx: { fontSize: '14px' }, children: [_jsxs(Typography, { fontWeight: "bold", component: "span", sx: { fontSize: '14px' }, children: [item === null || item === void 0 ? void 0 : item.label, ":\u00A0"] }), isLoading ? (loaderType === 'skeleton' ? (_jsx(Skeleton, { sx: { ml: 2 }, variant: "text", width: 100, height: 20 })) : (_jsx(CircularProgress, { sx: { ml: 2 }, color: "success", size: 18 }))) : (_jsx(Typography, { component: "span", sx: { fontSize: '14px' }, children: (item === null || item === void 0 ? void 0 : item.value) !== undefined && (item === null || item === void 0 ? void 0 : item.value) !== null && (item === null || item === void 0 ? void 0 : item.value) !== '' ? item.value : 'N/A' }))] }) }, index.toString())); }) })] }) }));
80
- };
81
- export var LabeledValue = function (_a) {
82
- var label = _a.label, value = _a.value, _b = _a.style, style = _b === void 0 ? undefined : _b;
83
- 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'] }) }) }));
84
- };
85
- export var FilePreview = function (_a) {
86
- 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, _f = _a.isDownloading, isDownloading = _f === void 0 ? false : _f;
87
- // Icon mapping configuration
88
- var iconMap = {
89
- pdf: _jsx(InsertDriveFile, { fontSize: "large", color: fileColor }),
90
- image: _jsx(Image, { fontSize: "large", color: fileColor }),
91
- doc: _jsx(Description, { fontSize: "large", color: fileColor }),
92
- default: _jsx(Description, { fontSize: "large", color: fileColor }),
93
- };
94
- // Determine file type from filename extension
95
- var getFileType = function (filenames) {
96
- var extension = filenames.split('.').pop().toLowerCase();
97
- if (['pdf'].includes(extension))
98
- return 'pdf';
99
- if (['jpg', 'jpeg', 'png', 'gif'].includes(extension))
100
- return 'image';
101
- if (['doc', 'docx', 'txt'].includes(extension))
102
- return 'doc';
103
- return 'default';
104
- };
105
- return (_jsx(Card, { variant: "outlined", sx: {
106
- maxWidth: width,
107
- minWidth: width,
108
- border: "1px solid ".concat(borderColor),
109
- borderRadius: 1,
110
- '&:hover': { boxShadow: 2 },
111
- marginLeft: 1,
112
- }, children: _jsxs(CardContent, { sx: {
113
- display: 'flex',
114
- alignItems: 'center',
115
- gap: 2,
116
- padding: '8px !important',
117
- }, 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: {
118
- fontSize: '14px',
119
- whiteSpace: 'nowrap',
120
- overflow: 'hidden',
121
- textOverflow: 'ellipsis',
122
- maxWidth: width - 120,
123
- }, children: filename }) })) : (_jsx(Typography, { sx: {
124
- fontSize: '14px',
125
- whiteSpace: 'nowrap',
126
- overflow: 'hidden',
127
- textOverflow: 'ellipsis',
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" })) })] }) }));
130
- };
131
- var VisuallyHiddenInput = forwardRef(function (props, ref) { return (_jsx("input", __assign({ ref: ref, type: "file", style: {
132
- position: 'absolute',
133
- width: 1,
134
- height: 1,
135
- padding: 0,
136
- overflow: 'hidden',
137
- clip: 'rect(0,0,0,0)',
138
- whiteSpace: 'nowrap',
139
- border: 0,
140
- } }, props))); });
141
- export var UploadFile = function (_a) {
142
- var _b = _a.isUpload, isUpload = _b === void 0 ? true : _b, color = _a.color, _c = _a.state, state = _c === void 0 ? {} : _c, onFileSelect = _a.onFileSelect;
143
- var onFileInputChange = function (e) {
144
- var _a;
145
- var file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
146
- if (file) {
147
- onFileSelect(file);
148
- e.target.value = '';
149
- }
150
- };
151
- return (_jsx(Tooltip, { title: "Upload", children: _jsxs(Box, { sx: { position: 'relative', display: 'inline-block' }, children: [_jsxs(IconButton, { disabled: !isUpload, component: "label", children: [(state === null || state === void 0 ? void 0 : state.isUploaded) ? (_jsx(CheckCircleOutlined, { color: "success" })) : (state === null || state === void 0 ? void 0 : state.isUploadError) ? (_jsx(ErrorOutlineOutlined, { color: "error" })) : (_jsx(Upload, { color: color !== null && color !== void 0 ? color : 'primary' })), _jsx(VisuallyHiddenInput, { onChange: onFileInputChange })] }), (state === null || state === void 0 ? void 0 : state.isLoadingUpload) && (_jsx(CircularProgress, { size: "40px", sx: {
152
- position: 'absolute',
153
- top: 0,
154
- left: 0,
155
- zIndex: 1,
156
- } }))] }) }));
157
- };
158
- export var DownloadFile = function (_a) {
159
- var _b = _a.isDownload, isDownload = _b === void 0 ? true : _b, color = _a.color, _c = _a.state, state = _c === void 0 ? {} : _c, onDownload = _a.onDownload;
160
- return (_jsx(Tooltip, { title: "Download", children: _jsxs(Box, { sx: { position: 'relative', display: 'inline-block' }, children: [_jsx(IconButton, { disabled: !isDownload || (state === null || state === void 0 ? void 0 : state.isLoadingDownload), onClick: onDownload, sx: {
161
- bgcolor: function (theme) { return (color ? (theme.palette.mode === 'dark' ? '#303041' : color) : 'default'); },
162
- }, children: (state === null || state === void 0 ? void 0 : state.isDownloaded) ? (_jsx(CheckCircleOutlined, { color: "success" })) : (state === null || state === void 0 ? void 0 : state.isDownloadError) ? (_jsx(ErrorOutlineOutlined, { color: "error" })) : (_jsx(Download, { color: color !== null && color !== void 0 ? color : 'primary' })) }), (state === null || state === void 0 ? void 0 : state.isLoadingDownload) && (_jsx(CircularProgress, { size: "40px", sx: {
163
- position: 'absolute',
164
- top: 0,
165
- left: 0,
166
- zIndex: 1,
167
- } }))] }) }));
168
- };
@@ -1,19 +0,0 @@
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;
@@ -1,94 +0,0 @@
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
- };