"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _lodash = require("lodash");

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

var _native = _interopRequireDefault(require("styled-components/native"));

var _styledSystem = require("styled-system");

var _customProps = require("../../../utils/customProps");

var _theme = require("../../../theme");

var _primitives = require("../../primitives");

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

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

const StyledWrap = (0, _native.default)(_primitives.Box)(_styledSystem.color, _styledSystem.space, _styledSystem.layout, _styledSystem.flexbox, _styledSystem.border, _customProps.customBorder, _customProps.customBackground, _customProps.customOutline, _customProps.customShadow, _customProps.customExtra, _customProps.customLayout, _customProps.customFlexBox);

const Wrap = ({
  style,
  spacing,
  children,
  direction,
  align,
  justify,
  grow,
  basis,
  ...props
}) => {
  let newProps = (0, _theme.usePropsConfig)('Wrap', props);
  return /*#__PURE__*/_react.default.createElement(StyledWrap, _extends({}, newProps, {
    flexDirection: direction,
    alignItems: align,
    justifyContent: justify,
    flexGrow: grow,
    flexBasis: basis,
    style: style
  }), (0, _lodash.isNil)(spacing) ? children : _react.default.Children.map(children, child => {
    return /*#__PURE__*/_react.default.cloneElement(child, { ...props,
      style: {
        margin: spacing
      }
    }, child.props.children);
  }));
};

var _default = Wrap;
exports.default = _default;
//# sourceMappingURL=index.js.map