@@ -23,7 +23,7 @@ function isModifiedEvent(event: MouseEvent) {
23
23
}
24
24
25
25
export const getRefTarget = (
26
- ref : React . RefObject < Element > | Element | null | undefined ,
26
+ ref : React . RefObject < Element | null > | Element | null | undefined ,
27
27
) => ref && ( 'current' in ref ? ref . current : ref ) ;
28
28
29
29
export interface ClickOutsideOptions {
@@ -41,14 +41,14 @@ const InitialTriggerEvents: Partial<Record<MouseEvents, MouseEvents>> = {
41
41
* The `useClickOutside` hook registers your callback on the document that fires
42
42
* when a pointer event is registered outside of the provided ref or element.
43
43
*
44
- * @param {Ref<HTMLElement>| HTMLElement } ref The element boundary
44
+ * @param {Ref<HTMLElement | null >| HTMLElement } ref The element boundary
45
45
* @param {function } onClickOutside
46
46
* @param {object= } options
47
47
* @param {boolean= } options.disabled
48
48
* @param {string= } options.clickTrigger The DOM event name (click, mousedown, etc) to attach listeners on
49
49
*/
50
50
function useClickOutside (
51
- ref : React . RefObject < Element > | Element | null | undefined ,
51
+ ref : React . RefObject < Element | null > | Element | null | undefined ,
52
52
onClickOutside : ( e : Event ) => void = noop ,
53
53
{ disabled, clickTrigger = 'click' } : ClickOutsideOptions = { } ,
54
54
) {
0 commit comments