UNPKG

@zohodesk/components

Version:

Dot UI is a customizable React component library built to deliver a clean, accessible, and developer-friendly UI experience. It offers a growing set of reusable components designed to align with modern design systems and streamline application development

44 lines (39 loc) 1.25 kB
import React from 'react'; import DotkitPopup from '@zohodesk/dotkit/es/react/components/Popup/Popup'; import { getLibraryConfig } from "../Provider/Config.js"; import { DUMMY_ARRAY, DUMMY_OBJECT } from "./../utils/Common.js"; import Registry from '@zohodesk/dotkit/es/react/components/Popup/Registry.js'; global.closeGroupPopups = Registry.closeAllPopupsInGroup; const Popup = (Component, group = 'global', needResizeHandling = true, options = DUMMY_OBJECT) => { const { isAbsolutePositioningNeeded = true, isArrow = false, customOrder = DUMMY_ARRAY, scrollDebounceTime = 0, closeOnScroll = false, isOutsideScrollBlocked = false } = options; const getRootElement = () => { return getLibraryConfig('getRootElement'); }; const getMobileWidth = () => { return getLibraryConfig('mobileWidth'); }; const middleware = { useAbsolutePositioning: isAbsolutePositioningNeeded, positionOrder: customOrder, isArrow, scrollDebounceTime, closeOnScroll, isOutsideScrollBlocked, enableResizeHandling: needResizeHandling }; const popupConfig = { group, getMobileWidth, getRootElement, middleware }; return DotkitPopup(Component, popupConfig); }; export default Popup;