import {
  ActionOverlayTooltipContainer
} from "./chunk-TSAVJPG4.mjs";

// tmp-babel/__shared__/web/ActionsOverlay/ThreeDotsMenuHoverOverlay/index.js
import React from "react";
import { IconButton } from "@baseapp-frontend/design-system/components/web/buttons";
import { ThreeDotsIcon, TrashCanIcon } from "@baseapp-frontend/design-system/components/web/icons";
import { Popover } from "@baseapp-frontend/design-system/components/web/popovers";
import { MenuItem, MenuList, Typography } from "@mui/material";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
var ThreeDotsMenuHoverOverlay = function ThreeDotsMenuHoverOverlay2(_ref) {
  var offsetRight = _ref.offsetRight, offsetTop = _ref.offsetTop, showDeleteButton = _ref.showDeleteButton, isDeletingItem = _ref.isDeletingItem, disableDeleteButton = _ref.disableDeleteButton, handleDeleteDialogOpen = _ref.handleDeleteDialogOpen, _ref$actions = _ref.actions, actions = _ref$actions === void 0 ? [] : _ref$actions, handleClosePopover = _ref.handleClosePopover, popover = _ref.popover;
  return /* @__PURE__ */ _jsxs(ActionOverlayTooltipContainer, {
    offsetRight,
    offsetTop,
    "aria-label": "actions overlay",
    sx: {
      position: "unset",
      marginX: "4px",
      borderRadius: "500px",
      alignSelf: "baseline"
    },
    children: [/* @__PURE__ */ _jsx(IconButton, {
      onClick: popover.onOpen,
      "aria-label": "Show menu options",
      children: /* @__PURE__ */ _jsx(ThreeDotsIcon, {
        sx: {
          fontSize: "18px"
        }
      })
    }), /* @__PURE__ */ _jsx(Popover, {
      open: popover.open,
      onClose: handleClosePopover,
      children: /* @__PURE__ */ _jsxs(MenuList, {
        children: [actions === null || actions === void 0 ? void 0 : actions.map(function(_ref2) {
          var label = _ref2.label, icon = _ref2.icon, _onClick = _ref2.onClick, disabled = _ref2.disabled, hasPermission = _ref2.hasPermission;
          if (!hasPermission) return null;
          return /* @__PURE__ */ _jsxs(MenuItem, {
            onClick: function onClick() {
              _onClick === null || _onClick === void 0 || _onClick();
              handleClosePopover();
            },
            disabled,
            children: [icon, /* @__PURE__ */ _jsx(Typography, {
              variant: "body2",
              color: "text.primary",
              children: label
            })]
          }, label);
        }), showDeleteButton && /* @__PURE__ */ _jsxs(MenuItem, {
          onClick: handleDeleteDialogOpen,
          disabled: isDeletingItem || disableDeleteButton,
          color: "disabled",
          children: [/* @__PURE__ */ _jsx(TrashCanIcon, {
            sx: {
              color: disableDeleteButton ? "text.disabled" : "error.main"
            }
          }), /* @__PURE__ */ _jsx(Typography, {
            variant: "body2",
            color: disableDeleteButton ? "text.disabled" : "error.main",
            children: "Delete"
          })]
        })]
      })
    })]
  });
};
var ThreeDotsMenuHoverOverlay_default = ThreeDotsMenuHoverOverlay;

export {
  ThreeDotsMenuHoverOverlay_default
};
//# sourceMappingURL=chunk-6C7SUEVR.mjs.map