react-hook-toolkit 1.2.0 → 1.2.1
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/dist/index.d.ts +565 -15
- package/dist/index.js +204 -17
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +204 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +60 -52
- package/dist/chunk1213/chunk158261.js +0 -41
- package/dist/chunk1213/chunk158862.js +0 -121
- package/dist/chunk1415/chunk143.js +0 -58
- package/dist/chunk1516/chunk0021.js +0 -700
- package/dist/chunk1516/chunk0022.js +0 -381
- package/dist/chunk1516/chunk613852.js +0 -299
- package/dist/chunk1516/chunk726433.js +0 -621
- package/dist/chunk1516/chunk940514.js +0 -817
- package/dist/chunk1617/chunk613555.js +0 -115
- package/dist/chunk1617/chunk613557.js +0 -7
- package/dist/type.js +0 -7
- package/dist/utils.js +0 -104
|
@@ -1,115 +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 { createElement as _createElement } from "react";
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
-
import { Box, Card, CardContent, CardHeader, Grid, IconButton, Skeleton, Table, TableBody, TableCell, TableHead, TableRow, Toolbar, Tooltip, } from "@mui/material";
|
|
15
|
-
import { Download } from "@mui/icons-material";
|
|
16
|
-
export var FileSkeleton = function (_a) {
|
|
17
|
-
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;
|
|
18
|
-
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: {
|
|
19
|
-
maxWidth: width,
|
|
20
|
-
minWidth: width,
|
|
21
|
-
border: "1px solid ".concat(borderColor),
|
|
22
|
-
borderRadius: 1,
|
|
23
|
-
'&:hover': { boxShadow: 2 },
|
|
24
|
-
marginLeft: 3,
|
|
25
|
-
}, children: _jsxs(CardContent, { sx: {
|
|
26
|
-
display: 'flex',
|
|
27
|
-
alignItems: 'center',
|
|
28
|
-
gap: 2,
|
|
29
|
-
padding: '8px !important',
|
|
30
|
-
}, 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())); }) }));
|
|
31
|
-
};
|
|
32
|
-
export var TableSkeleton = function (_a) {
|
|
33
|
-
var _b = _a.rows, rows = _b === void 0 ? 6 : _b, _c = _a.columns, columns = _c === void 0 ? 6 : _c;
|
|
34
|
-
return (_jsxs(Box, { sx: { width: '100%', overflowX: 'auto' }, children: [_jsxs(Toolbar, { sx: {
|
|
35
|
-
display: 'flex',
|
|
36
|
-
justifyContent: 'space-between',
|
|
37
|
-
p: 1,
|
|
38
|
-
borderBottom: '1px solid #dbdbdb',
|
|
39
|
-
}, 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))); }) })] })] }));
|
|
40
|
-
};
|
|
41
|
-
export var LineChartSkeleton = function () {
|
|
42
|
-
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: {
|
|
43
|
-
position: 'absolute',
|
|
44
|
-
left: '20px',
|
|
45
|
-
top: '85%',
|
|
46
|
-
transform: 'rotate(-7deg)',
|
|
47
|
-
transformOrigin: 'left center',
|
|
48
|
-
} })] }));
|
|
49
|
-
};
|
|
50
|
-
export var CardSkeleton = function () {
|
|
51
|
-
var skeletonStyles = {
|
|
52
|
-
boxShadow: '0px 1px 8px -2px #444444de',
|
|
53
|
-
borderRadius: '10px',
|
|
54
|
-
overflow: 'hidden',
|
|
55
|
-
padding: '12px',
|
|
56
|
-
transition: '0.3s',
|
|
57
|
-
background: 'linear-gradient(to top left, #fff 20%, #f5f5f5 80%)',
|
|
58
|
-
width: {
|
|
59
|
-
xs: '90%',
|
|
60
|
-
sm: '70%',
|
|
61
|
-
md: '150%',
|
|
62
|
-
lg: '195%',
|
|
63
|
-
xl: '200%',
|
|
64
|
-
},
|
|
65
|
-
maxWidth: '600px',
|
|
66
|
-
};
|
|
67
|
-
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: {
|
|
68
|
-
marginBottom: '12px',
|
|
69
|
-
borderRadius: '4px',
|
|
70
|
-
background: 'linear-gradient(to left, #e0e0e0 10%, #cfcfcf 100%)',
|
|
71
|
-
} }), _jsx(Box, { children: Array.from(new Array(4)).map(function (__, index) { return (_jsxs(Box, { sx: {
|
|
72
|
-
display: 'flex',
|
|
73
|
-
justifyContent: 'space-between',
|
|
74
|
-
alignItems: 'center',
|
|
75
|
-
marginBottom: index !== 3 ? 1 : 0,
|
|
76
|
-
}, children: [_jsx(Skeleton, { variant: "text", width: "70%", height: 20 }), _jsx(Skeleton, { variant: "text", width: "20%", height: 20 })] }, index.toString())); }) })] }) }));
|
|
77
|
-
};
|
|
78
|
-
export var PieChartSkeleton = function () {
|
|
79
|
-
return (_jsxs(_Fragment, { children: [_jsx(Grid, { item: true, xs: 12, sm: 6, md: 6, lg: 6, sx: { padding: '10px' }, children: _jsxs(Card, { sx: {
|
|
80
|
-
borderRadius: '6px',
|
|
81
|
-
height: '100%',
|
|
82
|
-
display: 'flex',
|
|
83
|
-
flexDirection: 'column',
|
|
84
|
-
justifyContent: 'space-between',
|
|
85
|
-
cursor: 'default',
|
|
86
|
-
}, children: [_jsx(CardHeader, { title: _jsx(Skeleton, { variant: "rectangular", width: "80%", height: "20px", sx: { margin: '0 auto', borderRadius: '4px' } }), sx: {
|
|
87
|
-
background: '#dbe7f2',
|
|
88
|
-
padding: '8px',
|
|
89
|
-
} }), _jsx(CardContent, { sx: {
|
|
90
|
-
display: 'flex',
|
|
91
|
-
justifyContent: 'center',
|
|
92
|
-
alignItems: 'center',
|
|
93
|
-
height: '320px',
|
|
94
|
-
}, 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: {
|
|
95
|
-
borderRadius: '6px',
|
|
96
|
-
height: '100%',
|
|
97
|
-
display: 'flex',
|
|
98
|
-
flexDirection: 'column',
|
|
99
|
-
justifyContent: 'space-between',
|
|
100
|
-
cursor: 'default',
|
|
101
|
-
}, children: [_jsx(CardHeader, { title: _jsx(Skeleton, { variant: "rectangular", width: "80%", height: "20px", sx: { margin: '0 auto', borderRadius: '4px' } }), sx: {
|
|
102
|
-
background: '#dbe7f2',
|
|
103
|
-
padding: '8px',
|
|
104
|
-
} }), _jsx(CardContent, { sx: {
|
|
105
|
-
display: 'flex',
|
|
106
|
-
justifyContent: 'center',
|
|
107
|
-
alignItems: 'center',
|
|
108
|
-
height: '320px',
|
|
109
|
-
}, children: _jsx(Skeleton, { variant: "circular", width: 200, height: 200, sx: { marginBottom: '16px' } }) })] }) })] }));
|
|
110
|
-
};
|
|
111
|
-
export var FieldSkeleton = function (_a) {
|
|
112
|
-
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;
|
|
113
|
-
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() }),
|
|
114
|
-
_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 } })] }))); }) }));
|
|
115
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
export var AnimatedWrapper = function (_a) {
|
|
3
|
-
var _b = _a.animationClass, animationClass = _b === void 0 ? 'animate__bounceIn' : _b, _c = _a.delay, delay = _c === void 0 ? '0' : _c, children = _a.children;
|
|
4
|
-
var delayValue = Number(delay);
|
|
5
|
-
var delayClass = delayValue > 0 ? "animate__delay-".concat(delayValue, "s") : '';
|
|
6
|
-
return (_jsx("div", { className: "animate__animated ".concat(animationClass, " ").concat(delayClass), children: children }));
|
|
7
|
-
};
|
package/dist/type.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export var VoiceStatus;
|
|
2
|
-
(function (VoiceStatus) {
|
|
3
|
-
VoiceStatus[VoiceStatus["init"] = 0] = "init";
|
|
4
|
-
VoiceStatus[VoiceStatus["play"] = 1] = "play";
|
|
5
|
-
VoiceStatus[VoiceStatus["pause"] = 2] = "pause";
|
|
6
|
-
VoiceStatus[VoiceStatus["end"] = 3] = "end";
|
|
7
|
-
})(VoiceStatus || (VoiceStatus = {}));
|
package/dist/utils.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
export var promise = function (time) { return new Promise(function (res) { return setTimeout(res, time); }); };
|
|
2
|
-
export function throttle(func, limit) {
|
|
3
|
-
var lastFunc;
|
|
4
|
-
var lastRan;
|
|
5
|
-
return function () {
|
|
6
|
-
var _this = this;
|
|
7
|
-
var args = [];
|
|
8
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
9
|
-
args[_i] = arguments[_i];
|
|
10
|
-
}
|
|
11
|
-
if (!lastRan) {
|
|
12
|
-
func.apply(this, args);
|
|
13
|
-
lastRan = Date.now();
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
clearTimeout(lastFunc);
|
|
17
|
-
lastFunc = setTimeout(function () {
|
|
18
|
-
if (Date.now() - lastRan >= limit) {
|
|
19
|
-
func.apply(_this, args);
|
|
20
|
-
lastRan = Date.now();
|
|
21
|
-
}
|
|
22
|
-
}, limit - (Date.now() - lastRan));
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export var debounceUtils = function (func, delay) {
|
|
27
|
-
var timeoutId;
|
|
28
|
-
return function () {
|
|
29
|
-
var args = [];
|
|
30
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
31
|
-
args[_i] = arguments[_i];
|
|
32
|
-
}
|
|
33
|
-
clearTimeout(timeoutId);
|
|
34
|
-
timeoutId = setTimeout(function () { return func.apply(void 0, args); }, delay);
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
export var isBrowser = !!(typeof window !== 'undefined' &&
|
|
38
|
-
window.document &&
|
|
39
|
-
window.document.createElement);
|
|
40
|
-
export var isDev = process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test';
|
|
41
|
-
export var isObject = function (value) {
|
|
42
|
-
return value !== null && typeof value === 'object';
|
|
43
|
-
};
|
|
44
|
-
export var isFunction = function (value) {
|
|
45
|
-
return typeof value === 'function';
|
|
46
|
-
};
|
|
47
|
-
export var isString = function (value) { return typeof value === 'string'; };
|
|
48
|
-
export var isBoolean = function (value) { return typeof value === 'boolean'; };
|
|
49
|
-
export var isNumber = function (value) { return typeof value === 'number'; };
|
|
50
|
-
export var isUndef = function (value) { return typeof value === 'undefined'; };
|
|
51
|
-
export var isAppleDevice = /(mac|iphone|ipod|ipad)/i.test(typeof navigator !== 'undefined' ? navigator === null || navigator === void 0 ? void 0 : navigator.platform : '');
|
|
52
|
-
export var isNavigator = typeof navigator !== 'undefined';
|
|
53
|
-
export var getScrollTop = function (el) {
|
|
54
|
-
if (el === document || el === document.documentElement || el === document.body) {
|
|
55
|
-
return Math.max(window.pageYOffset, document.documentElement.scrollTop, document.body.scrollTop);
|
|
56
|
-
}
|
|
57
|
-
return el.scrollTop;
|
|
58
|
-
};
|
|
59
|
-
export var getScrollHeight = function (el) {
|
|
60
|
-
return (el.scrollHeight ||
|
|
61
|
-
Math.max(document.documentElement.scrollHeight, document.body.scrollHeight));
|
|
62
|
-
};
|
|
63
|
-
export var getClientHeight = function (el) {
|
|
64
|
-
return (el.clientHeight ||
|
|
65
|
-
Math.max(document.documentElement.clientHeight, document.body.clientHeight));
|
|
66
|
-
};
|
|
67
|
-
export function sleep(time) {
|
|
68
|
-
return new Promise(function (resolve) {
|
|
69
|
-
setTimeout(function () {
|
|
70
|
-
resolve();
|
|
71
|
-
}, time);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
export function request(req) {
|
|
75
|
-
return new Promise(function (resolve, reject) {
|
|
76
|
-
return setTimeout(function () {
|
|
77
|
-
if (req === 0) {
|
|
78
|
-
reject(new Error('fail'));
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
resolve('success');
|
|
82
|
-
}
|
|
83
|
-
}, 1000);
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
export var noop = function () { };
|
|
87
|
-
export function on(obj) {
|
|
88
|
-
var args = [];
|
|
89
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
90
|
-
args[_i - 1] = arguments[_i];
|
|
91
|
-
}
|
|
92
|
-
if (obj && obj.addEventListener) {
|
|
93
|
-
obj.addEventListener.apply(obj, args);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
export function off(obj) {
|
|
97
|
-
var args = [];
|
|
98
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
99
|
-
args[_i - 1] = arguments[_i];
|
|
100
|
-
}
|
|
101
|
-
if (obj && obj.removeEventListener) {
|
|
102
|
-
obj.removeEventListener.apply(obj, args);
|
|
103
|
-
}
|
|
104
|
-
}
|