From f428551d5b306336d8b2e30bd6b04ea120178976 Mon Sep 17 00:00:00 2001 From: Austin Astorga Date: Tue, 17 Jun 2025 15:48:10 +0000 Subject: [PATCH] fix react 19 refs --- src/useClickOutside.ts | 6 +++--- src/useRootClose.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/useClickOutside.ts b/src/useClickOutside.ts index e15ade8..ad5d9de 100644 --- a/src/useClickOutside.ts +++ b/src/useClickOutside.ts @@ -23,7 +23,7 @@ function isModifiedEvent(event: MouseEvent) { } export const getRefTarget = ( - ref: React.RefObject | Element | null | undefined, + ref: React.RefObject | Element | null | undefined, ) => ref && ('current' in ref ? ref.current : ref); export interface ClickOutsideOptions { @@ -41,14 +41,14 @@ const InitialTriggerEvents: Partial> = { * The `useClickOutside` hook registers your callback on the document that fires * when a pointer event is registered outside of the provided ref or element. * - * @param {Ref| HTMLElement} ref The element boundary + * @param {Ref| HTMLElement} ref The element boundary * @param {function} onClickOutside * @param {object=} options * @param {boolean=} options.disabled * @param {string=} options.clickTrigger The DOM event name (click, mousedown, etc) to attach listeners on */ function useClickOutside( - ref: React.RefObject | Element | null | undefined, + ref: React.RefObject | Element | null | undefined, onClickOutside: (e: Event) => void = noop, { disabled, clickTrigger = 'click' }: ClickOutsideOptions = {}, ) { diff --git a/src/useRootClose.ts b/src/useRootClose.ts index 47901e6..33db5b3 100644 --- a/src/useRootClose.ts +++ b/src/useRootClose.ts @@ -28,7 +28,7 @@ export interface RootCloseOptions extends ClickOutsideOptions { * @param {string=} options.clickTrigger The DOM event name (click, mousedown, etc) to attach listeners on */ function useRootClose( - ref: React.RefObject | Element | null | undefined, + ref: React.RefObject | Element | null | undefined, onRootClose: (e: Event) => void, { disabled, clickTrigger }: RootCloseOptions = {}, ) {