"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var Grid_1 = require("../../../../components/Grid");
var LabelElement_1 = require("../LabelElement");
var REQUIRED_FIELD_SYMBOL = '*';
var Label = function (props) {
    var label = props.label, required = props.required, id = props.id;
    if (!label) {
        return null;
    }
    return (React.createElement(LabelElement_1.LabelElement, { className: "control-label", htmlFor: id },
        label,
        required && React.createElement("span", { className: "required" }, REQUIRED_FIELD_SYMBOL)));
};
var FieldTemplate = function (props) {
    var id = props.id, classNames = props.classNames, label = props.label, children = props.children, errors = props.errors, help = props.help, description = props.description, _a = props.hidden, hidden = _a === void 0 ? false : _a, _b = props.required, required = _b === void 0 ? false : _b, _c = props.displayLabel, displayLabel = _c === void 0 ? true : _c;
    if (hidden) {
        return children;
    }
    return (React.createElement(Grid_1.Box, { mb: 2, className: classNames },
        displayLabel && React.createElement(Label, { label: label, required: required, id: id }),
        displayLabel && description ? description : null,
        children,
        errors,
        help));
};
exports.default = FieldTemplate;
