"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.SidebarMenuItemControls = SidebarMenuItemControls;
var _react = _interopRequireDefault(require("react"));
var _faPen = require("@fortawesome/free-solid-svg-icons/faPen");
var _faTrashCan = require("@fortawesome/free-solid-svg-icons/faTrashCan");
var _button = require("../button");
var _fontAwesomeIcon = require("../font-awesome-icon");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function SidebarMenuItemControls({
  onDelete,
  onEdit,
  itemKey,
  isEditable,
  isDeletable,
  level,
  deleteAriaLabel,
  editAriaLabel
}) {
  if (!isDeletable && !isEditable) {
    return null;
  }
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
    className: "sidebar-menu-item-controls",
    "test-id": `sidebar-menu-item-controls-${itemKey}`,
    children: [isEditable && !!onEdit && /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.Button, {
      onClick: onEdit,
      accentType: _button.ACCENT_TYPES.ROUND_ICON,
      size: _button.BUTTON_SIZES.XS,
      testId: `sidebar-menu-item-edit-btn-${itemKey}`,
      "aria-label": editAriaLabel,
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_fontAwesomeIcon.FontAwesomeIcon, {
        icon: _faPen.faPen
      })
    }), isDeletable && !!onDelete && /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.Button, {
      onClick: () => onDelete({
        key: itemKey,
        level
      }),
      accentType: _button.ACCENT_TYPES.ROUND_ICON,
      size: _button.BUTTON_SIZES.XS,
      testId: `sidebar-menu-item-delete-btn-${itemKey}`,
      "aria-label": deleteAriaLabel,
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_fontAwesomeIcon.FontAwesomeIcon, {
        icon: _faTrashCan.faTrashCan
      })
    })]
  });
}