"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),p=require("../../../_util/KeyCode.js"),N=require("../../../_util/classNames.js"),P=n.defineComponent({compatConfig:{MODE:3},name:"TabNode",props:{id:{type:String},prefixCls:{type:String},tab:{type:Object},active:{type:Boolean},closable:{type:Boolean},editable:{type:Object},onClick:{type:Function},onResize:{type:Function},renderWrapper:{type:Function},removeAriaLabel:{type:String},onFocus:{type:Function}},emits:["click","resize","remove","focus"],setup(t,{expose:v,attrs:m}){const s=n.ref();function l(o){t.tab?.disabled||t.onClick(o)}v({domRef:s});function C(o){o.preventDefault(),o.stopPropagation(),t.editable.onEdit("remove",{key:t.tab?.key,event:o})}const u=n.computed(()=>t.editable&&t.closable!==!1&&!t.tab?.disabled);return()=>{const{prefixCls:o,id:i,active:b,tab:{key:r,tab:c,disabled:d,closeIcon:k},renderWrapper:f,removeAriaLabel:$,editable:g,onFocus:F}=t,a=`${o}-tab`,y=n.createVNode("div",{key:r,ref:s,class:N.default(a,{[`${a}-with-remove`]:u.value,[`${a}-active`]:b,[`${a}-disabled`]:d}),style:m.style,onClick:l},[n.createVNode("div",{role:"tab","aria-selected":b,id:i&&`${i}-tab-${r}`,class:`${a}-btn`,"aria-controls":i&&`${i}-panel-${r}`,"aria-disabled":d,tabindex:d?null:0,onClick:e=>{e.stopPropagation(),l(e)},onKeydown:e=>{[p.default.SPACE,p.default.ENTER].includes(e.which)&&(e.preventDefault(),l(e))},onFocus:F},[typeof c=="function"?c():c]),u.value&&n.createVNode("button",{type:"button","aria-label":$||"remove",tabindex:0,class:`${a}-remove`,onClick:e=>{e.stopPropagation(),C(e)}},[k?.()||g.removeIcon?.()||"×"])]);return f?f(y):y}}});exports.default=P;
