import _extends from "@babel/runtime/helpers/extends";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
var _excluded = ["children", "className", "icon", "iconPlacement", "element", "inherit"];
import uiTypography from '@teamleader/ui-typography';
import uiUtilities from '@teamleader/ui-utilities';
import cx from 'classnames';
import React, { forwardRef } from 'react';
import Box from '../box';
import theme from './theme.css';
var BadgedLink = /*#__PURE__*/forwardRef(function (_ref, ref) {
  var _cx;

  var children = _ref.children,
      _ref$className = _ref.className,
      className = _ref$className === void 0 ? '' : _ref$className,
      icon = _ref.icon,
      _ref$iconPlacement = _ref.iconPlacement,
      iconPlacement = _ref$iconPlacement === void 0 ? 'left' : _ref$iconPlacement,
      _ref$element = _ref.element,
      element = _ref$element === void 0 ? 'a' : _ref$element,
      _ref$inherit = _ref.inherit,
      inherit = _ref$inherit === void 0 ? true : _ref$inherit,
      others = _objectWithoutProperties(_ref, _excluded);

  var classNames = cx(uiUtilities['reset-font-smoothing'], uiTypography['ui-text-body'], theme['badged-link'], (_cx = {}, _defineProperty(_cx, theme['is-inherit'], inherit), _defineProperty(_cx, theme['is-left-icon-placed'], iconPlacement === 'left'), _cx), className);
  return /*#__PURE__*/React.createElement(Box, _extends({
    element: element,
    ref: ref,
    className: classNames,
    "data-teamleader-ui": "badgedLink"
  }, others), iconPlacement === 'left' && icon, children, iconPlacement === 'right' && icon);
});
BadgedLink.displayName = 'BadgedLink';
export default BadgedLink;