'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; }; }();

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _themeGet = require('../../extensions/themeGet');

var _themeGet2 = _interopRequireDefault(_themeGet);

var _styledComponents = require('styled-components');

var _styledComponents2 = _interopRequireDefault(_styledComponents);

var _DragListItem = require('./DragListItem');

var _DragListItem2 = _interopRequireDefault(_DragListItem);

var _DragContainer = require('../DragContainer');

var _DragContainer2 = _interopRequireDefault(_DragContainer);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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 StyledDiv = _styledComponents2.default.div.withConfig({
  displayName: 'DragList__StyledDiv'
})(['& > *{margin-bottom:', ';}'], (0, _themeGet2.default)('spacing.medium'));

/**
 * A list of items that can be dragged and reordered.
 * Use a list of [DragList.Item](/#!/DragListItem) as children.
 * [DragList.Container](/#!/DragContainer) is provided
 * as a convenient way to display items in the drag list.
 */

var DragList = function (_React$PureComponent) {
  _inherits(DragList, _React$PureComponent);

  function DragList() {
    _classCallCheck(this, DragList);

    return _possibleConstructorReturn(this, (DragList.__proto__ || Object.getPrototypeOf(DragList)).apply(this, arguments));
  }

  _createClass(DragList, [{
    key: 'render',
    value: function render() {
      return _react2.default.createElement(
        StyledDiv,
        null,
        this.props.children
      );
    }
  }]);

  return DragList;
}(_react2.default.PureComponent);

DragList.Item = _DragListItem2.default;
DragList.Container = _DragContainer2.default;
DragList.propTypes = {
  children: _propTypes2.default.node.isRequired
};
exports.default = DragList;