import { resolveComponent as h, createElementBlock as a, openBlock as l, createVNode as x, withCtx as r, createElementVNode as c, normalizeStyle as b, Fragment as v, renderList as _, withModifiers as g, normalizeClass as k, renderSlot as u, normalizeProps as m, guardReactiveProps as p, createTextVNode as C, toDisplayString as S } from "vue";
import { _ as $ } from "./install-BuMO14Rb.js";
const B = { class: "wt-context-menu" }, W = ["onClick"], z = {
  __name: "wt-context-menu",
  props: {
    options: {
      type: Array,
      required: !0,
      description: "[{ text, disabled, ... anything you need }]"
    },
    visible: {
      type: Boolean,
      default: !1
    },
    width: {
      type: [
        String
      ],
      default: "auto"
    },
    minWidth: {
      type: [
        String
      ],
      default: "160px"
    },
    maxWidth: {
      type: [
        String
      ],
      default: "300px"
    },
    disabled: {
      type: Boolean,
      default: !1
    },
    pt: {
      type: Object,
      default: () => null
    },
    tooltipTriggers: {
      type: Array,
      default: () => [
        "click",
        "touch"
      ]
    }
  },
  emits: [
    "click",
    "update:visible"
  ],
  setup(t, { emit: f }) {
    const w = f;
    function y({ option: i, index: d, hide: n }) {
      w("click", {
        option: i,
        index: d
      }), n();
    }
    return (i, d) => {
      const n = h("wt-popover");
      return l(), a("div", B, [
        x(n, {
          visible: t.visible,
          disabled: t.disabled,
          pt: t.pt,
          unstyled: "",
          placement: "bottom-end",
          class: "wt-context-menu__floating-wrapper"
        }, {
          activator: r(({ toggle: o, show: e }) => [
            u(i.$slots, "activator", m(p({ toggle: o, show: e })), void 0, !0)
          ]),
          default: r(({ hide: o }) => [
            c("ul", {
              style: b(`width: ${t.width}; min-width: ${t.minWidth}; max-width: ${t.maxWidth};`),
              class: "wt-context-menu__menu typo-body-2"
            }, [
              (l(!0), a(v, null, _(t.options, (e, s) => (l(), a("li", {
                key: s,
                class: "wt-context-menu__option-wrapper"
              }, [
                c("a", {
                  class: k([[{ "wt-context-menu__option--disabled": e.disabled }], "wt-context-menu__option"]),
                  href: "#",
                  onClick: g((N) => y({ option: e, index: s, hide: o }), ["prevent"])
                }, [
                  u(i.$slots, "option", m(p(e)), () => [
                    C(S(e.text || e), 1)
                  ], !0)
                ], 10, W)
              ]))), 128))
            ], 4)
          ]),
          _: 3
        }, 8, ["visible", "disabled", "pt"])
      ]);
    };
  }
}, E = /* @__PURE__ */ $(z, [["__scopeId", "data-v-fdfb8299"]]);
export {
  E as default
};
