@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
27 lines • 1.17 kB
TypeScript
import React from 'react';
/**
* Registers global detection of the Escape key. It will only call the {@link PopupModel}'s `hide`
* event if the provided model's `state.stackRef` element is the topmost in the stack.
*
* This should be used with popup elements that are dismissible like Tooltips, Modals, non-modal
* dialogs, dropdown menus, etc.
*/
export declare const useCloseOnEscape: 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=useCloseOnEscape.d.ts.map