next-helios-fe 1.1.2 → 1.1.3
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/components/content-container/modal/index.d.ts +2 -2
- package/dist/components/dialog/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/content-container/drawer.tsx +6 -6
- package/src/components/content-container/modal/index.tsx +8 -8
- package/src/components/dialog/index.tsx +8 -8
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@ export const Drawer: React.FC<DrawerProps> = ({
|
|
|
13
13
|
title,
|
|
14
14
|
subtitle,
|
|
15
15
|
}) => {
|
|
16
|
-
const [
|
|
16
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
17
17
|
|
|
18
18
|
useEffect(() => {
|
|
19
19
|
document.addEventListener("mousedown", (e) => {
|
|
@@ -21,7 +21,7 @@ export const Drawer: React.FC<DrawerProps> = ({
|
|
|
21
21
|
e.target instanceof HTMLElement &&
|
|
22
22
|
!e.target.closest("#info-screen")
|
|
23
23
|
) {
|
|
24
|
-
|
|
24
|
+
setIsOpen(false);
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
}, []);
|
|
@@ -29,19 +29,19 @@ export const Drawer: React.FC<DrawerProps> = ({
|
|
|
29
29
|
return (
|
|
30
30
|
<div
|
|
31
31
|
className={`absolute top-0 right-0 h-full z-40 ${
|
|
32
|
-
!
|
|
32
|
+
!isOpen && "pointer-events-none"
|
|
33
33
|
}`}
|
|
34
34
|
>
|
|
35
35
|
<div
|
|
36
36
|
className={`flex h-full duration-300 ${
|
|
37
|
-
|
|
37
|
+
isOpen ? "translate-x-0" : "translate-x-96"
|
|
38
38
|
}`}
|
|
39
39
|
>
|
|
40
40
|
<button
|
|
41
41
|
type="button"
|
|
42
42
|
className="group sticky top-36 h-min rounded-l-md text-white bg-primary p-2 hover:bg-primary-dark pointer-events-auto active:opacity-70 active:duration-300 active:ease-out"
|
|
43
43
|
onClick={() => {
|
|
44
|
-
|
|
44
|
+
setIsOpen((prev) => !prev);
|
|
45
45
|
}}
|
|
46
46
|
>
|
|
47
47
|
<Icon
|
|
@@ -63,7 +63,7 @@ export const Drawer: React.FC<DrawerProps> = ({
|
|
|
63
63
|
type="button"
|
|
64
64
|
className="flex justify-center items-center rounded-full p-1 text-slate-400 hover:bg-secondary-light"
|
|
65
65
|
onClick={() => {
|
|
66
|
-
|
|
66
|
+
setIsOpen(false);
|
|
67
67
|
}}
|
|
68
68
|
>
|
|
69
69
|
<Icon icon="pajamas:close" className="text-2xl" />
|
|
@@ -19,8 +19,8 @@ interface ModalProps {
|
|
|
19
19
|
label?: string;
|
|
20
20
|
onClick: () => void;
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
isOpen: boolean;
|
|
23
|
+
onClose: (isOpen: boolean) => void;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export const Modal: React.FC<ModalProps> = ({
|
|
@@ -29,14 +29,14 @@ export const Modal: React.FC<ModalProps> = ({
|
|
|
29
29
|
title,
|
|
30
30
|
options,
|
|
31
31
|
action,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
isOpen,
|
|
33
|
+
onClose,
|
|
34
34
|
}) => {
|
|
35
35
|
useEffect(() => {
|
|
36
36
|
if (!options?.disableClose) {
|
|
37
37
|
document.addEventListener("keydown", (e) => {
|
|
38
38
|
if (e.key === "Escape") {
|
|
39
|
-
|
|
39
|
+
onClose(false);
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
}
|
|
@@ -57,7 +57,7 @@ export const Modal: React.FC<ModalProps> = ({
|
|
|
57
57
|
<div
|
|
58
58
|
id={id}
|
|
59
59
|
className={`absolute top-0 left-0 w-dvw h-dvh z-40 bg-black/30 backdrop-blur-sm ${
|
|
60
|
-
!
|
|
60
|
+
!isOpen && "hidden"
|
|
61
61
|
}`}
|
|
62
62
|
>
|
|
63
63
|
<div className="flex justify-center items-center w-full h-full">
|
|
@@ -73,7 +73,7 @@ export const Modal: React.FC<ModalProps> = ({
|
|
|
73
73
|
type="button"
|
|
74
74
|
className="flex justify-center items-center rounded-full px-1 py-1 text-slate-400 hover:bg-secondary-light"
|
|
75
75
|
onClick={() => {
|
|
76
|
-
|
|
76
|
+
onClose(false);
|
|
77
77
|
}}
|
|
78
78
|
>
|
|
79
79
|
<Icon icon="pajamas:close" className="text-2xl" />
|
|
@@ -98,7 +98,7 @@ export const Modal: React.FC<ModalProps> = ({
|
|
|
98
98
|
border: true,
|
|
99
99
|
}}
|
|
100
100
|
onClick={() => {
|
|
101
|
-
|
|
101
|
+
onClose(false);
|
|
102
102
|
}}
|
|
103
103
|
>
|
|
104
104
|
Close
|
|
@@ -11,16 +11,16 @@ interface DialogProps {
|
|
|
11
11
|
options?: {
|
|
12
12
|
timeout?: 3000 | 5000 | 7000 | 10000;
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
isOpen: boolean;
|
|
15
|
+
onClose: (isOpen: boolean) => void;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export const Dialog: React.FC<DialogProps> = ({
|
|
19
19
|
children,
|
|
20
20
|
action,
|
|
21
21
|
options,
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
isOpen,
|
|
23
|
+
onClose,
|
|
24
24
|
}) => {
|
|
25
25
|
const actionVariant =
|
|
26
26
|
action.variant === "secondary"
|
|
@@ -46,16 +46,16 @@ export const Dialog: React.FC<DialogProps> = ({
|
|
|
46
46
|
useEffect(() => {
|
|
47
47
|
if (options?.timeout) {
|
|
48
48
|
const timeout = setTimeout(() => {
|
|
49
|
-
|
|
49
|
+
onClose(false);
|
|
50
50
|
}, options.timeout);
|
|
51
51
|
return () => clearTimeout(timeout);
|
|
52
52
|
}
|
|
53
|
-
}, [
|
|
53
|
+
}, [isOpen]);
|
|
54
54
|
|
|
55
55
|
return (
|
|
56
56
|
<div
|
|
57
57
|
className={`absolute top-0 left-0 w-dvw h-dvh z-40 ${
|
|
58
|
-
!
|
|
58
|
+
!isOpen && "hidden"
|
|
59
59
|
} ${options?.timeout ? "pointer-events-none" : "bg-black/30"}`}
|
|
60
60
|
>
|
|
61
61
|
<div className="flex justify-center mt-4">
|
|
@@ -70,7 +70,7 @@ export const Dialog: React.FC<DialogProps> = ({
|
|
|
70
70
|
<button
|
|
71
71
|
className="text-danger hover:text-danger-dark hover:underline"
|
|
72
72
|
onClick={() => {
|
|
73
|
-
|
|
73
|
+
onClose(false);
|
|
74
74
|
}}
|
|
75
75
|
>
|
|
76
76
|
Close
|