"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 Menu_exports = {};
__export(Menu_exports, {
  default: () => Menu_default
});
module.exports = __toCommonJS(Menu_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_styled_components = __toESM(require("styled-components"));
var import_yoga_icons = require("@gympass/yoga-icons");
var import_Text = __toESM(require("../../../Text"));
var import_Icon = __toESM(require("../../../Icon"));
const StyledMenu = import_styled_components.default.div`
  ${({
  hasAction,
  theme: {
    yoga: {
      components: {
        navigationmenu: {
          backgroundColor,
          border,
          gap,
          padding,
          height,
          hover
        }
      }
    }
  }
}) => import_styled_components.css`
      transition: background-color 300ms ease-in-out;

      display: grid;
      align-items: center;
      width: 100%;
      grid-template-columns: max-content 1fr max-content;
      gap: ${gap.xxsmall}px;
      padding: ${padding.xsmall}px;
      background-color: ${backgroundColor.contextMenu};
      border-radius: ${border.radius.contextMenu}px;
      min-height: ${height.contextMenu}px;

      ${hasAction && import_styled_components.css`
        cursor: pointer;
        &:hover,
        &:focus {
          ${hover.contextMenu}
        }
      `}
    `}
`;
const StyledTextContainer = import_styled_components.default.div`
  ${({
  theme: {
    yoga: {
      components: {
        navigationmenu: { gap }
      }
    }
  }
}) => import_styled_components.css`
      display: flex;
      flex-direction: column;
      gap: ${gap.xxxsmall}px;
      overflow: hidden;
    `}
`;
const StyledTitle = (0, import_styled_components.default)(import_Text.default.Display4)`
  ${({
  theme: {
    yoga: {
      components: {
        navigationmenu: { font }
      }
    }
  }
}) => import_styled_components.css`
      font-size: ${font.size.contextMenu.title}px;
      line-height: ${font.size.contextMenu.title}px;
      font-weight: ${font.weight.bold};
      flex: 1;
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
    `}
`;
const StyledSubtitle = (0, import_styled_components.default)(import_Text.default.Body2)`
  ${({
  theme: {
    yoga: {
      components: {
        navigationmenu: { font }
      }
    }
  }
}) => import_styled_components.css`
      color: ${font.color.default};
    `}
`;
const StyledActionIconContainer = import_styled_components.default.div`
  ${({
  theme: {
    yoga: {
      components: {
        navigationmenu: { icon }
      }
    }
  }
}) => import_styled_components.css`
    svg {
      fill: ${icon.fill.actions};
    }
  `}
`;
const StyledAvatarContainer = import_styled_components.default.div`
  ${({
  theme: {
    yoga: {
      components: {
        navigationmenu: { avatar }
      }
    }
  }
}) => import_styled_components.css`
    > div:first-child {
      height: ${avatar.height}px;
      width: ${avatar.width}px;
    }
  `}
`;
const Menu = ({
  avatar: Avatar,
  icon,
  subtitle,
  title,
  onClick
}) => {
  const hasAction = Boolean(onClick);
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(StyledMenu, { hasAction, onClick, children: [
    !!Avatar && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledAvatarContainer, { children: Avatar }),
    /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(StyledTextContainer, { children: [
      title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledTitle, { children: title }),
      subtitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledSubtitle, { children: subtitle })
    ] }),
    hasAction && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledActionIconContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Icon.default, { as: icon != null ? icon : import_yoga_icons.ChevronDown, size: "large" }) })
  ] });
};
var Menu_default = Menu;
