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

import { _ as _defineProperty } from '../_chunks/dep-2db7b3ec.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-255303ba.mjs';
import '../utils/set-style.mjs';
import '../hooks/useKeepAnimation.mjs';
import '../_chunks/dep-40d69a9c.mjs';
import '../_chunks/dep-eba0ea6e.mjs';
import '../_chunks/dep-9cf86cf1.mjs';
import '../_chunks/dep-bc1d737a.mjs';
import '../_chunks/dep-4d7a675b.mjs';
import '../_chunks/dep-5717e263.mjs';
import '../_chunks/dep-469b4ae0.mjs';
import '../_chunks/dep-a8bcacea.mjs';
import '../_chunks/dep-2e7f59b1.mjs';
import '../_chunks/dep-855db8bc.mjs';
import '../_chunks/dep-a87f3e4c.mjs';
import '../_chunks/dep-1e566bb5.mjs';
import '../_chunks/dep-1434aa15.mjs';
import '../_chunks/dep-3da99438.mjs';
import '../_chunks/dep-b57180d0.mjs';
import '../_chunks/dep-c8d7b6b4.mjs';
import '../_chunks/dep-e5eb9f23.mjs';
import '../_chunks/dep-9fe2ef12.mjs';
import '../_chunks/dep-672e7d1a.mjs';
import '../_chunks/dep-42a19209.mjs';
import '../_chunks/dep-9262ee2f.mjs';
import '../_chunks/dep-dcc83161.mjs';
import '../_chunks/dep-0fc02184.mjs';
import '../_chunks/dep-f1994936.mjs';
import '../_chunks/dep-345e1be3.mjs';
import '../_common/js/global-config/default-config.mjs';
import '../_common/js/global-config/locale/zh_CN.mjs';
import '../_chunks/dep-9888611c.mjs';
import '../_chunks/dep-697a1365.mjs';
import '../config-provider/useConfig.mjs';
import '../_chunks/dep-095107f7.mjs';
import '../_chunks/dep-c989dff3.mjs';
import '../_chunks/dep-334a4f6b.mjs';
import '../_chunks/dep-8d3e9aa3.mjs';
import '../_chunks/dep-876fb3ec.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
