@@ -42,12 +42,12 @@ const closeButtonStyles = css({
4242 right : spacing [ 2 ] ,
4343} ) ;
4444
45- type InteractivePopoverProps = {
45+ type InteractivePopoverProps < TriggerElement extends HTMLElement > = {
4646 className ?: string ;
4747 children : React . ReactNode ;
4848 trigger : ( triggerProps : {
49- onClick : React . MouseEventHandler < HTMLButtonElement > ;
50- ref : React . LegacyRef < HTMLButtonElement > ;
49+ onClick : React . MouseEventHandler < TriggerElement > ;
50+ ref : React . ForwardedRef < TriggerElement > ;
5151 children : React . ReactNode ;
5252 } ) => React . ReactElement ;
5353 hideCloseButton ?: boolean ;
@@ -65,7 +65,7 @@ type InteractivePopoverProps = {
6565 'align' | 'justify' | 'spacing' | 'popoverZIndex'
6666> ;
6767
68- function InteractivePopover ( {
68+ function InteractivePopover < TriggerElement extends HTMLElement > ( {
6969 className,
7070 children,
7171 trigger,
@@ -80,9 +80,9 @@ function InteractivePopover({
8080 popoverZIndex,
8181 containerClassName,
8282 closeButtonClassName,
83- } : InteractivePopoverProps ) : React . ReactElement {
83+ } : InteractivePopoverProps < TriggerElement > ) : React . ReactElement {
8484 const darkMode = useDarkMode ( ) ;
85- const triggerRef = useRef < HTMLButtonElement > ( null ) ;
85+ const triggerRef = useRef < TriggerElement > ( null ) ;
8686 const closeButtonRef = useRef < HTMLButtonElement > ( null ) ;
8787 const popoverContentContainerRef = useRef < HTMLDivElement > ( null ) ;
8888
0 commit comments