import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
import _get from "lodash/get";
import React from "react";
import Element from "../../../components/Element";
import styled from "styled-components";
import { Col } from '@whalecloud/fdx';
import { alignMap } from "./util";
var OuterDiv = /*#__PURE__*/React.memo( /*#__PURE__*/styled(Col, {
  target: "e1btxpzz0",
  label: "OuterDiv"
})(function (_ref) {
  var direction = _ref.direction,
      type = _ref.type,
      align = _ref.align,
      labelWidth = _ref.labelWidth;
  var style = {};

  if (direction === 'vertical' && type.indexOf('button') > -1) {
    if (align === 'form') {
      style.marginLeft = labelWidth;
      style.alignSelf = 'baseline';
    } else {
      style.alignSelf = alignMap[align];
    }
  }

  return _objectSpread({}, style);
}));

var ColumnChild = function ColumnChild(_ref2) {
  var element = _ref2.element,
      labelWidth = _ref2.labelWidth,
      direction = _ref2.direction,
      align = _ref2.align,
      restProps = _objectWithoutProperties(_ref2, ["element", "labelWidth", "direction", "align"]);

  var cols = _get(element.data, "settings.cols") || {
    span: 24,
    offset: 0
  };
  var colProps = element.type.indexOf('button') > -1 ? {} : cols;
  var containerProps = {
    type: element.type,
    direction: direction
  };

  if (element.type.indexOf('button') > -1) {
    containerProps.align = align;
    containerProps.labelWidth = labelWidth;
  }

  return /*#__PURE__*/React.createElement(OuterDiv, Object.assign({}, containerProps, colProps), /*#__PURE__*/React.createElement(Element, Object.assign({
    element: element
  }, restProps)));
};

export default ColumnChild;
//# sourceMappingURL=ColumnChild.js.map