"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 _react = _interopRequireDefault(require("react"));
var _reactIntlNext = require("react-intl-next");
var _new = require("@atlaskit/button/new");
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
var _useLinkClicked = require("../../../../../state/analytics/useLinkClicked");
var LinkInfoButton = function LinkInfoButton(_ref) {
  var content = _ref.content,
    icon = _ref.icon,
    label = _ref.label,
    onClick = _ref.onClick,
    testId = _ref.testId,
    role = _ref.role;
  var onMouseDown = (0, _useLinkClicked.useMouseDownEvent)();
  var _useIntl = (0, _reactIntlNext.useIntl)(),
    formatMessage = _useIntl.formatMessage;
  return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
    content: content,
    hideTooltipOnClick: true,
    tag: "span",
    testId: "".concat(testId, "-tooltip")
  }, /*#__PURE__*/_react.default.createElement(_new.IconButton, (0, _extends2.default)({
    appearance: "subtle",
    icon: icon,
    label: formatMessage(label),
    onClick: onClick,
    onMouseDown: onMouseDown,
    testId: "".concat(testId, "-button")
  }, (0, _platformFeatureFlags.fg)('navx-2185-smart-link-preview-modal-icon-role') ? {
    role: role
  } : {})));
};
var _default = exports.default = LinkInfoButton;