"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 _react = _interopRequireDefault(require("react"));
var _constants = require("../../../../../../constants");
var _loadingSkeleton = require("../../../common/loading-skeleton");
var _elements = require("../../../elements");
var _utils = require("../../../utils");
var _block = _interopRequireDefault(require("../../block"));
var _excluded = ["actionGroup", "icon", "position", "testId", "title", "hideIcon"];
/* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */
/**
 * This represents a TitleBlock for a Smart Link that is currently waiting
 * for a request to finish.
 * This should render when a Smart Link has sent a request.
 * @see TitleBlock
 */
var TitleBlockResolvingView = function TitleBlockResolvingView(_ref) {
  var actionGroup = _ref.actionGroup,
    icon = _ref.icon,
    position = _ref.position,
    testId = _ref.testId,
    title = _ref.title,
    hideIcon = _ref.hideIcon,
    blockProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
  var _blockProps$size = blockProps.size,
    size = _blockProps$size === void 0 ? _constants.SmartLinkSize.Medium : _blockProps$size;
  var iconWidth = (0, _utils.getIconWidth)(size);
  return /*#__PURE__*/_react.default.createElement(_block.default, (0, _extends2.default)({}, blockProps, {
    testId: "".concat(testId, "-resolving-view")
  }), !hideIcon && icon && /*#__PURE__*/_react.default.createElement(_elements.LinkIcon, {
    overrideIcon: icon,
    position: position,
    size: size,
    hideLoadingSkeleton: true
  }), !hideIcon && !icon && /*#__PURE__*/_react.default.createElement("span", {
    style: {
      width: iconWidth,
      height: iconWidth
    },
    "data-testid": "".concat(testId, "-icon")
  }, /*#__PURE__*/_react.default.createElement(_loadingSkeleton.LoadingSkeleton, {
    width: iconWidth,
    height: iconWidth,
    testId: "".concat(testId, "-icon-loading")
  })), title, actionGroup);
};
var _default = exports.default = TitleBlockResolvingView;