UNPKG

@momentum-ui/react-collaboration

Version:

Cisco Momentum UI Framework for React Collaboration Applications

36 lines 1.31 kB
var pluginMap = new Map(); /* Before this plugin there is a bug with opening multiple selects inside of a popover, where the PopoverParent renders 2 PopoverChildren and clicking on either PopoverChildren, events get swallowed and the other PopoverChild will not close this plugin solves this by managing these popovers within a groupID to hide */ export var getSingleOpenPlugin = function (groupId) { if (!groupId) { return undefined; } if (pluginMap.has(groupId)) { var plugin = pluginMap.get(groupId); return plugin ? plugin : undefined; } var openTippies = new Set(); var newPlugin = { name: "singleOpen-".concat(groupId), fn: function (instance) { return { onShow: function () { openTippies.forEach(function (openInstance) { if (openInstance !== instance) { openInstance.hide(); } }); openTippies.add(instance); }, onHide: function () { openTippies.delete(instance); }, }; }, }; pluginMap.set(groupId, newPlugin); return newPlugin; }; //# sourceMappingURL=singleOpenPlugin.js.map