"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TextWrapper = void 0;
var _react = _interopRequireDefault(require("react"));
var _ = require("../../../../..");
var _shared = require("../../../shared");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
var TextWrapper = exports.TextWrapper = function TextWrapper(_ref) {
  var className = _ref.className,
    _ref$truncate = _ref.truncate,
    truncate = _ref$truncate === void 0 ? true : _ref$truncate,
    _ref$isLabel = _ref.isLabel,
    isLabel = _ref$isLabel === void 0 ? false : _ref$isLabel,
    children = _ref.children;
  var colorProp = isLabel ? {
    color: function color(t) {
      return t.color.label;
    }
  } : {};
  if (!truncate) {
    return _react.default.createElement(_shared.Text, _extends({
      className: className
    }, colorProp), children);
  }
  return _react.default.createElement(_.TruncateWithTooltip, {
    label: children
  }, _react.default.createElement(_shared.Text, _extends({
    className: className
  }, colorProp), children));
};