{"ast":null,"code":"import _toConsumableArray from \"@babel/runtime/helpers/toConsumableArray\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/objectWithoutProperties\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nvar _excluded = [\"children\"];\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _extends() {\n  _extends = Object.assign || function (target) {\n    for (var i = 1; i < arguments.length; i++) {\n      var source = arguments[i];\n      for (var key in source) {\n        if (Object.prototype.hasOwnProperty.call(source, key)) {\n          target[key] = source[key];\n        }\n      }\n    }\n    return target;\n  };\n  return _extends.apply(this, arguments);\n}\nimport React, { memo, forwardRef } from 'react';\nimport { getAttachedChildren } from \"../../../utils\";\nimport { HStack } from \"../Stack\";\nimport { extractInObject, stylingProps } from \"../../../theme/tools/utils\";\nvar supplyPropsToChildren = function supplyPropsToChildren(children, props) {\n  if (children.length >= 2) {\n    var result = [];\n    var firstChild = children[0];\n    var firstChildProps = _objectSpread(_objectSpread({}, firstChild.props.children), {}, {\n      borderTopRightRadius: 0,\n      borderBottomRightRadius: 0\n    });\n    result.push(React.cloneElement(firstChild, firstChildProps, firstChild.props.children));\n    for (var i = 1; i < children.length - 1; i++) {\n      var child = children[i];\n      var newProps = _objectSpread(_objectSpread({}, props), {}, {\n        borderRadius: '0'\n      });\n      result.push(React.cloneElement(child, newProps, child.props.children));\n    }\n    var lastChild = children[children.length - 1];\n    var lastChildProps = _objectSpread(_objectSpread({}, lastChild.props.children), {}, {\n      borderTopLeftRadius: 0,\n      borderBottomLeftRadius: 0\n    });\n    result.push(React.cloneElement(lastChild, lastChildProps, lastChild.props.children));\n    return result;\n  }\n  return React.Children.map(children, function (child) {\n    return React.cloneElement(child, props, child.props.children);\n  });\n};\nexport var InputGroup = memo(forwardRef(function (_ref, ref) {\n  var children = _ref.children,\n    props = _objectWithoutProperties(_ref, _excluded);\n  var _extractInObject = extractInObject(props, [].concat(_toConsumableArray(stylingProps.margin), _toConsumableArray(stylingProps.border), _toConsumableArray(stylingProps.layout), _toConsumableArray(stylingProps.flexbox), _toConsumableArray(stylingProps.position), _toConsumableArray(stylingProps.background), ['space', 'shadow', 'opacity'])),\n    _extractInObject2 = _slicedToArray(_extractInObject, 2),\n    layoutProps = _extractInObject2[0],\n    nonLayoutProps = _extractInObject2[1];\n  return React.createElement(HStack, _extends({}, layoutProps, {\n    ref: ref\n  }), supplyPropsToChildren(getAttachedChildren(children), nonLayoutProps));\n}));","map":{"version":3,"sources":["InputGroup.tsx"],"names":["React","memo","forwardRef","getAttachedChildren","HStack","extractInObject","stylingProps","supplyPropsToChildren","children","props","length","result","firstChild","firstChildProps","borderTopRightRadius","borderBottomRightRadius","push","cloneElement","i","child","newProps","borderRadius","lastChild","lastChildProps","borderTopLeftRadius","borderBottomLeftRadius","Children","map","InputGroup","ref","layoutProps","nonLayoutProps","margin","border","layout","flexbox","position","background"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,IAAhB,EAAsBC,UAAtB,QAAwC,OAAxC;AAEA,SAASC,mBAAT;AACA,SAASC,MAAT;AACA,SAASC,eAAT,EAA0BC,YAA1B;AAEA,IAAMC,qBAAqB,GAAG,SAAxBA,qBAAqB,CAAIC,QAAD,EAAgBC,KAAh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\nimport { getAttachedChildren } from '../../../utils';\nimport { HStack } from '../Stack';\nimport { extractInObject, stylingProps } from '../../../theme/tools/utils';\n\nconst supplyPropsToChildren = (children: any, props: any) => {\n  if (children.length >= 2) {\n    const result = [];\n    const firstChild = children[0];\n    const firstChildProps = {\n      ...firstChild.props.children,\n      borderTopRightRadius: 0,\n      borderBottomRightRadius: 0,\n    };\n    result.push(\n      React.cloneElement(firstChild, firstChildProps, firstChild.props.children)\n    );\n    for (let i = 1; i < children.length - 1; i++) {\n      const child = children[i];\n      const newProps = { ...props, borderRadius: '0' };\n      result.push(React.cloneElement(child, newProps, child.props.children));\n    }\n    const lastChild = children[children.length - 1];\n    const lastChildProps = {\n      ...lastChild.props.children,\n      borderTopLeftRadius: 0,\n      borderBottomLeftRadius: 0,\n    };\n    result.push(\n      React.cloneElement(lastChild, lastChildProps, lastChild.props.children)\n    );\n    return result;\n  }\n\n  return React.Children.map(children, (child: JSX.Element) => {\n    return React.cloneElement(child, props, child.props.children);\n  });\n};\n\nexport const InputGroup = memo(\n  forwardRef(({ children, ...props }: IInputGroupProps, ref: any) => {\n    const [layoutProps, nonLayoutProps] = extractInObject(props, [\n      ...stylingProps.margin,\n      ...stylingProps.border,\n      ...stylingProps.layout,\n      ...stylingProps.flexbox,\n      ...stylingProps.position,\n      ...stylingProps.background,\n      'space',\n      'shadow',\n      'opacity',\n    ]);\n\n    return (\n      <HStack {...layoutProps} ref={ref}>\n        {supplyPropsToChildren(getAttachedChildren(children), nonLayoutProps)}\n      </HStack>\n    );\n  })\n);\n"]},"metadata":{},"sourceType":"module"}