"use strict";
require("core-js/modules/es.array.iterator.js");
require("core-js/modules/es.object.to-string.js");
require("core-js/modules/es.string.iterator.js");
require("core-js/modules/es.weak-map.js");
require("core-js/modules/web.dom-collections.iterator.js");
require("core-js/modules/es.object.get-own-property-descriptor.js");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var React = _interopRequireWildcard(require("react"));
var _reactBootstrap = require("react-bootstrap");
var _reactFontawesome = require("@fortawesome/react-fontawesome");
var _validationLabel = _interopRequireDefault(require("../common/validation-label"));
var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
var _excluded = ["empty", "error", "required"];
/*
* Copyright (C) 2016 Ben Ockmore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) { "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); } return f; })(e, t); }
/**
* Presentational component. Renders the disambiguation field for the name
* section of entity editing forms.
*
* @param {boolean} props.error - Passed to the ValidationLabel within the
* component to indicate a validation error.
* @param {Object} props - an object containing the properties to be passed
* down to the child input element.
* @returns {Object} a React component containing the rendered input
*/
function DisambiguationField(_ref) {
var empty = _ref.empty,
error = _ref.error,
required = _ref.required,
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
var label = /*#__PURE__*/React.createElement(_validationLabel.default, {
empty: empty,
error: error
}, "Disambiguation", required || null ? null : /*#__PURE__*/React.createElement("span", {
className: "text-muted"
}, " (optional)"));
var tooltip = /*#__PURE__*/React.createElement(_reactBootstrap.Tooltip, null, "If a different entity with the same name already exists or if there is a need for clarification");
return /*#__PURE__*/React.createElement(_reactBootstrap.Form.Group, null, /*#__PURE__*/React.createElement(_reactBootstrap.Form.Label, null, label, /*#__PURE__*/React.createElement(_reactBootstrap.OverlayTrigger, {
delay: 50,
overlay: tooltip
}, /*#__PURE__*/React.createElement(_reactFontawesome.FontAwesomeIcon, {
className: "margin-left-0-5",
icon: _freeSolidSvgIcons.faQuestionCircle
}))), /*#__PURE__*/React.createElement(_reactBootstrap.Form.Control, (0, _extends2.default)({
type: "text"
}, rest)));
}
DisambiguationField.displayName = 'DisambiguationField';
DisambiguationField.defaultProps = {
empty: false,
error: false,
required: false
};
var _default = /*#__PURE__*/React.memo(DisambiguationField);
exports.default = _default;
//# sourceMappingURL=disambiguation-field.js.map