var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
import * as classnames from "classnames";
import * as PropTypes from "prop-types";
import * as React from "react";
import { FlexBox, FlexItem } from "../flex";
import ErrorIcon from "./ErrorIcon";
import "./FormError.less";
var propTypes = {
    children: PropTypes.node.isRequired,
    className: PropTypes.string,
};
var cssClass = {
    CONTAINER: "FormError",
    ICON: "FormError--icon",
    MESSAGE: "FormError--message",
};
/**
 * Convenience display component for simple form errors.
 * TODO: This is a v0 created for use with the RadioGroup and CheckboxGroup components and probably
 * needs to be fleshed out a little more.
 */
var FormError = /** @class */ (function (_super) {
    __extends(FormError, _super);
    function FormError() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    FormError.prototype.render = function () {
        var _a = this.props, children = _a.children, className = _a.className;
        return (React.createElement(FlexBox, { alignItems: "start", className: classnames(cssClass.CONTAINER, className) },
            React.createElement(ErrorIcon, { className: cssClass.ICON }),
            React.createElement(FlexItem, { className: cssClass.MESSAGE, grow: true }, children)));
    };
    FormError.propTypes = propTypes;
    return FormError;
}(React.PureComponent));
export default FormError;
