import { defineComponent, ref, computed, resolveComponent, createElementBlock, openBlock, Fragment, createCommentVNode, createBlock, mergeProps, withCtx, createVNode, normalizeStyle, normalizeClass, unref, toDisplayString } from 'vue';
import '../../../utils/index.mjs';
import { iconBaseProps } from './icon-base.mjs';
import { createNamespace } from '../../../utils/create-namespace.mjs';

"use strict";
var _sfc_main = /* @__PURE__ */ defineComponent({
  ...{
    name: "LlIconBase"
  },
  __name: "icon-base",
  props: iconBaseProps,
  setup(__props) {
    const props = __props;
    const btn = ref();
    const btnClass = computed(() => {
      const isDefault = props.iconType === "default" || !props.iconType;
      const typeClass = isDefault ? bem.m("default") : bem.m("primary");
      const exposedClass = props.isShowContainer ? bem.m("container") : bem.m("exposed");
      const hasTextClass = props.isShowTitle ? bem.m("has-text") : "";
      const disabledClass = props.disabled ? isDefault ? bem.is("default-disable") : bem.is("primary-disable") : "";
      return `${props.class} ${bem.b()} ${typeClass} ${exposedClass} ${hasTextClass} ${disabledClass}`;
    });
    const bem = createNamespace("icon-base");
    const handleClickBtn = (e) => {
      props.onClick && props.onClick(e, props.data);
      btn.value?.blur();
    };
    return (_ctx, _cache) => {
      const _component_ll_icon = resolveComponent("ll-icon");
      const _component_a_button = resolveComponent("a-button");
      const _component_ll_tooltip = resolveComponent("ll-tooltip");
      return openBlock(), createElementBlock(
        Fragment,
        null,
        [
          createCommentVNode(" \u6709\u6587\u5B57\u63D0\u793A\u5F39\u7A97 "),
          _ctx.isShowTooltip && _ctx.isShow ? (openBlock(), createBlock(_component_ll_tooltip, mergeProps({ key: 0 }, _ctx.tooltipProps, {
            tip: _ctx.tooltipTitle,
            "is-white-bg": props.isWhiteBg,
            arrow: props.arrow,
            class: _ctx.tooltipClass
          }), {
            default: withCtx(() => [
              createVNode(_component_a_button, {
                ref_key: "btn",
                ref: btn,
                type: "text",
                disabled: _ctx.disabled,
                class: normalizeClass(`${btnClass.value}`),
                style: normalizeStyle(_ctx.style),
                onClick: handleClickBtn
              }, {
                default: withCtx(() => [
                  _ctx.iconName ? (openBlock(), createBlock(_component_ll_icon, {
                    key: 0,
                    "icon-name": _ctx.iconName
                  }, null, 8, ["icon-name"])) : createCommentVNode("v-if", true),
                  _ctx.isShowTitle ? (openBlock(), createElementBlock(
                    "span",
                    {
                      key: 1,
                      class: normalizeClass(unref(bem).e("text"))
                    },
                    toDisplayString(_ctx.tooltipTitle),
                    3
                    /* TEXT, CLASS */
                  )) : createCommentVNode("v-if", true)
                ]),
                _: 1
                /* STABLE */
              }, 8, ["disabled", "class", "style"])
            ]),
            _: 1
            /* STABLE */
          }, 16, ["tip", "is-white-bg", "arrow", "class"])) : !_ctx.isShowTooltip && _ctx.isShow ? (openBlock(), createElementBlock(
            Fragment,
            { key: 1 },
            [
              createCommentVNode(" \u6CA1\u6709\u6587\u5B57\u63D0\u793A\u5F39\u7A97 "),
              createVNode(_component_a_button, {
                ref_key: "btn",
                ref: btn,
                type: "text",
                disabled: _ctx.disabled,
                class: normalizeClass(`${btnClass.value}`),
                style: normalizeStyle(_ctx.style),
                onClick: handleClickBtn
              }, {
                default: withCtx(() => [
                  _ctx.iconName ? (openBlock(), createBlock(_component_ll_icon, {
                    key: 0,
                    "icon-name": _ctx.iconName,
                    class: normalizeClass(unref(bem).e("text-icon"))
                  }, null, 8, ["icon-name", "class"])) : createCommentVNode("v-if", true),
                  _ctx.isShowTitle ? (openBlock(), createElementBlock(
                    "span",
                    {
                      key: 1,
                      class: normalizeClass(unref(bem).e("text"))
                    },
                    toDisplayString(_ctx.tooltipTitle),
                    3
                    /* TEXT, CLASS */
                  )) : createCommentVNode("v-if", true)
                ]),
                _: 1
                /* STABLE */
              }, 8, ["disabled", "class", "style"])
            ],
            2112
            /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
          )) : createCommentVNode("v-if", true)
        ],
        2112
        /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
      );
    };
  }
});

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