mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +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 { DropdownContext } from './DropdownContext';\nimport { mapToCssModules, omit, tagPropType } from './utils';\nvar propTypes = {\n children: PropTypes.node,\n active: PropTypes.bool,\n disabled: PropTypes.bool,\n divider: PropTypes.bool,\n tag: tagPropType,\n header: PropTypes.bool,\n onClick: PropTypes.func,\n className: PropTypes.string,\n cssModule: PropTypes.object,\n toggle: PropTypes.bool,\n text: PropTypes.bool\n};\nvar defaultProps = {\n tag: 'button',\n toggle: true\n};\n\nvar DropdownItem = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(DropdownItem, _React$Component);\n\n function DropdownItem(props) {\n var _this;\n\n _this = _React$Component.call(this, props) || this;\n _this.onClick = _this.onClick.bind(_assertThisInitialized(_this));\n _this.getTabIndex = _this.getTabIndex.bind(_assertThisInitialized(_this));\n return _this;\n }\n\n var _proto = DropdownItem.prototype;\n\n _proto.onClick = function onClick(e) {\n var _this$props = this.props,\n disabled = _this$props.disabled,\n header = _this$props.header,\n divider = _this$props.divider,\n text = _this$props.text;\n\n if (disabled || header || divider || text) {\n e.preventDefault();\n return;\n }\n\n if (this.props.onClick) {\n this.props.onClick(e);\n }\n\n if (this.props.toggle) {\n this.context.toggle(e);\n }\n };\n\n _proto.getTabIndex = function getTabIndex() {\n var _this$props2 = this.props,\n disabled = _this$props2.disabled,\n header = _this$props2.header,\n divider = _this$props2.divider,\n text = _this$props2.text;\n\n if (disabled || header || divider || text) {\n return '-1';\n }\n\n return '0';\n };\n\n _proto.render = function render() {\n var tabIndex = this.getTabIndex();\n var role = tabIndex > -1 ? 'menuitem' : undefined;\n\n var _omit = omit(this.props, ['toggle']),\n className = _omit.className,\n cssModule = _omit.cssModule,\n divider = _omit.divider,\n Tag = _omit.tag,\n header = _omit.header,\n active = _omit.active,\n text = _omit.text,\n props = _objectWithoutPropertiesLoose(_omit, [\"className\", \"cssModule\", \"divider\", \"tag\", \"header\", \"active\", \"text\"]);\n\n var classes = mapToCssModules(classNames(className, {\n disabled: props.disabled,\n 'dropdown-item': !divider && !header && !text,\n active: active,\n 'dropdown-header': header,\n 'dropdown-divider': divider,\n 'dropdown-item-text': text\n }), cssModule);\n\n if (Tag === 'button') {\n if (header) {\n Tag = 'h6';\n } else if (divider) {\n Tag = 'div';\n } else if (props.href) {\n Tag = 'a';\n } else if (text) {\n Tag = 'span';\n }\n }\n\n return /*#__PURE__*/React.createElement(Tag, _extends({\n type: Tag === 'button' && (props.onClick || this.props.toggle) ? 'button' : undefined\n }, props, {\n tabIndex: tabIndex,\n role: role,\n className: classes,\n onClick: this.onClick\n }));\n };\n\n return DropdownItem;\n}(React.Component);\n\nDropdownItem.propTypes = propTypes;\nDropdownItem.defaultProps = defaultProps;\nDropdownItem.contextType = DropdownContext;\nexport default DropdownItem;","map":{"version":3,"sources":["/app/node_modules/reactstrap/es/DropdownItem.js"],"names":["_extends","_objectWithoutPropertiesLoose","_assertThisInitialized","_inheritsLoose","React","PropTypes","classNames","DropdownContext","mapToCssModules","omit","tagPropType","propTypes
|