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

import { Box } from '..';
import React from 'react';
import { getAttachedChildren } from '../../../utils';
import Flex from '../Flex';
const addonsDefaultStyle = {
  p: 3,
  borderColor: 'gray.300',
  borderWidth: 1
};
export const InputLeftAddon = props => {
  return /*#__PURE__*/React.createElement(Box, _extends({}, addonsDefaultStyle, {
    borderRightWidth: 0,
    roundedLeft: 4,
    bg: "gray.200"
  }, props), /*#__PURE__*/React.createElement(Box, {
    m: "auto"
  }, props.children));
};
export const InputRightAddon = props => {
  return /*#__PURE__*/React.createElement(Box, _extends({}, addonsDefaultStyle, {
    borderLeftWidth: 0,
    roundedRight: 4,
    bg: "gray.200"
  }, props), /*#__PURE__*/React.createElement(Box, {
    m: "auto"
  }, props.children));
};

const supplyPropsToChildren = (children, props) => {
  return React.Children.map(children, child => {
    return /*#__PURE__*/React.cloneElement(child, props, child.props.children);
  });
};

export const InputGroup = ({
  children,
  ...props
}) => {
  return /*#__PURE__*/React.createElement(Flex, {
    direction: "row",
    wrap: "wrap"
  }, supplyPropsToChildren(getAttachedChildren(children), props));
};
//# sourceMappingURL=InputGroup.js.map