mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 09:25:15 +00:00
1 line
34 KiB
JSON
1 line
34 KiB
JSON
{"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.getContainer()` as the fallback `menuContainer`.\n var menuContainer = this.getMenu() || this.getContainer();\n return [].slice.call(menuContainer.querySelectorAll('[role=\"menuitem\"]'));\n };\n\n _proto.addEvents = function addEvents() {\n var _this2 = this;\n\n ['click', 'touchstart', 'keyup'].forEach(function (event) {\n return document.addEventListener(event, _this2.handleDocumentClick, true);\n });\n };\n\n _proto.removeEvents = function removeEvents() {\n var _this3 = this;\n\n ['click', 'touchstart', 'keyup'].forEach(function (event) {\n return document.removeEventListener(event, _this3.handleDocumentClick, true);\n });\n };\n\n _proto.handleDocumentClick = function handleDocumentClick(e) {\n if (e && (e.which === 3 || e.type === 'keyup' && e.which !== keyCodes.tab)) return;\n var container = this.getContainer();\n var menu = this.getMenu();\n var clickIsInContainer = container.contains(e.target) && container !== e.target;\n var clickIsInMenu = menu && menu.contains(e.target) && menu !== e.target;\n\n if ((clickIsInContainer || clickIsInMenu) && (e.type !== 'keyup' || e.which === keyCodes.tab)) {\n return;\n }\n\n this.toggle(e);\n };\n\n _proto.handleKeyDown = function handleKeyDown(e) {\n var _this4 = this;\n\n var isTargetMenuItem = e.target.getAttribute('role') === 'menuitem';\n var isTargetMenuCtrl = this.getMenuCtrl() === e.target;\n var isTab = keyCodes.tab === e.which;\n\n if (/input|textarea/i.test(e.target.tagName) || isTab && !this.props.a11y || isTab && !(isTargetMenuItem || isTargetMenuCtrl)) {\n return;\n }\n\n if (preventDefaultKeys.indexOf(e.which) !== -1 || e.which >= 48 && e.which <= 90) {\n e.preventDefault();\n }\n\n if (this.props.disabled) return;\n\n if (isTargetMenuCtrl) {\n if ([keyCodes.space, keyCodes.enter, keyCodes.up, keyCodes.down].indexOf(e.which) > -1) {\n // Open the menu (if not open) and focus the first menu item\n if (!this.props.isOpen) {\n this.toggle(e);\n }\n\n setTimeout(function () {\n return _this4.getMenuItems()[0].focus();\n });\n } else if (this.props.isOpen && isTab) {\n // Focus the first menu item if tabbing from an open menu. We need this\n // for cases where the DropdownMenu sets a custom container, which may\n // not be the natural next item to tab to from the DropdownToggle.\n e.preventDefault();\n this.getMenuItems()[0].focus();\n } else if (this.props.isOpen && e.which === keyCodes.esc) {\n this.toggle(e);\n }\n }\n\n if (this.props.isOpen && e.target.getAttribute('role') === 'menuitem') {\n if ([keyCodes.tab, keyCodes.esc].indexOf(e.which) > -1) {\n this.toggle(e);\n this.getMenuCtrl().focus();\n } else if ([keyCodes.space, keyCodes.enter].indexOf(e.which) > -1) {\n e.target.click();\n this.getMenuCtrl().focus();\n } else if ([keyCodes.down, keyCodes.up].indexOf(e.which) > -1 || [keyCodes.n, keyCodes.p].indexOf(e.which) > -1 && e.ctrlKey) {\n var $menuitems = this.getMenuItems();\n var index = $menuitems.indexOf(e.target);\n\n if (keyCodes.up === e.which || keyCodes.p === e.which && e.ctrlKey) {\n index = index !== 0 ? index - 1 : $menuitems.length - 1;\n } else if (keyCodes.down === e.which || keyCodes.n === e.which && e.ctrlKey) {\n index = index === $menuitems.length - 1 ? 0 : index + 1;\n }\n\n $menuitems[index].focus();\n } else if (keyCodes.end === e.which) {\n var _$menuitems = this.getMenuItems();\n\n _$menuitems[_$menuitems.length - 1].focus();\n } else if (keyCodes.home === e.which) {\n var _$menuitems2 = this.getMenuItems();\n\n _$menuitems2[0].focus();\n } else if (e.which >= 48 && e.which <= 90) {\n var _$menuitems3 = this.getMenuItems();\n\n var charPressed = String.fromCharCode(e.which).toLowerCase();\n\n for (var i = 0; i < _$menuitems3.length; i += 1) {\n var firstLetter = _$menuitems3[i].textContent && _$menuitems3[i].textContent[0].toLowerCase();\n\n if (firstLetter === charPressed) {\n _$menuitems3[i].focus();\n\n break;\n }\n }\n }\n }\n };\n\n _proto.handleProps = function handleProps() {\n if (this.props.isOpen) {\n this.addEvents();\n } else {\n this.removeEvents();\n }\n };\n\n _proto.toggle = function toggle(e) {\n if (this.props.disabled) {\n return e && e.preventDefault();\n }\n\n return this.props.toggle(e);\n };\n\n _proto.render = function render() {\n var _classNames, _ref;\n\n var _omit = omit(this.props, ['toggle', 'disabled', 'inNavbar', 'a11y']),\n className = _omit.className,\n cssModule = _omit.cssModule,\n direction = _omit.direction,\n isOpen = _omit.isOpen,\n group = _omit.group,\n size = _omit.size,\n nav = _omit.nav,\n setActiveFromChild = _omit.setActiveFromChild,\n active = _omit.active,\n addonType = _omit.addonType,\n tag = _omit.tag,\n attrs = _objectWithoutPropertiesLoose(_omit, [\"className\", \"cssModule\", \"direction\", \"isOpen\", \"group\", \"size\", \"nav\", \"setActiveFromChild\", \"active\", \"addonType\", \"tag\"]);\n\n var Tag = tag || (nav ? 'li' : 'div');\n var subItemIsActive = false;\n\n if (setActiveFromChild) {\n React.Children.map(this.props.children[1].props.children, function (dropdownItem) {\n if (dropdownItem && dropdownItem.props.active) subItemIsActive = true;\n });\n }\n\n var classes = mapToCssModules(classNames(className, direction !== 'down' && \"drop\" + direction, nav && active ? 'active' : false, setActiveFromChild && subItemIsActive ? 'active' : false, (_classNames = {}, _classNames[\"input-group-\" + addonType] = addonType, _classNames['btn-group'] = group, _classNames[\"btn-group-\" + size] = !!size, _classNames.dropdown = !group && !addonType, _classNames.show = isOpen, _classNames['nav-item'] = nav, _classNames)), cssModule);\n return /*#__PURE__*/React.createElement(DropdownContext.Provider, {\n value: this.getContextValue()\n }, /*#__PURE__*/React.createElement(Manager, null, /*#__PURE__*/React.createElement(Tag, _extends({}, attrs, (_ref = {}, _ref[typeof Tag === 'string' ? 'ref' : 'innerRef'] = this.containerRef, _ref), {\n onKeyDown: this.handleKeyDown,\n className: classes\n }))));\n };\n\n return Dropdown;\n}(React.Component);\n\nDropdown.propTypes = propTypes;\nDropdown.defaultProps = defaultProps;\nexport default Dropdown;","map":{"version":3,"sources":["/app/node_modules/reactstrap/es/Dropdown.js"],"names":["_extends","_objectWithoutPropertiesLoose","_assertThisInitialized","_inheritsLoose","React","PropTypes","Manager","classNames","DropdownContext","mapToCssModules","omit","keyCodes","tagPropType","propTypes","a11y","bool","disabled","direction","oneOf","group","isOpen","nav","active","addonType","oneOfType","size","string","tag","toggle","func","children","node","className","cssModule","object","inNavbar","setActiveFromChild","defaultProps","preventDefaultKeys","space","enter","up","down","end","home","Dropdown","_React$Component","props","_this","call","addEvents","bind","handleDocumentClick","handleKeyDown","removeEvents","handleMenuRef","containerRef","createRef","menuRef","_proto","prototype","current","getContextValue","dropup","onMenuRef","componentDidMount","handleProps","componentDidUpdate","prevProps","componentWillUnmount","getContainer","getMenu","getMenuCtrl","_$menuCtrl","querySelector","getMenuItems","menuContainer","slice","querySelectorAll","_this2","forEach","event","document","addEventListener","_this3","removeEventListener","e","which","type","tab","container","menu","clickIsInContainer","contains","target","clickIsInMenu","_this4","isTargetMenuItem","getAttribute","isTargetMenuCtrl","isTab","test","tagName","indexOf","preventDefault","setTimeout","focus","esc","click","n","p","ctrlKey","$menuitems","index","length","_$menuitems","_$menuitems2","_$menuitems3","charPressed","String","fromCharCode","toLowerCase","i","firstLetter","textContent","render","_classNames","_ref","_omit","attrs","Tag","subItemIsActive","Children","map","dropdownItem","classes","dropdown","show","createElement","Provider","value","onKeyDown","Component"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,oCAArB;AACA,OAAOC,6BAAP,MAA0C,yDAA1C;AACA,OAAOC,sBAAP,MAAmC,kDAAnC;AACA,OAAOC,cAAP,MAA2B,0CAA3B;AAEA;AACA;;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,OAAT,QAAwB,cAAxB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,eAAT,EAA0BC,IAA1B,EAAgCC,QAAhC,EAA0CC,WAA1C,QAA6D,SAA7D;AACA,IAAIC,SAAS,GAAG;AACdC,EAAAA,IAAI,EAAET,SAAS,CAACU,IADF;AAEdC,EAAAA,QAAQ,EAAEX,SAAS,CAACU,IAFN;AAGdE,EAAAA,SAAS,EAAEZ,SAAS,CAACa,KAAV,CAAgB,CAAC,IAAD,EAAO,MAAP,EAAe,MAAf,EAAuB,OAAvB,CAAhB,CAHG;AAIdC,EAAAA,KAAK,EAAEd,SAAS,CAACU,IAJH;AAKdK,EAAAA,MAAM,EAAEf,SAAS,CAACU,IALJ;AAMdM,EAA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N,CAAoBlI,eAAe,CAACmI,QAApC,EAA8C;AAChEC,MAAAA,KAAK,EAAE,KAAK9E,eAAL;AADyD,KAA9C,EAEjB,aAAa1D,KAAK,CAACsI,aAAN,CAAoBpI,OAApB,EAA6B,IAA7B,EAAmC,aAAaF,KAAK,CAACsI,aAAN,CAAoBR,GAApB,EAAyBlI,QAAQ,CAAC,EAAD,EAAKiI,KAAL,GAAaF,IAAI,GAAG,EAAP,EAAWA,IAAI,CAAC,OAAOG,GAAP,KAAe,QAAf,GAA0B,KAA1B,GAAkC,UAAnC,CAAJ,GAAqD,KAAK1E,YAArE,EAAmFuE,IAAhG,GAAuG;AACtMc,MAAAA,SAAS,EAAE,KAAKxF,aADsL;AAEtMrB,MAAAA,SAAS,EAAEuG;AAF2L,KAAvG,CAAjC,CAAhD,CAFI,CAApB;AAMD,GAjCD;;AAmCA,SAAO1F,QAAP;AACD,CA7O2B,CA6O1BzC,KAAK,CAAC0I,SA7OoB,CAA5B;;AA+OAjG,QAAQ,CAAChC,SAAT,GAAqBA,SAArB;AACAgC,QAAQ,CAACR,YAAT,GAAwBA,YAAxB;AACA,eAAeQ,QAAf","sourcesContent":["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\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\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.getContainer()` as the fallback `menuContainer`.\n var menuContainer = this.getMenu() || this.getContainer();\n return [].slice.call(menuContainer.querySelectorAll('[role=\"menuitem\"]'));\n };\n\n _proto.addEvents = function addEvents() {\n var _this2 = this;\n\n ['click', 'touchstart', 'keyup'].forEach(function (event) {\n return document.addEventListener(event, _this2.handleDocumentClick, true);\n });\n };\n\n _proto.removeEvents = function removeEvents() {\n var _this3 = this;\n\n ['click', 'touchstart', 'keyup'].forEach(function (event) {\n return document.removeEventListener(event, _this3.handleDocumentClick, true);\n });\n };\n\n _proto.handleDocumentClick = function handleDocumentClick(e) {\n if (e && (e.which === 3 || e.type === 'keyup' && e.which !== keyCodes.tab)) return;\n var container = this.getContainer();\n var menu = this.getMenu();\n var clickIsInContainer = container.contains(e.target) && container !== e.target;\n var clickIsInMenu = menu && menu.contains(e.target) && menu !== e.target;\n\n if ((clickIsInContainer || clickIsInMenu) && (e.type !== 'keyup' || e.which === keyCodes.tab)) {\n return;\n }\n\n this.toggle(e);\n };\n\n _proto.handleKeyDown = function handleKeyDown(e) {\n var _this4 = this;\n\n var isTargetMenuItem = e.target.getAttribute('role') === 'menuitem';\n var isTargetMenuCtrl = this.getMenuCtrl() === e.target;\n var isTab = keyCodes.tab === e.which;\n\n if (/input|textarea/i.test(e.target.tagName) || isTab && !this.props.a11y || isTab && !(isTargetMenuItem || isTargetMenuCtrl)) {\n return;\n }\n\n if (preventDefaultKeys.indexOf(e.which) !== -1 || e.which >= 48 && e.which <= 90) {\n e.preventDefault();\n }\n\n if (this.props.disabled) return;\n\n if (isTargetMenuCtrl) {\n if ([keyCodes.space, keyCodes.enter, keyCodes.up, keyCodes.down].indexOf(e.which) > -1) {\n // Open the menu (if not open) and focus the first menu item\n if (!this.props.isOpen) {\n this.toggle(e);\n }\n\n setTimeout(function () {\n return _this4.getMenuItems()[0].focus();\n });\n } else if (this.props.isOpen && isTab) {\n // Focus the first menu item if tabbing from an open menu. We need this\n // for cases where the DropdownMenu sets a custom container, which may\n // not be the natural next item to tab to from the DropdownToggle.\n e.preventDefault();\n this.getMenuItems()[0].focus();\n } else if (this.props.isOpen && e.which === keyCodes.esc) {\n this.toggle(e);\n }\n }\n\n if (this.props.isOpen && e.target.getAttribute('role') === 'menuitem') {\n if ([keyCodes.tab, keyCodes.esc].indexOf(e.which) > -1) {\n this.toggle(e);\n this.getMenuCtrl().focus();\n } else if ([keyCodes.space, keyCodes.enter].indexOf(e.which) > -1) {\n e.target.click();\n this.getMenuCtrl().focus();\n } else if ([keyCodes.down, keyCodes.up].indexOf(e.which) > -1 || [keyCodes.n, keyCodes.p].indexOf(e.which) > -1 && e.ctrlKey) {\n var $menuitems = this.getMenuItems();\n var index = $menuitems.indexOf(e.target);\n\n if (keyCodes.up === e.which || keyCodes.p === e.which && e.ctrlKey) {\n index = index !== 0 ? index - 1 : $menuitems.length - 1;\n } else if (keyCodes.down === e.which || keyCodes.n === e.which && e.ctrlKey) {\n index = index === $menuitems.length - 1 ? 0 : index + 1;\n }\n\n $menuitems[index].focus();\n } else if (keyCodes.end === e.which) {\n var _$menuitems = this.getMenuItems();\n\n _$menuitems[_$menuitems.length - 1].focus();\n } else if (keyCodes.home === e.which) {\n var _$menuitems2 = this.getMenuItems();\n\n _$menuitems2[0].focus();\n } else if (e.which >= 48 && e.which <= 90) {\n var _$menuitems3 = this.getMenuItems();\n\n var charPressed = String.fromCharCode(e.which).toLowerCase();\n\n for (var i = 0; i < _$menuitems3.length; i += 1) {\n var firstLetter = _$menuitems3[i].textContent && _$menuitems3[i].textContent[0].toLowerCase();\n\n if (firstLetter === charPressed) {\n _$menuitems3[i].focus();\n\n break;\n }\n }\n }\n }\n };\n\n _proto.handleProps = function handleProps() {\n if (this.props.isOpen) {\n this.addEvents();\n } else {\n this.removeEvents();\n }\n };\n\n _proto.toggle = function toggle(e) {\n if (this.props.disabled) {\n return e && e.preventDefault();\n }\n\n return this.props.toggle(e);\n };\n\n _proto.render = function render() {\n var _classNames, _ref;\n\n var _omit = omit(this.props, ['toggle', 'disabled', 'inNavbar', 'a11y']),\n className = _omit.className,\n cssModule = _omit.cssModule,\n direction = _omit.direction,\n isOpen = _omit.isOpen,\n group = _omit.group,\n size = _omit.size,\n nav = _omit.nav,\n setActiveFromChild = _omit.setActiveFromChild,\n active = _omit.active,\n addonType = _omit.addonType,\n tag = _omit.tag,\n attrs = _objectWithoutPropertiesLoose(_omit, [\"className\", \"cssModule\", \"direction\", \"isOpen\", \"group\", \"size\", \"nav\", \"setActiveFromChild\", \"active\", \"addonType\", \"tag\"]);\n\n var Tag = tag || (nav ? 'li' : 'div');\n var subItemIsActive = false;\n\n if (setActiveFromChild) {\n React.Children.map(this.props.children[1].props.children, function (dropdownItem) {\n if (dropdownItem && dropdownItem.props.active) subItemIsActive = true;\n });\n }\n\n var classes = mapToCssModules(classNames(className, direction !== 'down' && \"drop\" + direction, nav && active ? 'active' : false, setActiveFromChild && subItemIsActive ? 'active' : false, (_classNames = {}, _classNames[\"input-group-\" + addonType] = addonType, _classNames['btn-group'] = group, _classNames[\"btn-group-\" + size] = !!size, _classNames.dropdown = !group && !addonType, _classNames.show = isOpen, _classNames['nav-item'] = nav, _classNames)), cssModule);\n return /*#__PURE__*/React.createElement(DropdownContext.Provider, {\n value: this.getContextValue()\n }, /*#__PURE__*/React.createElement(Manager, null, /*#__PURE__*/React.createElement(Tag, _extends({}, attrs, (_ref = {}, _ref[typeof Tag === 'string' ? 'ref' : 'innerRef'] = this.containerRef, _ref), {\n onKeyDown: this.handleKeyDown,\n className: classes\n }))));\n };\n\n return Dropdown;\n}(React.Component);\n\nDropdown.propTypes = propTypes;\nDropdown.defaultProps = defaultProps;\nexport default Dropdown;"]},"metadata":{},"sourceType":"module"} |