interface PopOutOfOverflowHiddenParentResult { trackerRef: React.MutableRefObject; applyFixedPos: () => void; removeFixedPos: () => void; fixPos: DOMRect | undefined; } /** * this utility is useful when action menus or dropdowns are * used inside parents that have overflow hidden. * * When the dropdown / menu opens, we need it to show, * and sometimes its not possible to reposition the dropdown / menu * outside of the overflow hidden container. * * In such cases, we can use this hook. * The way to use is this: * * 1// initiate -> (see what it returns below) * * 2// attach the ref & pass fixPos as a prop to whatever * wrapper is wrapping the menu or dropdown. * * 3// whereever you are tracking the dropdown/menu opening or closing, * there you can write a function to * trigger applyFixedPos() when open * and removeFixedPos() when closed * for example in ActionMenu we can pass a prop called 'setShowActions' * which listens to open-close changes * * And thats it. it should work. * * Current Usage : * 1. In ImageEditor component > to make the ActionMenu stick out of parent * 2. In TableRowElem component > to make the ActionMenu stick out of parent * * Known Issues : * 1. If you scroll while the menu is open, it remains fixed to that part of the * screen since we are using fixed positioning. * 2. When you close the menu, fixed position is removed, so momentarily you see the * menu disappearing behind the overflow hidden parent. Minor, but an issue none the less. * * * */ /** * Creates a custom hook that enables an element to pop out of its overflow hidden parent. * * @param {boolean} popOutOfOverflowHiddenParent - Determines if the element should pop out of its overflow hidden parent. * @return {object} An object containing the following properties: * - {RefObject} trackerRef: A ref to the tracker div element. * - {Function} applyFixedPos: A function that applies the fixed position to the element. * - {Function} removeFixedPos: A function that removes the fixed position from the element. * - {undefined | ClientRect} fixPos: The fixed position of the element. */ export declare const usePopOutOfOverflowHiddenParent: (popOutOfOverflowHiddenParent: boolean) => PopOutOfOverflowHiddenParentResult; export {};