GoScrobble/web/node_modules/.cache/babel-loader/0cdadfbeebfbdf647aa0289bb3a58e46.json

1 line
34 KiB
JSON
Raw Normal View History

2022-04-25 02:47:15 +00:00
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\n/* eslint react/no-find-dom-node: 0 */\n// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { Manager } from 'react-popper';\nimport classNames from 'classnames';\nimport { DropdownContext } from './DropdownContext';\nimport { mapToCssModules, omit, keyCodes, tagPropType } from './utils';\nvar propTypes = {\n a11y: PropTypes.bool,\n disabled: PropTypes.bool,\n direction: PropTypes.oneOf(['up', 'down', 'left', 'right']),\n group: PropTypes.bool,\n isOpen: PropTypes.bool,\n nav: PropTypes.bool,\n active: PropTypes.bool,\n addonType: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['prepend', 'append'])]),\n size: PropTypes.string,\n tag: tagPropType,\n toggle: PropTypes.func,\n children: PropTypes.node,\n className: PropTypes.string,\n cssModule: PropTypes.object,\n inNavbar: PropTypes.bool,\n setActiveFromChild: PropTypes.bool\n};\nvar defaultProps = {\n a11y: true,\n isOpen: false,\n direction: 'down',\n nav: false,\n active: false,\n addonType: false,\n inNavbar: false,\n setActiveFromChild: false\n};\nvar preventDefaultKeys = [keyCodes.space, keyCodes.enter, keyCodes.up, keyCodes.down, keyCodes.end, keyCodes.home];\n\nvar Dropdown = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(Dropdown, _React$Component);\n\n function Dropdown(props) {\n var _this;\n\n _this = _React$Component.call(this, props) || this;\n _this.addEvents = _this.addEvents.bind(_assertThisInitialized(_this));\n _this.handleDocumentClick = _this.handleDocumentClick.bind(_assertThisInitialized(_this));\n _this.handleKeyDown = _this.handleKeyDown.bind(_assertThisInitialized(_this));\n _this.removeEvents = _this.removeEvents.bind(_assertThisInitialized(_this));\n _this.toggle = _this.toggle.bind(_assertThisInitialized(_this));\n _this.handleMenuRef = _this.handleMenuRef.bind(_assertThisInitialized(_this));\n _this.containerRef = /*#__PURE__*/React.createRef();\n _this.menuRef = /*#__PURE__*/React.createRef();\n return _this;\n }\n\n var _proto = Dropdown.prototype;\n\n _proto.handleMenuRef = function handleMenuRef(menuRef) {\n this.menuRef.current = menuRef;\n };\n\n _proto.getContextValue = function getContextValue() {\n return {\n toggle: this.toggle,\n isOpen: this.props.isOpen,\n direction: this.props.direction === 'down' && this.props.dropup ? 'up' : this.props.direction,\n inNavbar: this.props.inNavbar,\n disabled: this.props.disabled,\n // Callback that should be called by DropdownMenu to provide a ref to\n // a HTML tag that's used for the DropdownMenu\n onMenuRef: this.handleMenuRef\n };\n };\n\n _proto.componentDidMount = function componentDidMount() {\n this.handleProps();\n };\n\n _proto.componentDidUpdate = function componentDidUpdate(prevProps) {\n if (this.props.isOpen !== prevProps.isOpen) {\n this.handleProps();\n }\n };\n\n _proto.componentWillUnmount = function componentWillUnmount() {\n this.removeEvents();\n };\n\n _proto.getContainer = function getContainer() {\n return this.containerRef.current;\n };\n\n _proto.getMenu = function getMenu() {\n return this.menuRef.current;\n };\n\n _proto.getMenuCtrl = function getMenuCtrl() {\n if (this._$menuCtrl) return this._$menuCtrl;\n this._$menuCtrl = this.getContainer().querySelector('[aria-expanded]');\n return this._$menuCtrl;\n };\n\n _proto.getMenuItems = function getMenuItems() {\n // In a real menu with a child DropdownMenu, `this.getMenu()` should never\n // be null, but it is sometimes null in tests. To mitigate that, we just\n // use `this.