"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = _default;

var _react = _interopRequireDefault(require("react"));

var _classnames = _interopRequireDefault(require("classnames"));

var _getLocale = require("../../../../utils/getLocale");

var _tooltip = _interopRequireDefault(require("../../../tooltip"));

require("./index.css");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var preCls = "form-field-duties";

function _default(props) {
  var duties = props.duties,
      _props$placeholder = props.placeholder,
      placeholder = _props$placeholder === void 0 ? (0, _getLocale.getLocale)("Mod_Pleaseselect") : _props$placeholder,
      onClear = props.onClear,
      onClick = props.onClick;

  var onHandleClear = function onHandleClear(e) {
    e.preventDefault();
    e.stopPropagation();
    onClear();
  };

  return /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(preCls, "__input")),
    onClick: onClick
  }, !duties ? /*#__PURE__*/_react["default"].createElement("span", {
    className: (0, _classnames["default"])("".concat(preCls, "__input--placeholder"))
  }, placeholder) // @ts-ignore
  : /*#__PURE__*/_react["default"].createElement(_tooltip["default"].Text, {
    text: duties.name,
    isPercent: true
  }), duties && /*#__PURE__*/_react["default"].createElement("span", {
    className: (0, _classnames["default"])("tu-icon-cross ".concat(preCls, "__input--clear")),
    onClick: onHandleClear
  }), /*#__PURE__*/_react["default"].createElement("span", {
    className: (0, _classnames["default"])("".concat(preCls, "__input--down tu-icon-sort-down"))
  }));
}