"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _classnames = _interopRequireDefault(require("classnames"));
var _utils = require("../utils");
var _constants = require("../../constants");
var _jsxRuntime = require("react/jsx-runtime");
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.

/**
 * `ItemLink` component is a part of [ItemList](#!/ItemList) and
 * is used for specifying a special action on the list (for example, adding new item).
 * @since 2.3.0
 */
const ItemLink = _ref => {
  let {
    baseClassName = `${_constants.CLS_PREFIX}item-link`,
    className,
    children,
    hoverable,
    ...props
  } = _ref;
  if (props.onClick) {
    props.tabIndex = props.tabIndex || 0;
    props.role = props.role || 'button';
    props.onKeyDown = (0, _utils.wrapFunction)(props.onKeyDown, e => {
      if (e.key === 'Enter') {
        e.preventDefault();
        e.currentTarget.click();
      }
    });
  }
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
    className: (0, _classnames.default)(baseClassName, className),
    ...props,
    children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
      className: `${baseClassName}__content`,
      children: children
    })
  });
};
var _default = exports.default = ItemLink;