'use strict';

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

var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');

var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

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 }; }

var StyledDiv = _styledComponents2.default.div.withConfig({
  displayName: 'DragList__StyledDiv'
})(['& > * + *{margin-top:', ';}'], (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) {
  (0, _inherits3.default)(DragList, _React$PureComponent);

  function DragList() {
    (0, _classCallCheck3.default)(this, DragList);
    return (0, _possibleConstructorReturn3.default)(this, (DragList.__proto__ || (0, _getPrototypeOf2.default)(DragList)).apply(this, arguments));
  }

  (0, _createClass3.default)(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;