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:

72 lines (59 loc) 2.99 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; module.exports = function (_Component) { _inherits(Filter, _Component); function Filter(props) { _classCallCheck(this, Filter); var _this = _possibleConstructorReturn(this, _Component.call(this, props)); _this.handleKeyPress = _this.handleKeyPress.bind(_this); return _this; } Filter.prototype.componentDidMount = function componentDidMount() { this.input.focus(); }; Filter.prototype.handleKeyPress = function handleKeyPress(ev) { if (ev.keyCode === 13) { ev.stopPropagation(); ev.preventDefault(); return; } this.props.filterQuery(ev); }; Filter.prototype.render = function render() { var _this2 = this; return h( 'div', { style: { display: 'flex', width: '100%' } }, h('input', { 'class': 'uppy-ProviderBrowser-searchInput', type: 'text', placeholder: 'Search', onkeyup: this.handleKeyPress, onkeydown: this.handleKeyPress, onkeypress: this.handleKeyPress, value: this.props.filterInput, ref: function ref(input) { _this2.input = input; } }), h( 'button', { 'class': 'uppy-ProviderBrowser-searchClose', type: 'button', onclick: this.props.toggleSearch }, h( 'svg', { 'class': 'UppyIcon', viewBox: '0 0 19 19' }, h('path', { d: 'M17.318 17.232L9.94 9.854 9.586 9.5l-.354.354-7.378 7.378h.707l-.62-.62v.706L9.318 9.94l.354-.354-.354-.354L1.94 1.854v.707l.62-.62h-.706l7.378 7.378.354.354.354-.354 7.378-7.378h-.707l.622.62v-.706L9.854 9.232l-.354.354.354.354 7.378 7.378.708-.707-7.38-7.378v.708l7.38-7.38.353-.353-.353-.353-.622-.622-.353-.353-.354.352-7.378 7.38h.708L2.56 1.23 2.208.88l-.353.353-.622.62-.353.355.352.353 7.38 7.38v-.708l-7.38 7.38-.353.353.352.353.622.622.353.353.354-.353 7.38-7.38h-.708l7.38 7.38z' }) ) ) ); }; return Filter; }(Component); //# sourceMappingURL=Filter.js.map