Gazebo_simulation-Frontend/node_modules/.cache/babel-loader/3d11613f23d6d8839438900fc8a...

1 line
12 KiB
JSON

{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport PopperContent from './PopperContent';\nimport { getTarget, targetPropType, omit, PopperPlacements, mapToCssModules, DOMElement } from './utils';\nexport var propTypes = {\n placement: PropTypes.oneOf(PopperPlacements),\n target: targetPropType.isRequired,\n container: targetPropType,\n isOpen: PropTypes.bool,\n disabled: PropTypes.bool,\n hideArrow: PropTypes.bool,\n boundariesElement: PropTypes.oneOfType([PropTypes.string, DOMElement]),\n className: PropTypes.string,\n innerClassName: PropTypes.string,\n arrowClassName: PropTypes.string,\n popperClassName: PropTypes.string,\n cssModule: PropTypes.object,\n toggle: PropTypes.func,\n autohide: PropTypes.bool,\n placementPrefix: PropTypes.string,\n delay: PropTypes.oneOfType([PropTypes.shape({\n show: PropTypes.number,\n hide: PropTypes.number\n }), PropTypes.number]),\n modifiers: PropTypes.object,\n offset: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.string, PropTypes.object]),\n trigger: PropTypes.string,\n fade: PropTypes.bool,\n flip: PropTypes.bool\n};\nvar DEFAULT_DELAYS = {\n show: 0,\n hide: 0\n};\nvar defaultProps = {\n isOpen: false,\n hideArrow: false,\n autohide: false,\n delay: DEFAULT_DELAYS,\n toggle: function toggle() {},\n trigger: 'click',\n fade: true\n};\n\nfunction isInDOMSubtree(element, subtreeRoot) {\n return subtreeRoot && (element === subtreeRoot || subtreeRoot.contains(element));\n}\n\nfunction isInDOMSubtrees(element, subtreeRoots) {\n if (subtreeRoots === void 0) {\n subtreeRoots = [];\n }\n\n return subtreeRoots && subtreeRoots.length && subtreeRoots.find(function (subTreeRoot) {\n return isInDOMSubtree(element, subTreeRoot);\n });\n}\n\nvar TooltipPopoverWrapper = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(TooltipPopoverWrapper, _React$Component);\n\n function TooltipPopoverWrapper(props) {\n var _this;\n\n _this = _React$Component.call(this, props) || this;\n _this._targets = [];\n _this.currentTargetElement = null;\n _this.addTargetEvents = _this.addTargetEvents.bind(_assertThisInitialized(_this));\n _this.handleDocumentClick = _this.handleDocumentClick.bind(_assertThisInitialized(_this));\n _this.removeTargetEvents = _this.removeTargetEvents.bind(_assertThisInitialized(_this));\n _this.toggle = _this.toggle.bind(_assertThisInitialized(_this));\n _this.showWithDelay = _this.showWithDelay.bind(_assertThisInitialized(_this));\n _this.hideWithDelay = _this.hideWithDelay.bind(_assertThisInitialized(_this));\n _this.onMouseOverTooltipContent = _this.onMouseOverTooltipContent.bind(_assertThisInitialized(_this));\n _this.onMouseLeaveTooltipContent = _this.onMouseLeaveTooltipContent.bind(_assertThisInitialized(_this));\n _this.show = _this.show.bind(_assertThisInitialized(_this));\n _this.hide = _this.hide.bind(_assertThisInitialized(_this));\n _this.onEscKeyDown = _this.onEscKeyDown.bind(_assertThisInitialized(_this));\n _this.getRef = _this.getRef.bind(_assertThisInitialized(_this));\n _this.state = {\n isOpen: props.isOpen\n };\n _this._isMounted = false;\n return _this;\n }\n\n var _proto = TooltipPopoverWrapper.prototype;\n\n _proto.componentDidMount = function componentDidMount() {\n this._isMounted = true;\n this.updateTarget();\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n this._isMounted = false;\n this.removeTargetEvents();\n this._targets = null;\n this.clearShowTimeout();\n this.clearHideTimeout();\n };\n\n TooltipPopoverWrapper.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {\n if (props.isOpen && !state.isOpen) {\n return {\n isOpen: props.isOpen\n };\n } else return null;\n };\n\n _proto.onMouseOverTooltipContent = function onMouseOverTooltipContent() {\n if (this.props.trigger.indexOf('hover') > -1 && !this.props.autohide) {\n if (this._hideTimeout) {\n this.clearHideTimeout();\n }\n\n if (this.state.isOpen && !this.props.isOpen) {\n this.toggle();\n }\n }\n };\n\n _proto.onMouseLeaveTooltipContent = function onMouseLeaveTooltipContent(e) {\n if (this.props.trigger.indexOf('hover') > -1 && !this.props.autohide) {\n if (this._showTimeout) {\n this.clearShowTimeout();\n }\n\n e.persist();\n this._hideTimeout = setTimeout(this.hide.bind(this, e), this.getDelay('hide'));\n }\n };\n\n _proto.onEscKeyDown = function onEscKeyDown(e) {\n if (e.key === 'Escape') {\n this.hide(e);\n }\n };\n\n _proto.getRef = function getRef(ref) {\n var innerRef = this.props.innerRef;\n\n if (innerRef) {\n if (typeof innerRef === 'function') {\n innerRef(ref);\n } else if (typeof innerRef === 'object') {\n innerRef.current = ref;\n }\n }\n\n this._popover = ref;\n };\n\n _proto.getDelay = function getDelay(key) {\n var delay = this.props.delay;\n\n if (typeof delay === 'object') {\n return isNaN(delay[key]) ? DEFAULT_DELAYS[key] : delay[key];\n }\n\n return delay;\n };\n\n _proto.show = function show(e) {\n if (!this.props.isOpen) {\n this.clearShowTimeout();\n this.currentTargetElement = e && e.target;\n this.toggle(e);\n }\n };\n\n _proto.showWithDelay = function showWithDelay(e) {\n if (this._hideTimeout) {\n this.clearHideTimeout();\n }\n\n this._showTimeout = setTimeout(this.show.bind(this, e), this.getDelay('show'));\n };\n\n _proto.hide = function hide(e) {\n if (this.props.isOpen) {\n this.clearHideTimeout();\n this.currentTargetElement = null;\n this.toggle(e);\n }\n };\n\n _proto.hideWithDelay = function hideWithDelay(e) {\n if (this._showTimeout) {\n this.clearShowTimeout();\n }\n\n this._hideTimeout = setTimeout(this.hide.bind(this, e), this.getDelay('hide'));\n };\n\n _proto.clearShowTimeout = function clearShowTimeout() {\n clearTimeout(this._showTimeout);\n this._showTimeout = undefined;\n };\n\n _proto.clearHideTimeout = function clearHideTimeout() {\n clearTimeout(this._hideTimeout);\n this._hideTimeout = undefined;\n };\n\n _proto.handleDocumentClick = function handleDocumentClick(e) {\n var triggers = this.props.trigger.split(' ');\n\n if (triggers.indexOf('legacy') > -1 && (this.props.isOpen || isInDOMSubtrees(e.target, this._targets))) {\n if (this._hideTimeout) {\n this.clearHideTimeout();\n }\n\n if (this.props.isOpen && !isInDOMSubtree(e.target, this._popover)) {\n this.hideWithDelay(e);\n } else if (!this.props.isOpen) {\n this.showWithDelay(e);\n }\n } else if (triggers.indexOf('click') > -1 && isInDOMSubtrees(e.target, this._targets)) {\n if (this._hideTimeout) {\n this.clearHideTimeout();\n }\n\n if (!this.props.isOpen) {\n this.showWithDelay(e);\n } else {\n this.hideWithDelay(e);\n }\n }\n };\n\n _proto.addEventOnTargets = function addEventOnTargets(type, handler, isBubble) {\n this._targets.forEach(function (target) {\n target.addEventListener(type, handler, isBubble);\n });\n };\n\n _proto.removeEventOnTargets = function removeEventOnTargets(type, handler, isBubble) {\n this._targets.forEach(function (target) {\n target.removeEventListener(type, handler, isBubble);\n });\n };\n\n _proto.addTargetEvents = function addTargetEvents() {\n if (this.props.trigger) {\n var triggers = this.props.trigger.split(' ');\n\n if (triggers.indexOf('manual') === -1) {\n if (triggers.indexOf('click') > -1 || triggers.indexOf('legacy') > -1) {\n document.addEventListener('click', this.handleDocumentClick, true);\n }\n\n if (this._targets && this._targets.length) {\n if (triggers.indexOf('hover') > -1) {\n this.addEventOnTargets('mouseover', this.showWithDelay, true);\n this.addEventOnTargets('mouseout', this.hideWithDelay, true);\n }\n\n if (triggers.indexOf('focus') > -1) {\n this.addEventOnTargets('focusin', this.show, true);\n this.addEventOnTargets('focusout', this.hide, true);\n }\n\n this.addEventOnTargets('keydown', this.onEscKeyDown, true);\n }\n }\n }\n };\n\n _proto.removeTargetEvents = function removeTargetEvents() {\n if (this._targets) {\n this.removeEventOnTargets('mouseover', this.showWithDelay, true);\n this.removeEventOnTargets('mouseout', this.hideWithDelay, true);\n this.removeEventOnTargets('keydown', this.onEscKeyDown, true);\n this.removeEventOnTargets('focusin', this.show, true);\n this.removeEventOnTargets('focusout', this.hide, true);\n }\n\n document.removeEventListener('click', this.handleDocumentClick, true);\n };\n\n _proto.updateTarget = function updateTarget() {\n var newTarget = getTarget(this.props.target, true);\n\n if (newTarget !== this._targets) {\n this.removeTargetEvents();\n this._targets = newTarget ? Array.from(newTarget) : [];\n this.currentTargetElement = this.currentTargetElement || this._targets[0];\n this.addTargetEvents();\n }\n };\n\n _proto.toggle = function toggle(e) {\n if (this.props.disabled || !this._isMounted) {\n return e && e.preventDefault();\n }\n\n return this.props.toggle(e);\n };\n\n _proto.render = function render() {\n if (!this.props.isOpen) {\n return null;\n }\n\n this.updateTarget();\n var _this$props = this.props,\n className = _this$props.className,\n cssModule = _this$props.cssModule,\n innerClassName = _this$props.innerClassName,\n isOpen = _this$props.isOpen,\n hideArrow = _this$props.hideArrow,\n boundariesElement = _this$props.boundariesElement,\n placement = _this$props.placement,\n placementPrefix = _this$props.placementPrefix,\n arrowClassName = _this$props.arrowClassName,\n popperClassName = _this$props.popperClassName,\n container = _this$props.container,\n modifiers = _this$props.modifiers,\n offset = _this$props.offset,\n fade = _this$props.fade,\n flip = _this$props.flip;\n var attributes = omit(this.props, Object.keys(propTypes));\n var popperClasses = mapToCssModules(popperClassName, cssModule);\n var classes = mapToCssModules(innerClassName, cssModule);\n return React.createElement(PopperContent, {\n className: className,\n target: this.currentTargetElement || this._targets[0],\n isOpen: isOpen,\n hideArrow: hideArrow,\n boundariesElement: boundariesElement,\n placement: placement,\n placementPrefix: placementPrefix,\n arrowClassName: arrowClassName,\n popperClassName: popperClasses,\n container: container,\n modifiers: modifiers,\n offset: offset,\n cssModule: cssModule,\n fade: fade,\n flip: flip\n }, React.createElement(\"div\", _extends({}, attributes, {\n ref: this.getRef,\n className: classes,\n role: \"tooltip\",\n \"aria-hidden\": isOpen,\n onMouseOver: this.onMouseOverTooltipContent,\n onMouseLeave: this.onMouseLeaveTooltipContent,\n onKeyDown: this.onEscKeyDown\n })));\n };\n\n return TooltipPopoverWrapper;\n}(React.Component);\n\nTooltipPopoverWrapper.propTypes = propTypes;\nTooltipPopoverWrapper.defaultProps = defaultProps;\nexport default TooltipPopoverWrapper;","map":null,"metadata":{},"sourceType":"module"}