import { __assign, __rest } from "tslib";
import React, { useContext, useState } from 'react';
import classNames from 'classnames';
import Input from '../input';
import { ConfigContext } from '../config-provider/config-context';
import { getPrefixCls } from '../_utils/general';
import { Eye, EyeClose } from '../_utils/components';
var InputPassword = function (props) {
    var _a = props.suffix, suffix = _a === void 0 ? true : _a, visibleOnClick = props.visibleOnClick, className = props.className, customisedCls = props.prefixCls, otherProps = __rest(props, ["suffix", "visibleOnClick", "className", "prefixCls"]);
    var configContext = useContext(ConfigContext);
    var prefixCls = getPrefixCls('input-pwd', configContext.prefixCls, customisedCls);
    var cls = classNames(prefixCls, className);
    var _b = useState(false), visible = _b[0], setVisible = _b[1];
    var renderSuffix = function () { return (React.createElement("div", { className: prefixCls + "__suffix", onClick: function () {
            setVisible(!visible);
            visibleOnClick && visibleOnClick();
        } }, visible ? (React.createElement(Eye, { size: 17, className: prefixCls + "__icon" })) : (React.createElement(EyeClose, { size: 17, className: prefixCls + "__icon" })))); };
    return (React.createElement(Input, __assign({}, otherProps, { className: cls, type: visible ? 'text' : 'password', suffix: suffix ? renderSuffix() : null })));
};
export default InputPassword;
//# sourceMappingURL=index.js.map