"use strict";

exports.__esModule = true;
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _styles = require("@material-ui/core/styles");
var _reactIntl = require("react-intl");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();
(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};
var useStyles = (0, _styles.makeStyles)(function (theme) {
  return {
    fieldBox: {
      flex: "0 1 auto",
      display: "flex",
      flexDirection: "column",
      marginTop: 20,
      position: "relative"
    },
    label: {
      minHeight: 17,
      color: theme.palette.text.hint,
      marginBottom: "10px"
    },
    invalidLabel: {
      color: theme.palette.error.main
    },
    centerLabel: {
      textAlign: "center"
    },
    labelOnly: {
      marginBottom: "0px"
    },
    requiredLabel: {
      "&::after": {
        content: '" *"',
        color: "#666"
      }
    },
    requiredNotice: {
      position: "absolute",
      bottom: "-1.6em",
      right: 0,
      color: theme.palette.error.main
    }
  };
});
var Field = function Field(_ref) {
  var id = _ref.id,
    label = _ref.label,
    center = _ref.center,
    labelOnly = _ref.labelOnly,
    required = _ref.required,
    invalid = _ref.invalid,
    children = _ref.children;
  var classes = useStyles();
  return /*#__PURE__*/_react.default.createElement("div", {
    className: classes.fieldBox
  }, label !== undefined ? /*#__PURE__*/_react.default.createElement("label", {
    htmlFor: labelOnly ? undefined : id,
    id: "".concat(id, "_label"),
    className: "".concat(classes.label, " \n\t\t\t\t\t\t").concat(invalid ? classes.invalidLabel : "", "\n\t\t\t\t\t\t").concat(center ? classes.centerLabel : "", "\n\t\t\t\t\t\t").concat(labelOnly ? classes.labelOnly : "", "\n\t\t\t\t\t\t").concat(required ? classes.requiredLabel : "")
  }, typeof label === "string" ? label : /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, label)) : null, labelOnly ? null : children, !labelOnly && required && invalid ? /*#__PURE__*/_react.default.createElement("div", {
    className: classes.requiredNotice
  }, typeof required === "string" ? required : /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, required)) : null);
};
__signature__(Field, "useStyles{classes}", function () {
  return [useStyles];
});
__signature__(Field, "useStyles{classes}", function () {
  return [useStyles];
});
var _default = Field;
var _default2 = _default;
var _default3 = exports.default = _default2;
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(useStyles, "useStyles", "/home/vsts/work/1/s/src/components/Form/Field.js");
  reactHotLoader.register(Field, "Field", "/home/vsts/work/1/s/src/components/Form/Field.js");
  reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/components/Form/Field.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(useStyles, "useStyles", "/home/vsts/work/1/s/src/components/Form/Field.js");
  reactHotLoader.register(Field, "Field", "/home/vsts/work/1/s/src/components/Form/Field.js");
  reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/components/Form/Field.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();