{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectSpread2 from \"@babel/runtime/helpers/esm/objectSpread\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { Popper } from 'react-popper';\nimport { DropdownContext } from './DropdownContext';\nimport { mapToCssModules, tagPropType } from './utils';\nvar propTypes = {\n tag: tagPropType,\n children: PropTypes.node.isRequired,\n right: PropTypes.bool,\n flip: PropTypes.bool,\n modifiers: PropTypes.object,\n className: PropTypes.string,\n cssModule: PropTypes.object,\n persist: PropTypes.bool,\n positionFixed: PropTypes.bool\n};\nvar defaultProps = {\n tag: 'div',\n flip: true\n};\nvar noFlipModifier = {\n flip: {\n enabled: false\n }\n};\nvar directionPositionMap = {\n up: 'top',\n left: 'left',\n right: 'right',\n down: 'bottom'\n};\n\nvar DropdownMenu = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(DropdownMenu, _React$Component);\n\n function DropdownMenu() {\n return _React$Component.apply(this, arguments) || this;\n }\n\n var _proto = DropdownMenu.prototype;\n\n _proto.render = function render() {\n var _this = this;\n\n var _this$props = this.props,\n className = _this$props.className,\n cssModule = _this$props.cssModule,\n right = _this$props.right,\n tag = _this$props.tag,\n flip = _this$props.flip,\n modifiers = _this$props.modifiers,\n persist = _this$props.persist,\n positionFixed = _this$props.positionFixed,\n attrs = _objectWithoutPropertiesLoose(_this$props, [\"className\", \"cssModule\", \"right\", \"tag\", \"flip\", \"modifiers\", \"persist\", \"positionFixed\"]);\n\n var classes = mapToCssModules(classNames(className, 'dropdown-menu', {\n 'dropdown-menu-right': right,\n show: this.context.isOpen\n }), cssModule);\n var Tag = tag;\n\n if (persist || this.context.isOpen && !this.context.inNavbar) {\n var position1 = directionPositionMap[this.context.direction] || 'bottom';\n var position2 = right ? 'end' : 'start';\n var poperPlacement = position1 + \"-\" + position2;\n var poperModifiers = !flip ? _objectSpread2({}, modifiers, {}, noFlipModifier) : modifiers;\n var popperPositionFixed = !!positionFixed;\n return React.createElement(Popper, {\n placement: poperPlacement,\n modifiers: poperModifiers,\n positionFixed: popperPositionFixed\n }, function (_ref) {\n var ref = _ref.ref,\n style = _ref.style,\n placement = _ref.placement;\n return React.createElement(Tag, _extends({\n tabIndex: \"-1\",\n role: \"menu\",\n ref: ref,\n style: style\n }, attrs, {\n \"aria-hidden\": !_this.context.isOpen,\n className: classes,\n \"x-placement\": placement\n }));\n });\n }\n\n return React.createElement(Tag, _extends({\n tabIndex: \"-1\",\n role: \"menu\"\n }, attrs, {\n \"aria-hidden\": !this.context.isOpen,\n className: classes,\n \"x-placement\": attrs.placement\n }));\n };\n\n return DropdownMenu;\n}(React.Component);\n\n;\nDropdownMenu.propTypes = propTypes;\nDropdownMenu.defaultProps = defaultProps;\nDropdownMenu.contextType = DropdownContext;\nexport default DropdownMenu;","map":null,"metadata":{},"sourceType":"module"}