mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-23 00:45:16 +00:00
1 line
12 KiB
JSON
1 line
12 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\";\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { Reference } from 'react-popper';\nimport { DropdownContext } from './DropdownContext';\nimport { mapToCssModules, tagPropType } from './utils';\nimport Button from './Button';\nvar propTypes = {\n caret: PropTypes.bool,\n color: PropTypes.string,\n children: PropTypes.node,\n className: PropTypes.string,\n cssModule: PropTypes.object,\n disabled: PropTypes.bool,\n onClick: PropTypes.func,\n 'aria-haspopup': PropTypes.bool,\n split: PropTypes.bool,\n tag: tagPropType,\n nav: PropTypes.bool\n};\nvar defaultProps = {\n 'aria-haspopup': true,\n color: 'secondary'\n};\n\nvar DropdownToggle = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(DropdownToggle, _React$Component);\n\n function DropdownToggle(props) {\n var _this;\n\n _this = _React$Component.call(this, props) || this;\n _this.onClick = _this.onClick.bind(_assertThisInitialized(_this));\n return _this;\n }\n\n var _proto = DropdownToggle.prototype;\n\n _proto.onClick = function onClick(e) {\n if (this.props.disabled || this.context.disabled) {\n e.preventDefault();\n return;\n }\n\n if (this.props.nav && !this.props.tag) {\n e.preventDefault();\n }\n\n if (this.props.onClick) {\n this.props.onClick(e);\n }\n\n this.context.toggle(e);\n };\n\n _proto.render = function render() {\n var _this2 = this;\n\n var _this$props = this.props,\n className = _this$props.className,\n color = _this$props.color,\n cssModule = _this$props.cssModule,\n caret = _this$props.caret,\n split = _this$props.split,\n nav = _this$props.nav,\n tag = _this$props.tag,\n innerRef = _this$props.innerRef,\n props = _objectWithoutPropertiesLoose(_this$props, [\"className\", \"color\", \"cssModule\", \"caret\", \"split\", \"nav\", \"tag\", \"innerRef\"]);\n\n var ariaLabel = props['aria-label'] || 'Toggle Dropdown';\n var classes = mapToCssModules(classNames(className, {\n 'dropdown-toggle': caret || split,\n 'dropdown-toggle-split': split,\n 'nav-link': nav\n }), cssModule);\n var children = typeof props.children !== 'undefined' ? props.children : /*#__PURE__*/React.createElement(\"span\", {\n className: \"sr-only\"\n }, ariaLabel);\n var Tag;\n\n if (nav && !tag) {\n Tag = 'a';\n props.href = '#';\n } else if (!tag) {\n Tag = Button;\n props.color = color;\n props.cssModule = cssModule;\n } else {\n Tag = tag;\n }\n\n if (this.context.inNavbar) {\n return /*#__PURE__*/React.createElement(Tag, _extends({}, props, {\n className: classes,\n onClick: this.onClick,\n \"aria-expanded\": this.context.isOpen,\n children: children\n }));\n }\n\n return /*#__PURE__*/React.createElement(Reference, {\n innerRef: innerRef\n }, function (_ref) {\n var _ref2;\n\n var ref = _ref.ref;\n return /*#__PURE__*/React.createElement(Tag, _extends({}, props, (_ref2 = {}, _ref2[typeof Tag === 'string' ? 'ref' : 'innerRef'] = ref, _ref2), {\n className: classes,\n onClick: _this2.onClick,\n \"aria-expanded\": _this2.context.isOpen,\n children: children\n }));\n });\n };\n\n return DropdownToggle;\n}(React.Component);\n\nDropdownToggle.propTypes = propTypes;\nDropdownToggle.defaultProps = defaultProps;\nDropdownToggle.contextType = DropdownContext;\nexport default DropdownToggle;","map":{"version":3,"sources":["/app/node_modules/reactstrap/es/DropdownToggle.js"],"names":["_extends","_objectWithoutPropertiesLoose","_assertThisInitialized",
|