'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
require('../../../utils/index.js');
var iconBase = require('./icon-base.js');
var createNamespace = require('../../../utils/create-namespace.js');

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

exports.default = _sfc_main;
//# sourceMappingURL=icon-base.vue2.js.map
