var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
import React from 'react';
import { useStyles } from '../../../lib/renderEnvironment/index.js';
import { forwardRefAndName } from '../../../lib/forwardRefAndName.js';
import { InputDataTids } from '../Input.js';
import { CommonWrapper } from '../../../internal/CommonWrapper/index.js';
import { mergeRefs } from '../../../lib/mergeRefs.js';
import { InputLayoutAside } from './InputLayoutAside.js';
import { InputLayoutContext, InputLayoutContextDefault } from './InputLayoutContext.js';
import { getStylesLayout } from './InputLayout.styles.js';
export var InputLayout = forwardRefAndName('InputLayout', function (props, ref) {
    var stylesLayout = useStyles(getStylesLayout);
    var leftIcon = props.leftIcon, rightIcon = props.rightIcon, prefix = props.prefix, suffix = props.suffix, labelProps = props.labelProps, context = props.context, children = props.children, _a = props.tag, tag = _a === void 0 ? 'label' : _a;
    var _context = __assign(__assign({}, InputLayoutContextDefault), context);
    var Tag = tag;
    return (React.createElement(InputLayoutContext.Provider, { value: _context },
        React.createElement(CommonWrapper, __assign({}, props),
            React.createElement(Tag, __assign({ "data-tid": InputDataTids.root }, labelProps, { ref: mergeRefs(ref, labelProps.ref) }),
                React.createElement(InputLayoutAside, { icon: leftIcon, text: prefix, side: "left" }),
                React.createElement("span", { className: stylesLayout.input() }, children),
                React.createElement(InputLayoutAside, { icon: rightIcon, text: suffix, side: "right" })))));
});
//# sourceMappingURL=InputLayout.js.map