"use strict";

exports.__esModule = true;
exports.inputEventUpdater = exports.TextInput = void 0;
var _react = _interopRequireDefault(require("react"));
var _InputBase = _interopRequireDefault(require("../../MaterialUI/Inputs/InputBase"));
var _utils = require("../../../utils");
var _InputBaseProps = _interopRequireDefault(require("../../MaterialUI/Inputs/InputBaseProps"));
var _excluded = ["update", "value"];
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);
})();
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
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 inputEventUpdater = exports.inputEventUpdater = (0, _utils.memoize)(function (update) {
  return function (input) {
    return update(input);
  };
});
var TextInput = exports.TextInput = function TextInput(_ref) {
  var update = _ref.update,
    _ref$value = _ref.value,
    value = _ref$value === void 0 ? "" : _ref$value,
    props = _objectWithoutProperties(_ref, _excluded);
  var inputBaseProps = new _InputBaseProps.default();
  inputBaseProps.set(_InputBaseProps.default.propNames.value, value);
  inputBaseProps.set(_InputBaseProps.default.propNames.disabled, props.disabled);
  inputBaseProps.set(_InputBaseProps.default.propNames.placeholder, props.placeholder);
  inputBaseProps.set(_InputBaseProps.default.propNames.onBlur, props.onBlur);
  inputBaseProps.set(_InputBaseProps.default.propNames.update, inputEventUpdater(update));
  var hasError = props.required && !value ? true : false;
  inputBaseProps.set(_InputBaseProps.default.propNames.error, hasError);
  return /*#__PURE__*/_react.default.createElement(_InputBase.default, {
    inputProps: inputBaseProps
  });
};
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(inputEventUpdater, "inputEventUpdater", "/home/vsts/work/1/s/src/components/Form/Inputs/Text.js");
  reactHotLoader.register(TextInput, "TextInput", "/home/vsts/work/1/s/src/components/Form/Inputs/Text.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(inputEventUpdater, "inputEventUpdater", "/home/vsts/work/1/s/src/components/Form/Inputs/Text.js");
  reactHotLoader.register(TextInput, "TextInput", "/home/vsts/work/1/s/src/components/Form/Inputs/Text.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();