import React from 'react';
import { faPen } from '@fortawesome/free-solid-svg-icons/faPen';
import { faTrashCan } from '@fortawesome/free-solid-svg-icons/faTrashCan';
import { Button, ACCENT_TYPES, BUTTON_SIZES } from '../button';
import { FontAwesomeIcon } from '../font-awesome-icon';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export function SidebarMenuItemControls({
  onDelete,
  onEdit,
  itemKey,
  isEditable,
  isDeletable,
  level,
  deleteAriaLabel,
  editAriaLabel
}) {
  if (!isDeletable && !isEditable) {
    return null;
  }
  return /*#__PURE__*/_jsxs("span", {
    className: "sidebar-menu-item-controls",
    "test-id": `sidebar-menu-item-controls-${itemKey}`,
    children: [isEditable && !!onEdit && /*#__PURE__*/_jsx(Button, {
      onClick: onEdit,
      accentType: ACCENT_TYPES.ROUND_ICON,
      size: BUTTON_SIZES.XS,
      testId: `sidebar-menu-item-edit-btn-${itemKey}`,
      "aria-label": editAriaLabel,
      children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
        icon: faPen
      })
    }), isDeletable && !!onDelete && /*#__PURE__*/_jsx(Button, {
      onClick: () => onDelete({
        key: itemKey,
        level
      }),
      accentType: ACCENT_TYPES.ROUND_ICON,
      size: BUTTON_SIZES.XS,
      testId: `sidebar-menu-item-delete-btn-${itemKey}`,
      "aria-label": deleteAriaLabel,
      children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
        icon: faTrashCan
      })
    })]
  });
}