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    
Size: Mime:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

const tslib_1 = require("tslib");

const react_1 = tslib_1.__importDefault(require("react"));

const mobx_react_1 = require("xmobx/mobx-react");

const exotic_1 = require("exotic");

const words_1 = require("@skava/ui/dist/words");

const forms_1 = require("@skava/ui/dist/forms");

const fixture_1 = require("./fixture");

const styled_1 = require("./styled"); // import { handleResetPassword } from '../renderProps'


class FormStateCard extends forms_1.FormState {
  constructor() {
    super(...arguments);
    this.inputsList = fixture_1.inputList;
  }

}

const formStateCard = new FormStateCard();

class FormButton extends react_1.default.PureComponent {
  render() {
    return react_1.default.createElement(styled_1.StyledPrimaryButton, Object.assign({}, this.props, {
      "data-qa": 'qa-signin-signin'
    }));
  }

}

let FormCard = class FormCard extends forms_1.ObserverForm {
  constructor() {
    super(...arguments);
    this.SubmitButton = FormButton;
    this.defaultSubmitButtonLabel = words_1.wording.signInLabel;

    this.handleForgotPassword = event => {
      const {
        onForgotPasswordClick
      } = this.props;

      if (exotic_1.isFunction(onForgotPasswordClick)) {
        const changeArgs = {
          event
        };
        onForgotPasswordClick(this.state);
      }
    }; // adding handler for forgot password


    this.onInputInit = inputState => {
      if (inputState.name === 'forgotpassword') {
        inputState.onClick = this.handleForgotPassword;
      }
    };

    this.handleSubmit = event => {
      const {
        onSignInClick
      } = this.props;
      event.preventDefault();
      event.stopPropagation();

      if (this.validateForm()) {
        if (exotic_1.isFunction(onSignInClick)) {
          onSignInClick(this.state);
        }
      }
    };
  }

};
FormCard.FormState = formStateCard;
FormCard.defaultProps = {
  state: formStateCard
};
FormCard = tslib_1.__decorate([mobx_react_1.observer], FormCard);

class Form extends react_1.default.PureComponent {
  render() {
    return react_1.default.createElement(styled_1.Wrapper, null, react_1.default.createElement(FormCard, Object.assign({}, this.props)));
  }

}

exports.Form = Form;
exports.default = Form;