import { __assign, __rest } from "tslib";
import React, { useContext } from 'react';
import classNames from 'classnames';
import { ConfigContext } from '../config-provider/config-context';
import { getPrefixCls } from '../_utils/general';
var InputGroupAddon = function (props) {
    var _a;
    var _b = props.disabled, disabled = _b === void 0 ? false : _b, _c = props.size, size = _c === void 0 ? 'md' : _c, noBorder = props.noBorder, className = props.className, style = props.style, children = props.children, customisedCls = props.prefixCls, otherProps = __rest(props, ["disabled", "size", "noBorder", "className", "style", "children", "prefixCls"]);
    var configContext = useContext(ConfigContext);
    var prefixCls = getPrefixCls('input-group-addon', configContext.prefixCls, customisedCls);
    var inputSize = props.size || configContext.componentSize || size;
    var cls = classNames(prefixCls, className, prefixCls + "_" + inputSize, (_a = {},
        _a[prefixCls + "_no-border"] = noBorder,
        _a));
    if (React.isValidElement(children)) {
        return (React.createElement("div", { className: cls, style: style }, React.Children.map(children, function (child) {
            var childProps = {
                disabled: disabled,
                size: inputSize,
            };
            return React.cloneElement(child, childProps);
        })));
    }
    return (React.createElement("div", __assign({}, otherProps, { className: cls, style: style }), children));
};
InputGroupAddon.displayName = 'InputGroupAddon';
export default InputGroupAddon;
//# sourceMappingURL=input-group-addon.js.map