File tree Expand file tree Collapse file tree 2 files changed +9
-19
lines changed
infrastructure/eid-wallet/src/lib Expand file tree Collapse file tree 2 files changed +9
-19
lines changed Original file line number Diff line number Diff line change @@ -53,17 +53,6 @@ $effect(() => {
53
53
54
54
return () => pane .destroy ();
55
55
});
56
-
57
- $effect (() => {
58
- if (isPaneOpen ) {
59
- pane .present ({ animate: true });
60
- } else {
61
- pane .destroy ({ animate: true });
62
- }
63
- drawerElem .addEventListener (" click_outside" , () => {
64
- handleClickOutside ();
65
- });
66
- });
67
56
</script >
68
57
69
58
<div
@@ -74,7 +63,7 @@ $effect(() => {
74
63
})}
75
64
onswipe ={() => handleSwipe ?.(isPaneOpen )}
76
65
bind:this ={drawerElem }
77
- use:clickOutside
66
+ use:clickOutside ={ handleClickOutside }
78
67
class ={cn (restProps .class )}
79
68
>
80
69
<div class =" px-6" >
Original file line number Diff line number Diff line change 1
1
/** Dispatch event on click outside of node */
2
- export const clickOutside = ( node : HTMLElement ) => {
2
+ export const clickOutside = ( node : HTMLElement , callback : ( ) => void ) => {
3
3
const handleClick = ( event : Event ) => {
4
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
5
- // @ts -ignore
6
- if ( node && ! node . contains ( event . target ) && ! event . defaultPrevented ) {
7
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
8
- // @ts -ignore
9
- node . dispatchEvent ( new CustomEvent ( "click_outside" , node ) ) ;
4
+ if (
5
+ node &&
6
+ ! node . contains ( event . target as Node ) &&
7
+ ! event . defaultPrevented
8
+ ) {
9
+ callback ( ) ; // Call the provided callback
10
+ node . dispatchEvent ( new CustomEvent ( "click_outside" ) ) ;
10
11
}
11
12
} ;
12
13
You can’t perform that action at this time.
0 commit comments