@@ -97,38 +97,42 @@ export const Popup = forwardRef<PopupActions, PopupProps>(
9797 }
9898 } , [ open , disabled ] ) ;
9999
100- const openPopup = ( ) => {
100+ const openPopup = ( event ?: React . SyntheticEvent ) => {
101101 if ( isOpen || disabled ) return ;
102102 setIsOpen ( true ) ;
103- setTimeout ( onOpen , 0 ) ;
103+ setTimeout ( ( ) => onOpen ( event ) , 0 ) ;
104104 } ;
105105
106- const closePopup = ( ) => {
106+ const closePopup = (
107+ event ?: React . SyntheticEvent | KeyboardEvent | TouchEvent | MouseEvent
108+ ) => {
107109 if ( ! isOpen || disabled ) return ;
108110 setIsOpen ( false ) ;
109111 if ( isModal ) ( focusedElBeforeOpen . current as HTMLElement ) . focus ( ) ;
110- setTimeout ( onClose , 0 ) ;
112+ setTimeout ( ( ) => onClose ( event ) , 0 ) ;
111113 } ;
112114
113115 const togglePopup = ( event ?: React . SyntheticEvent ) => {
114116 event ?. stopPropagation ( ) ;
115- if ( ! isOpen ) openPopup ( ) ;
116- else closePopup ( ) ;
117+ if ( ! isOpen ) openPopup ( event ) ;
118+ else closePopup ( event ) ;
117119 } ;
118120
119- const onMouseEnter = ( ) => {
121+ const onMouseEnter = ( event ?: React . SyntheticEvent ) => {
120122 clearTimeout ( timeOut . current ) ;
121- timeOut . current = setTimeout ( openPopup , mouseEnterDelay ) ;
123+ timeOut . current = setTimeout ( ( ) => openPopup ( event ) , mouseEnterDelay ) ;
122124 } ;
125+
123126 const onContextMenu = ( event ?: React . SyntheticEvent ) => {
124127 event ?. preventDefault ( ) ;
125128 togglePopup ( ) ;
126129 } ;
127130
128- const onMouseLeave = ( ) => {
131+ const onMouseLeave = ( event ?: React . SyntheticEvent ) => {
129132 clearTimeout ( timeOut . current ) ;
130- timeOut . current = setTimeout ( closePopup , mouseLeaveDelay ) ;
133+ timeOut . current = setTimeout ( ( ) => closePopup ( event ) , mouseLeaveDelay ) ;
131134 } ;
135+
132136 const lockScrolll = ( ) => {
133137 if ( isModal && lockScroll )
134138 document . getElementsByTagName ( 'body' ) [ 0 ] . style . overflow = 'hidden' ; // migrate to document.body
0 commit comments