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); }
import React from 'react';
import { TruncateWithTooltip } from '../../../../..';
import { Text } from '../../../shared';
export var 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.createElement(Text, _extends({
      className: className
    }, colorProp), children);
  }
  return React.createElement(TruncateWithTooltip, {
    label: children
  }, React.createElement(Text, _extends({
    className: className
  }, colorProp), children));
};