import * as React from 'react';
class AbstractForm extends React.Component {
    constructor() {
        super(...arguments);
        this._onSubmit = (e) => {
            if (typeof e.currentTarget.checkValidity === 'function' &&
                !e.currentTarget.checkValidity()) {
                e.preventDefault();
                return;
            }
            if (!this.props.allowDefaultSubmit) {
                e.preventDefault();
            }
            this.props.onSubmit(e);
        };
        this._onInvalid = (e) => {
            if (this.props.onInvalid) {
                this.props.onInvalid(e);
            }
        };
    }
    render() {
        return (<form action={this.props.action} className={this.props.className} method={this.props.method} style={this.props.style} onSubmit={this._onSubmit} onInvalid={this._onInvalid}>
        {this.props.children}
      </form>);
    }
}
export default AbstractForm;
