"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Actions_exports = {};
__export(Actions_exports, {
  default: () => Actions_default
});
module.exports = __toCommonJS(Actions_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_yoga = require("@gympass/yoga");
var import_yoga_icons = require("@gympass/yoga-icons");
var import_styled_components = __toESM(require("styled-components"));
var import_Icon = __toESM(require("../../../Icon"));
const StyledAction = import_styled_components.default.div`
  ${({
  theme: {
    yoga: {
      components: {
        navigationmenu: { backgroundColor, border, height, width, icon }
      }
    }
  }
}) => import_styled_components.css`
      transition: background-color 300ms ease-in-out;

      display: flex;
      align-items: center;
      justify-content: center;
      width: ${width.xxlarge}px;
      height: ${height.xxlarge}px;
      border-radius: ${border.radius.action}px;

      svg {
        fill: ${icon.fill.actions};
      }

      :hover,
      &:focus {
        cursor: pointer;
        background-color: ${backgroundColor.hover};
      }
    `}
`;
function Actions({ actions, sideOffset, zIndex }) {
  if (!(actions == null ? void 0 : actions.length)) {
    return null;
  }
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_yoga.Menu, { onMouseHover: false, children: [
    /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_yoga.Menu.Action, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledAction, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.default, { as: import_yoga_icons.MenuMore, size: "medium" }) }) }),
    /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
      import_yoga.Menu.List,
      {
        side: "right",
        sideOffset,
        zIndex: `${zIndex != null ? zIndex : 2}`,
        children: actions.map(({ id, label, onClick }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_yoga.Menu.Item, { onClick, children: label }, id))
      }
    )
  ] });
}
var Actions_default = Actions;
