import _extends from "@babel/runtime/helpers/esm/extends";
import React from 'react';
import { forwardRefAndName } from "../../../../lib/forwardRefAndName";
import { InputDataTids } from "../../Input";
import { CommonWrapper } from "../../../../internal/CommonWrapper";
import { InputLayoutAside } from "../InputLayoutAside";
import { InputLayoutContext, InputLayoutContextDefault } from "../InputLayoutContext";
import { stylesLayout } from "../InputLayout.styles";
export var InputLayout = forwardRefAndName('InputLayout', function (props, ref) {
  var leftIcon = props.leftIcon,
    rightIcon = props.rightIcon,
    prefix = props.prefix,
    suffix = props.suffix,
    labelProps = props.labelProps,
    context = props.context,
    children = props.children,
    _props$tag = props.tag,
    tag = _props$tag === void 0 ? 'label' : _props$tag;
  var _context = _extends({}, InputLayoutContextDefault, context);
  var Tag = tag;
  return /*#__PURE__*/(
    React.createElement(InputLayoutContext.Provider, {
      value: _context
    }, /*#__PURE__*/
    React.createElement(CommonWrapper, props, /*#__PURE__*/
    React.createElement(Tag, _extends({
      ref: ref,
      "data-tid": InputDataTids.root
    }, labelProps), /*#__PURE__*/
    React.createElement(InputLayoutAside, {
      icon: leftIcon,
      text: prefix,
      side: "left"
    }), /*#__PURE__*/
    React.createElement("span", {
      className: stylesLayout.input()
    }, children), /*#__PURE__*/
    React.createElement(InputLayoutAside, {
      icon: rightIcon,
      text: suffix,
      side: "right"
    }))))
  );
});