UNPKG

outsideclick-react

Version:

A React utility hook for detecting outside clicks

13 lines (10 loc) 756 B
import * as react_jsx_runtime from 'react/jsx-runtime'; import React from 'react'; type OutSideClickType = { onOutsideClick?: (v?: HTMLElement) => void; ignoreElement?: IgnoreElementType; } & React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>; type IgnoreElementType = (Element | string | HTMLElement)[] | string | HTMLCollectionOf<Element> | NodeList | Element | HTMLElement | Node; declare const OutsideClick: ({ onOutsideClick, ignoreElement, ...others }: OutSideClickType) => react_jsx_runtime.JSX.Element; declare function useOutsideClick<T = HTMLDivElement>(outsideClick?: (r?: T | null) => void, ignoreElement?: IgnoreElementType): React.RefObject<T | null>; export { OutsideClick as default, useOutsideClick };