@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
29 lines • 1.35 kB
TypeScript
import React from 'react';
/**
* Registers global listener for all clicks. It will only call the PopupModel's `hide` event if the
* click happened outside the `stackRef` element and its children regardless of the position in the
* stack. This is useful for Tooltips or hierarchical menus. Adds a
* `data-behavior-click-outside-close="always"` attribute to ensure proper functionality.
*
* This should be used with popup elements that should close no matter their position in the stack
* (i.e. Tooltips).
*/
export declare const useAlwaysCloseOnOutsideClick: 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=useAlwaysCloseOnOutsideClick.d.ts.map