import * as React from 'react';
/**
 * Form component that handles validation.
 * If the user tries to submit the form and one of the inputs is invalid,
 * Bootstrap's `was-validated` class will be assigned so the invalid inputs get highlighted.
 */
export class Form extends React.PureComponent {
    constructor(props) {
        super(props);
        this.onInvalid = event => {
            this.setState({ wasValidated: true });
            if (this.props.onInvalid) {
                this.props.onInvalid(event);
            }
        };
        this.state = { wasValidated: false };
    }
    render() {
        return (
        // tslint:disable-next-line:jsx-ban-elements
        React.createElement("form", Object.assign({}, this.props, { className: `${this.props.className || ''} ${this.state.wasValidated ? 'was-validated' : ''}`, onInvalid: this.onInvalid }), this.props.children));
    }
}
//# sourceMappingURL=Form.js.map