Gazebo_simulation-Frontend/node_modules/.cache/babel-loader/fba574cbebf0d5a3c9d32db08f9...

1 line
5.0 KiB
JSON

{"ast":null,"code":"import addClass from 'dom-helpers/addClass';\nimport removeClass from 'dom-helpers/removeClass';\nimport css from 'dom-helpers/css';\nimport getScrollbarSize from 'dom-helpers/scrollbarSize';\nimport isOverflowing from './utils/isOverflowing';\nimport { ariaHidden, hideSiblings, showSiblings } from './utils/manageAriaHidden';\n\nfunction findIndexOf(arr, cb) {\n var idx = -1;\n arr.some(function (d, i) {\n if (cb(d, i)) {\n idx = i;\n return true;\n }\n\n return false;\n });\n return idx;\n}\n/**\n * Proper state management for containers and the modals in those containers.\n *\n * @internal Used by the Modal to ensure proper styling of containers.\n */\n\n\nvar ModalManager = /*#__PURE__*/function () {\n function ModalManager(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n _ref$hideSiblingNodes = _ref.hideSiblingNodes,\n hideSiblingNodes = _ref$hideSiblingNodes === void 0 ? true : _ref$hideSiblingNodes,\n _ref$handleContainerO = _ref.handleContainerOverflow,\n handleContainerOverflow = _ref$handleContainerO === void 0 ? true : _ref$handleContainerO;\n\n this.hideSiblingNodes = hideSiblingNodes;\n this.handleContainerOverflow = handleContainerOverflow;\n this.modals = [];\n this.containers = [];\n this.data = [];\n this.scrollbarSize = getScrollbarSize();\n }\n\n var _proto = ModalManager.prototype;\n\n _proto.isContainerOverflowing = function isContainerOverflowing(modal) {\n var data = this.data[this.containerIndexFromModal(modal)];\n return data && data.overflowing;\n };\n\n _proto.containerIndexFromModal = function containerIndexFromModal(modal) {\n return findIndexOf(this.data, function (d) {\n return d.modals.indexOf(modal) !== -1;\n });\n };\n\n _proto.setContainerStyle = function setContainerStyle(containerState, container) {\n var style = {\n overflow: 'hidden'\n }; // we are only interested in the actual `style` here\n // because we will override it\n\n containerState.style = {\n overflow: container.style.overflow,\n paddingRight: container.style.paddingRight\n };\n\n if (containerState.overflowing) {\n // use computed style, here to get the real padding\n // to add our scrollbar width\n style.paddingRight = parseInt(css(container, 'paddingRight') || 0, 10) + this.scrollbarSize + \"px\";\n }\n\n css(container, style);\n };\n\n _proto.removeContainerStyle = function removeContainerStyle(containerState, container) {\n var style = containerState.style;\n Object.keys(style).forEach(function (key) {\n container.style[key] = style[key];\n });\n };\n\n _proto.add = function add(modal, container, className) {\n var modalIdx = this.modals.indexOf(modal);\n var containerIdx = this.containers.indexOf(container);\n\n if (modalIdx !== -1) {\n return modalIdx;\n }\n\n modalIdx = this.modals.length;\n this.modals.push(modal);\n\n if (this.hideSiblingNodes) {\n hideSiblings(container, modal);\n }\n\n if (containerIdx !== -1) {\n this.data[containerIdx].modals.push(modal);\n return modalIdx;\n }\n\n var data = {\n modals: [modal],\n // right now only the first modal of a container will have its classes applied\n classes: className ? className.split(/\\s+/) : [],\n overflowing: isOverflowing(container)\n };\n\n if (this.handleContainerOverflow) {\n this.setContainerStyle(data, container);\n }\n\n data.classes.forEach(addClass.bind(null, container));\n this.containers.push(container);\n this.data.push(data);\n return modalIdx;\n };\n\n _proto.remove = function remove(modal) {\n var modalIdx = this.modals.indexOf(modal);\n\n if (modalIdx === -1) {\n return;\n }\n\n var containerIdx = this.containerIndexFromModal(modal);\n var data = this.data[containerIdx];\n var container = this.containers[containerIdx];\n data.modals.splice(data.modals.indexOf(modal), 1);\n this.modals.splice(modalIdx, 1); // if that was the last modal in a container,\n // clean up the container\n\n if (data.modals.length === 0) {\n data.classes.forEach(removeClass.bind(null, container));\n\n if (this.handleContainerOverflow) {\n this.removeContainerStyle(data, container);\n }\n\n if (this.hideSiblingNodes) {\n showSiblings(container, modal);\n }\n\n this.containers.splice(containerIdx, 1);\n this.data.splice(containerIdx, 1);\n } else if (this.hideSiblingNodes) {\n // otherwise make sure the next top modal is visible to a SR\n var _data$modals = data.modals[data.modals.length - 1],\n backdrop = _data$modals.backdrop,\n dialog = _data$modals.dialog;\n ariaHidden(false, dialog);\n ariaHidden(false, backdrop);\n }\n };\n\n _proto.isTopModal = function isTopModal(modal) {\n return !!this.modals.length && this.modals[this.modals.length - 1] === modal;\n };\n\n return ModalManager;\n}();\n\nexport default ModalManager;","map":null,"metadata":{},"sourceType":"module"}