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

import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { defineComponent, ref, computed, createVNode } from 'vue';
import { CloseIcon } from '@ldesign/icons-vue-next';
import useRipple from '../hooks/useRipple.js';
import { usePrefixClass, useCommonClassName } from '../hooks/useConfig.js';
import { useGlobalIcon } from '../hooks/useGlobalIcon.js';
import tabPanelProps from './tab-panel-props.js';
import props from './props.js';
import '../utils/set-style.js';
import '../hooks/useKeepAnimation.js';
import '../config-provider/context.js';
import 'lodash/mergeWith';
import 'lodash/merge';
import 'lodash/isArray';
import '../_common/js/global-config/default-config.js';
import '../_common/js/global-config/locale/zh_CN.js';
import '@babel/runtime/helpers/typeof';
import '../_chunks/dep-e041f5b0.js';
import 'dayjs';
import '../config-provider/useConfig.js';
import 'lodash/cloneDeep';
import 'lodash/isFunction';
import 'lodash/isString';

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.js.map
