"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.default = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));

var _react = _interopRequireDefault(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _mapResponsiveProperty = _interopRequireDefault(require("../utils/mapResponsiveProperty"));

var Types = _interopRequireWildcard(require("../types"));

var _Box = _interopRequireDefault(require("../Box"));

var spanToWidth = function spanToWidth(maxColumns) {
  return function (columnSpan) {
    return columnSpan / maxColumns;
  };
}; // TODO: maxColumns and gutters theamable


var Col = function Col(_ref) {
  var span = _ref.span,
      _ref$maxColumns = _ref.maxColumns,
      maxColumns = _ref$maxColumns === void 0 ? 12 : _ref$maxColumns,
      rest = (0, _objectWithoutPropertiesLoose2.default)(_ref, ["span", "maxColumns"]);
  return _react.default.createElement(_Box.default, (0, _extends2.default)({
    px: 2,
    width: (0, _mapResponsiveProperty.default)(spanToWidth(maxColumns), span)
  }, rest));
};

Col.propTypes = {
  maxColumns: _propTypes.default.number,
  span: Types.responsiveNumber
};
var _default = Col;
exports.default = _default;