/**
 * ldesign v0.4.2
 * (c) 2023 ldesign
 * @license MIT
 */

import { _ as _defineProperty } from '../_chunks/dep-eb20e23f.mjs';
import { defineComponent, ref, computed, createVNode } from 'vue';
import { CloseIcon } from '@ldesign/icons-vue-next';
import useRipple from '../hooks/useRipple.mjs';
import { usePrefixClass, useCommonClassName } from '../hooks/useConfig.mjs';
import { useGlobalIcon } from '../hooks/useGlobalIcon.mjs';
import tabPanelProps from './tab-panel-props.mjs';
import props from './props.mjs';
import '../_chunks/dep-b4041200.mjs';
import '../utils/set-style.mjs';
import '../hooks/useKeepAnimation.mjs';
import '../_chunks/dep-99920870.mjs';
import '../_chunks/dep-a0b4a044.mjs';
import '../_chunks/dep-79821ff2.mjs';
import '../_chunks/dep-0bfbf721.mjs';
import '../_chunks/dep-39cc276d.mjs';
import '../_chunks/dep-6b22dd27.mjs';
import '../_chunks/dep-c959a6fb.mjs';
import '../_chunks/dep-0f0c89ff.mjs';
import '../_chunks/dep-8f777748.mjs';
import '../_chunks/dep-ae357f26.mjs';
import '../_chunks/dep-352691c2.mjs';
import '../_chunks/dep-2cfd5b3a.mjs';
import '../_chunks/dep-05fa17c9.mjs';
import '../_chunks/dep-c31e1d9e.mjs';
import '../_chunks/dep-e3b14d70.mjs';
import '../_chunks/dep-66d6733b.mjs';
import '../_chunks/dep-a9c8a5d5.mjs';
import '../_chunks/dep-10085c61.mjs';
import '../_chunks/dep-1b058de3.mjs';
import '../_chunks/dep-c852a61a.mjs';
import '../_chunks/dep-92e7085e.mjs';
import '../_chunks/dep-c7e9ce16.mjs';
import '../_chunks/dep-3afa94cf.mjs';
import '../_chunks/dep-ba3c0b2e.mjs';
import '../_chunks/dep-ee57d235.mjs';
import '../_common/js/global-config/default-config.mjs';
import '../_common/js/global-config/locale/zh_CN.mjs';
import '../_chunks/dep-6b4aa943.mjs';
import '../_chunks/dep-d52291a9.mjs';
import '../config-provider/useConfig.mjs';
import '../_chunks/dep-44417261.mjs';
import '../_chunks/dep-bf74f1c2.mjs';
import '../_chunks/dep-44f056cd.mjs';
import '../_chunks/dep-23a0f453.mjs';
import '../_chunks/dep-1cf2b129.mjs';
import '../config-provider/type.mjs';

var TTabNavItem = defineComponent({
  name: "TTabNavItem",
  props: {
    index: Number,
    active: {
      type: Boolean
    },
    theme: props.theme,
    size: props.size,
    placement: props.placement,
    label: {
      type: null
    },
    disabled: tabPanelProps.disabled,
    removable: tabPanelProps.removable,
    value: tabPanelProps.value,
    onClick: Function,
    onRemove: Function
  },
  setup: function setup(props) {
    var itemRef = ref();
    useRipple(itemRef);
    var COMPONENT_NAME = usePrefixClass("tabs__nav-item");
    var _useGlobalIcon = useGlobalIcon({
        CloseIcon: CloseIcon
      }),
      CloseIcon$1 = _useGlobalIcon.CloseIcon;
    var classPrefix = usePrefixClass();
    var _useCommonClassName = useCommonClassName(),
      STATUS = _useCommonClassName.STATUS,
      SIZE = _useCommonClassName.SIZE;
    var removeBtnClick = function removeBtnClick(_ref) {
      var e = _ref.e;
      e.stopPropagation();
      props.onRemove({
        e: e,
        value: props.value,
        index: props.index
      });
    };
    var onClickNav = function onClickNav(e) {
      if (props.disabled) return;
      props.onClick(e);
    };
    var navItemClass = computed(function () {
      var _ref2;
      return _ref2 = {}, _defineProperty(_ref2, COMPONENT_NAME.value, true), _defineProperty(_ref2, "".concat(classPrefix.value, "-tabs__nav--card"), props.theme === "card"), _defineProperty(_ref2, STATUS.value.disabled, props.disabled), _defineProperty(_ref2, STATUS.value.active, props.active), _defineProperty(_ref2, "".concat(classPrefix.value, "-is-left"), props.placement === "left"), _defineProperty(_ref2, "".concat(classPrefix.value, "-is-right"), props.placement === "right"), _defineProperty(_ref2, SIZE.value.medium, props.size === "medium"), _defineProperty(_ref2, SIZE.value.large, props.size === "large"), _ref2;
    });
    var renderCardItem = function renderCardItem() {
      return createVNode("div", {
        "class": navItemClass.value,
        "onClick": onClickNav,
        "ref": itemRef
      }, [createVNode("span", {
        "class": "".concat(COMPONENT_NAME.value, "-text-wrapper")
      }, [props.label]), props.removable && !props.disabled ? createVNode(CloseIcon$1, {
        "class": "remove-btn",
        "onClick": removeBtnClick
      }, null) : null]);
    };
    var renderNormalItem = function renderNormalItem() {
      var _ref3;
      return createVNode("div", {
        "class": navItemClass.value,
        "onClick": onClickNav
      }, [createVNode("div", {
        "class": ["".concat(COMPONENT_NAME.value, "-wrapper"), (_ref3 = {}, _defineProperty(_ref3, STATUS.value.disabled, props.disabled), _defineProperty(_ref3, STATUS.value.active, props.active), _ref3)],
        "ref": itemRef
      }, [createVNode("span", {
        "class": "".concat(COMPONENT_NAME.value, "-text-wrapper")
      }, [props.label])]), props.removable && !props.disabled ? createVNode(CloseIcon$1, {
        "class": "remove-btn",
        "onClick": removeBtnClick
      }, null) : null]);
    };
    return function () {
      return props.theme === "card" ? renderCardItem() : renderNormalItem();
    };
  }
});

export { TTabNavItem as default };
//# sourceMappingURL=tab-nav-item.mjs.map
