UNPKG

@navikt/ds-react

Version:

React components from the Norwegian Labour and Welfare Administration.

11 lines (10 loc) 617 B
import { CustomPointerDownEvent } from "./dispatchCustomEvent"; /** * Listens for `pointerdown` outside a react subtree. We use `pointerdown` rather than `pointerup` * to mimic layer dismissing behaviour present in OS. * Returns props to pass to the node we want to check for outside events. * By checking `isPointerInsideReactTreeRef` we can determine if the event happened outside the subtree of the node, saving some element-comparisons. */ export declare function usePointerDownOutside(callback?: (event: CustomPointerDownEvent) => void, ownerDocument?: Document): { onPointerDownCapture: () => void; };