"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
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 _reactBootstrap = require("react-bootstrap");
var _propTypes = _interopRequireDefault(require("prop-types"));
var _react = _interopRequireDefault(require("react"));
var _validationLabel = _interopRequireDefault(require("../common/validation-label"));
var _excluded = ["error", "empty"];
/*
* 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.
*/
/**
* Presentational component. Renders a text input field for setting the value
* of an identifier, with an associated ValidationLabel.
*
* @param {Object} props - The properties passed to the component.
* @param {boolean} props.error - Passed to the ValidationLabel within the
* component to indicate a validation error.
* @param {boolean} props.empty - Passed to the ValidationLabel within the
* component to indicate that the field is empty.
* @returns {ReactElement} A React component containing the rendered input
* component.
*/
function ValueField(_ref) {
var error = _ref.error,
empty = _ref.empty,
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
var label = /*#__PURE__*/_react.default.createElement(_validationLabel.default, {
empty: empty,
error: error
}, "Value");
return /*#__PURE__*/_react.default.createElement(_reactBootstrap.Form.Group, null, /*#__PURE__*/_react.default.createElement(_reactBootstrap.Form.Label, null, label), /*#__PURE__*/_react.default.createElement(_reactBootstrap.Form.Control, (0, _extends2.default)({
autoFocus: true,
type: "text"
}, rest)));
}
ValueField.displayName = 'ValueField';
ValueField.propTypes = {
empty: _propTypes.default.bool,
error: _propTypes.default.bool
};
ValueField.defaultProps = {
empty: true,
error: false
};
var _default = ValueField;
exports.default = _default;
//# sourceMappingURL=value-field.js.map