UNPKG

uppy

Version:

Extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:

62 lines (48 loc) 2.18 kB
"use strict"; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var _require = require('preact'), h = _require.h, Component = _require.Component; var UrlUI = function (_Component) { _inherits(UrlUI, _Component); function UrlUI(props) { _classCallCheck(this, UrlUI); var _this = _possibleConstructorReturn(this, _Component.call(this, props)); _this.handleClick = _this.handleClick.bind(_this); return _this; } UrlUI.prototype.componentDidMount = function componentDidMount() { this.input.focus(); }; UrlUI.prototype.handleClick = function handleClick() { this.props.addFile(this.input.value); }; UrlUI.prototype.render = function render() { var _this2 = this; return h( "div", { "class": "uppy-Url" }, h("input", { "class": "uppy-Url-input", type: "text", placeholder: this.props.i18n('enterUrlToImport'), ref: function ref(input) { _this2.input = input; } }), h( "button", { "class": "uppy-Url-importButton", type: "button", "aria-label": this.props.i18n('addUrl'), onclick: this.handleClick }, this.props.i18n('import') ) ); }; return UrlUI; }(Component); module.exports = UrlUI; //# sourceMappingURL=UrlUI.js.map