@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
30 lines • 1.47 kB
TypeScript
import React from 'react';
/**
* Registers global listener for all clicks. It will only call the {@link PopupModel}'s `hide` event
* if the click happened outside the PopupModel's `state.stackRef` element and its children _and_
* the provided `stackRef` element is the topmost element with this behavior applied in the stack.
* Adds a `data-behavior-click-outside-close="topmost"` attribute to ensure proper functionality.
*
* This should be used with popup elements that are dismissible like Modals, non-modal dialogs,
* dropdown menus, etc. Tooltips and hierarchical menus should use
* {@link useAlwaysCloseOnClickOutside} instead.
*/
export declare const useCloseOnOutsideClick: import("@workday/canvas-kit-react/common").BehaviorHook<{
state: {
stackRef: React.RefObject<HTMLDivElement>;
targetRef: React.RefObject<HTMLButtonElement>;
initialFocusRef: React.RefObject<any> | undefined;
returnFocusRef: React.RefObject<any> | undefined;
placement: import("@popperjs/core").Placement;
id: string;
visibility: "hidden" | "visible";
};
events: {
updatePlacement(data: {
placement: import("@popperjs/core").Placement;
}): void;
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
};
}, {}>;
//# sourceMappingURL=useCloseOnOutsideClick.d.ts.map