Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/useClickOutside.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function isModifiedEvent(event: MouseEvent) {
}

export const getRefTarget = (
ref: React.RefObject<Element> | Element | null | undefined,
ref: React.RefObject<Element | null> | Element | null | undefined,
) => ref && ('current' in ref ? ref.current : ref);

export interface ClickOutsideOptions {
Expand All @@ -41,14 +41,14 @@ const InitialTriggerEvents: Partial<Record<MouseEvents, MouseEvents>> = {
* 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>| HTMLElement} ref The element boundary
* @param {Ref<HTMLElement | null>| 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> | Element | null | undefined,
ref: React.RefObject<Element | null> | Element | null | undefined,
onClickOutside: (e: Event) => void = noop,
{ disabled, clickTrigger = 'click' }: ClickOutsideOptions = {},
) {
Expand Down
2 changes: 1 addition & 1 deletion src/useRootClose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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> | Element | null | undefined,
ref: React.RefObject<Element | null> | Element | null | undefined,
onRootClose: (e: Event) => void,
{ disabled, clickTrigger }: RootCloseOptions = {},
) {
Expand Down
Loading