funuicss 2.5.0 → 2.5.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/css/fun.css +3 -9
- package/index.d.ts +35 -0
- package/index.js +76 -0
- package/index.tsx +35 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/ui/alert/Alert.d.ts +5 -3
- package/ui/alert/Alert.js +27 -23
- package/ui/alert/Alert.tsx +71 -86
- package/ui/modal/Modal.d.ts +8 -2
- package/ui/modal/Modal.js +33 -21
- package/ui/modal/Modal.tsx +99 -52
- package/ui/page/NotFound.js +5 -5
- package/ui/page/NotFound.tsx +6 -7
- package/ui/page/UnAuthorized.js +4 -2
- package/ui/page/UnAuthorized.tsx +7 -5
- package/ui/snackbar/SnackBar.d.ts +4 -1
- package/ui/snackbar/SnackBar.js +16 -14
- package/ui/snackbar/SnackBar.tsx +41 -25
- package/ui/specials/Circle.js +1 -1
- package/ui/specials/Circle.tsx +1 -1
package/ui/snackbar/SnackBar.tsx
CHANGED
|
@@ -1,40 +1,56 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
|
|
3
4
|
interface SnackbarProps {
|
|
4
5
|
message: string;
|
|
5
|
-
close
|
|
6
|
+
close?: React.ReactNode;
|
|
6
7
|
open: boolean;
|
|
8
|
+
setOpen: (val: boolean) => void;
|
|
7
9
|
position: string;
|
|
8
10
|
funcss?: string;
|
|
9
11
|
animation?: string;
|
|
10
|
-
duration?: number;
|
|
11
|
-
|
|
12
|
+
duration?: number; // animation duration (in seconds)
|
|
13
|
+
autoHide?: boolean; // 👈 NEW
|
|
14
|
+
autoHideDuration?: number; // 👈 NEW in milliseconds
|
|
15
|
+
flat?: boolean;
|
|
12
16
|
}
|
|
13
17
|
|
|
14
|
-
const SnackBar: React.FC<SnackbarProps> = ({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
const SnackBar: React.FC<SnackbarProps> = ({
|
|
19
|
+
message,
|
|
20
|
+
close,
|
|
21
|
+
open,
|
|
22
|
+
setOpen,
|
|
23
|
+
position,
|
|
24
|
+
funcss,
|
|
25
|
+
animation,
|
|
26
|
+
duration = 0.3,
|
|
27
|
+
autoHide = false,
|
|
28
|
+
autoHideDuration = 3000,
|
|
29
|
+
flat,
|
|
30
|
+
}) => {
|
|
31
|
+
React.useEffect(() => {
|
|
32
|
+
if (open && autoHide) {
|
|
33
|
+
const timer = setTimeout(() => {
|
|
34
|
+
setOpen(false);
|
|
35
|
+
}, autoHideDuration);
|
|
36
|
+
return () => clearTimeout(timer);
|
|
37
|
+
}
|
|
38
|
+
}, [open, autoHide, autoHideDuration, setOpen]);
|
|
39
|
+
|
|
40
|
+
if (!open) return null;
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div className={`snackbar ${position} ${funcss || ''} ${flat ? 'flat' : ''}`} style={{ animation: `${duration}s ${animation || 'SlideUp'}` }}>
|
|
44
|
+
<div className="snackbar-content">
|
|
45
|
+
<div className="snackbar-body">{message}</div>
|
|
46
|
+
{close && (
|
|
47
|
+
<div className="close-snackbar pointer" onClick={() =>setOpen ? setOpen(false) : null}>
|
|
48
|
+
{close}
|
|
31
49
|
</div>
|
|
32
|
-
|
|
50
|
+
)}
|
|
33
51
|
</div>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return <div></div>;
|
|
37
|
-
}
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
38
54
|
};
|
|
39
55
|
|
|
40
56
|
export default SnackBar;
|
package/ui/specials/Circle.js
CHANGED
|
@@ -48,7 +48,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
48
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
49
|
var React = __importStar(require("react"));
|
|
50
50
|
function Circle(_a) {
|
|
51
|
-
var
|
|
51
|
+
var _b = _a.size, size = _b === void 0 ? 2 : _b, funcss = _a.funcss, bg = _a.bg, color = _a.color, children = _a.children, hoverable = _a.hoverable, raised = _a.raised, key = _a.key, onClick = _a.onClick, rest = __rest(_a, ["size", "funcss", "bg", "color", "children", "hoverable", "raised", "key", "onClick"]);
|
|
52
52
|
return (React.createElement("div", __assign({ className: "pointer avatar ".concat(funcss || '', " ").concat("text-" + (color === null || color === void 0 ? void 0 : color.trim()) || '', " ").concat(raised ? "raised" : '', " ").concat(bg || '', " ").concat(hoverable ? 'hoverable' : ''), style: {
|
|
53
53
|
width: "".concat(size + "rem" || '2.3rem'),
|
|
54
54
|
height: "".concat(size + "rem" || '2.3rem'),
|