mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
1 line
14 KiB
JSON
1 line
14 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/prefer-stateless-function: 0 */\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { mapToCssModules, warnOnce, tagPropType } from './utils';\nvar propTypes = {\n children: PropTypes.node,\n type: PropTypes.string,\n size: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n bsSize: PropTypes.string,\n valid: PropTypes.bool,\n invalid: PropTypes.bool,\n tag: tagPropType,\n innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),\n plaintext: PropTypes.bool,\n addon: PropTypes.bool,\n className: PropTypes.string,\n cssModule: PropTypes.object\n};\nvar defaultProps = {\n type: 'text'\n};\n\nvar Input = /*#__PURE__*/function (_React$Component) {\n _inheritsLoose(Input, _React$Component);\n\n function Input(props) {\n var _this;\n\n _this = _React$Component.call(this, props) || this;\n _this.getRef = _this.getRef.bind(_assertThisInitialized(_this));\n _this.focus = _this.focus.bind(_assertThisInitialized(_this));\n return _this;\n }\n\n var _proto = Input.prototype;\n\n _proto.getRef = function getRef(ref) {\n if (this.props.innerRef) {\n this.props.innerRef(ref);\n }\n\n this.ref = ref;\n };\n\n _proto.focus = function focus() {\n if (this.ref) {\n this.ref.focus();\n }\n };\n\n _proto.render = function render() {\n var _this$props = this.props,\n className = _this$props.className,\n cssModule = _this$props.cssModule,\n type = _this$props.type,\n bsSize = _this$props.bsSize,\n valid = _this$props.valid,\n invalid = _this$props.invalid,\n tag = _this$props.tag,\n addon = _this$props.addon,\n plaintext = _this$props.plaintext,\n innerRef = _this$props.innerRef,\n attributes = _objectWithoutPropertiesLoose(_this$props, [\"className\", \"cssModule\", \"type\", \"bsSize\", \"valid\", \"invalid\", \"tag\", \"addon\", \"plaintext\", \"innerRef\"]);\n\n var checkInput = ['radio', 'checkbox'].indexOf(type) > -1;\n var isNotaNumber = new RegExp('\\\\D', 'g');\n var fileInput = type === 'file';\n var textareaInput = type === 'textarea';\n var selectInput = type === 'select';\n var rangeInput = type === 'range';\n var Tag = tag || (selectInput || textareaInput ? type : 'input');\n var formControlClass = 'form-control';\n\n if (plaintext) {\n formControlClass = formControlClass + \"-plaintext\";\n Tag = tag || 'input';\n } else if (fileInput) {\n formControlClass = formControlClass + \"-file\";\n } else if (rangeInput) {\n formControlClass = formControlClass + \"-range\";\n } else if (checkInput) {\n if (addon) {\n formControlClass = null;\n } else {\n formControlClass = 'form-check-input';\n }\n }\n\n if (attributes.size && isNotaNumber.test(attributes.size)) {\n warnOnce('Please use the prop \"bsSize\" instead of the \"size\" to bootstrap\\'s input sizing.');\n bsSize = attributes.size;\n delete attributes.size;\n }\n\n var classes = mapToCssModules(classNames(className, invalid && 'is-invalid', valid && 'is-valid', bsSize ? \"form-control-\" + bsSize : false, formControlClass), cssModule);\n\n if (Tag === 'input' || tag && typeof tag === 'function') {\n attributes.type = type;\n }\n\n if (attributes.children && !(plaintext || type === 'select' || typeof Tag !== 'string' || Tag === 'select')) {\n warnOnce(\"Input with a type of \\\"\" + type + \"\\\" cannot have children. Please use \\\"value\\\"/\\\"defaultValue\\\" instead.\");\n delete attributes.children;\n }\n\n return /*#__PURE__*/React.createE
|