import { defineComponent, useAttrs, resolveComponent, createBlock, openBlock, mergeProps, unref, createSlots, withCtx, createElementBlock, renderSlot, toDisplayString, createVNode } from 'vue';
import '../../../utils/index.mjs';
import { dropdownButtonEmits, dropdownButtonProps } from './dropdown.mjs';
import './recursive-menu.vue.mjs';
import { createNamespace } from '../../../utils/create-namespace.mjs';
import _sfc_main$1 from './recursive-menu.vue2.mjs';

"use strict";
const _hoisted_1 = { key: 0 };
var _sfc_main = /* @__PURE__ */ defineComponent({
  ...{ name: "LlDropdownButton" },
  __name: "dropdown-button",
  props: dropdownButtonProps,
  emits: dropdownButtonEmits,
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const bem = createNamespace("dropdown-button");
    const attrs = useAttrs();
    const handleMenuItemClick = (item) => {
      emits("claimSelected", item);
    };
    return (_ctx, _cache) => {
      const _component_a_menu = resolveComponent("a-menu");
      const _component_ll_icon = resolveComponent("ll-icon");
      const _component_a_dropdown_button = resolveComponent("a-dropdown-button");
      return openBlock(), createBlock(_component_a_dropdown_button, mergeProps(unref(attrs), {
        class: unref(bem).b(),
        "overlay-class-name": `${_ctx.overlayClassName} ${unref(bem).b("menu-wrapper")}`
      }), createSlots({
        overlay: withCtx(() => [
          _ctx.$slots.overlay ? renderSlot(_ctx.$slots, "overlay", { key: 0 }) : (openBlock(), createBlock(_component_a_menu, { key: 1 }, {
            default: withCtx(() => [
              createVNode(_sfc_main$1, {
                items: props.dropdownItems,
                onClaimSelected: handleMenuItemClick
              }, null, 8, ["items"])
            ]),
            _: 1
            /* STABLE */
          }))
        ]),
        default: withCtx(() => [
          _ctx.buttonLabel ? (openBlock(), createElementBlock(
            "span",
            _hoisted_1,
            toDisplayString(_ctx.buttonLabel),
            1
            /* TEXT */
          )) : renderSlot(_ctx.$slots, "default", { key: 1 })
        ]),
        _: 2
        /* DYNAMIC */
      }, [
        _ctx.$slots.icon || _ctx.icon ? {
          name: "icon",
          fn: withCtx(() => [
            _ctx.$slots.icon ? renderSlot(_ctx.$slots, "icon", { key: 0 }) : (openBlock(), createBlock(_component_ll_icon, {
              key: 1,
              "icon-name": _ctx.icon
            }, null, 8, ["icon-name"]))
          ]),
          key: "0"
        } : void 0
      ]), 1040, ["class", "overlay-class-name"]);
    };
  }
});

export { _sfc_main as default };
//# sourceMappingURL=dropdown-button.vue2.mjs.map
