'use strict';

var React = require('react');
var classnames = require('classnames');

var styles = {"vertical":"RwhScbXCXw0-","horizontal":"xxMbKnv30VQ-","inputGroup":"l87dJm2JnlA-","spinning":"XZBCtuO467Y-"};

function InputGroup({ children, flowDirection = "vertical", }) {
    if (isInvalidGroupNesting(children))
        return React.createElement(React.Fragment, null);
    const className = classnames(styles.inputGroup, styles[flowDirection]);
    return React.createElement("div", { className: className }, children);
}
function isInputGroupElement(node) {
    return React.isValidElement(node) && node.type === InputGroup;
}
function isInvalidGroupNesting(childs) {
    return React.Children.toArray(childs).some(child => {
        if (isInputGroupElement(child) &&
            child.props.flowDirection !== "horizontal") {
            console.error(`ERROR: InputGroup not rendered: nesting 'flowDirection="vertical"' columns not supported.`, `https://atlantis.getjobber.com/?path=/story/components-forms-and-inputs-inputgroup-web--nested`);
            return true;
        }
        return false;
    });
}

exports.InputGroup = InputGroup;
