Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/forms / build / dist / new-forms / plugins / PasswordPlugin / ConfirmPasswordPlugin.js
Size: Mime:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const React = require("react");
const mobx_react_1 = require("xmobx/mobx-react");
const deps_1 = require("./deps");
const PasswordPlugin_1 = require("./PasswordPlugin");
let ConfirmPasswordPlugin = class ConfirmPasswordPlugin extends React.Component {
    static isSatisfiedByProps(props) {
        return ['confirmPassword'].includes(props.type);
    }
    render() {
        const _a = this.props, { type, state } = _a, remainingProps = tslib_1.__rest(_a, ["type", "state"]);
        const { password, confirmPassword } = state.attributes.confirmPasswordState;
        return (React.createElement(React.Fragment, null,
            React.createElement(PasswordPlugin_1.PasswordPlugin, Object.assign({ state: password }, remainingProps, { type: "password", autoComplete: "password" })),
            React.createElement("span", { "data-qa": "password-rules-label" }, "Password must contain at least 6 characters."),
            React.createElement(PasswordPlugin_1.PasswordPlugin, Object.assign({ state: confirmPassword }, remainingProps, { type: "password", autoComplete: "password" }))));
    }
};
ConfirmPasswordPlugin.defaultState = (inputState) => {
    deps_1.addConfirmPasswordToAttributes(inputState);
    const confirmPasswordState = inputState.attributes.confirmPasswordState;
    return {
        validate: () => confirmPasswordState.isValid,
    };
};
ConfirmPasswordPlugin = tslib_1.__decorate([
    mobx_react_1.observer
], ConfirmPasswordPlugin);
exports.ConfirmPasswordPlugin = ConfirmPasswordPlugin;
exports.default = ConfirmPasswordPlugin;
//# sourceMappingURL=ConfirmPasswordPlugin.js.map