(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
'use strict';

var _upload = require('./upload');

// initialize all elements
var componentsList = document.querySelectorAll(_upload.Upload.getSelector()); // Import all components

for (var i = 0; i < componentsList.length; i++) {
	new _upload.Upload(componentsList[i]);
}
},{"./upload":2}],2:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
	value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 * upload.js
 * helper for file uploads
 */

/**
* Declare constants
*/
var attributeBase = 'data-rs-upload';

var Upload = exports.Upload = function () {
	function Upload(element) {
		_classCallCheck(this, Upload);

		this.element = element;
		this.addEventHandlers();
	}

	/**
 * Declare classes
 */


	_createClass(Upload, [{
		key: 'addEventHandlers',


		/**
   * Add event handlers
   */
		value: function addEventHandlers() {
			var _this = this;

			this.element.addEventListener('dragover', function (event) {
				// prevent default to allow drop
				event.preventDefault();
				_this.setReadyForDrop();
			}, false);

			this.element.addEventListener('dragleave', function () {
				_this.idle();
			}, false);

			this.element.addEventListener('drop', function () {
				_this.idle();
			}, false);
		}

		/**
   * Highlight input to 'drop files'
   */

	}, {
		key: 'setReadyForDrop',
		value: function setReadyForDrop() {
			this.element.classList.add(this.classes.dragOver);
		}

		/**
   * Back to default state
   */

	}, {
		key: 'idle',
		value: function idle() {
			this.element.classList.remove(this.classes.dragOver);
		}

		/**
   * Get selector
   */

	}, {
		key: 'classes',
		get: function get() {
			return {
				dragOver: 'upload--drag-over'
			};
		}
	}], [{
		key: 'getSelector',
		value: function getSelector() {
			return '[' + attributeBase + ']';
		}
	}]);

	return Upload;
}();
},{}]},{},[1]);
