// Copyright 1999-2023. Plesk International GmbH. All rights reserved.

import classNames from 'classnames';
import { wrapFunction } from '../utils';
import { CLS_PREFIX } from '../../constants';
import { jsx as _jsx } from "react/jsx-runtime";
/**
 * `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 = `${CLS_PREFIX}item-link`,
    className,
    children,
    hoverable,
    ...props
  } = _ref;
  if (props.onClick) {
    props.tabIndex = props.tabIndex || 0;
    props.role = props.role || 'button';
    props.onKeyDown = wrapFunction(props.onKeyDown, e => {
      if (e.key === 'Enter') {
        e.preventDefault();
        e.currentTarget.click();
      }
    });
  }
  return /*#__PURE__*/_jsx("div", {
    className: classNames(baseClassName, className),
    ...props,
    children: /*#__PURE__*/_jsx("div", {
      className: `${baseClassName}__content`,
      children: children
    })
  });
};
export default ItemLink;