import e from"../../../_util/classNames.mjs";import t from"../../../_util/KeyCode.mjs";import{computed as n,createVNode as r,defineComponent as i,ref as a}from"vue";var o=i({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(i,{expose:o,attrs:s}){let c=a();function l(e){i.tab?.disabled||i.onClick(e)}o({domRef:c});function u(e){e.preventDefault(),e.stopPropagation(),i.editable.onEdit(`remove`,{key:i.tab?.key,event:e})}let d=n(()=>i.editable&&i.closable!==!1&&!i.tab?.disabled);return()=>{let{prefixCls:n,id:a,active:o,tab:{key:f,tab:p,disabled:m,closeIcon:h},renderWrapper:g,removeAriaLabel:_,editable:v,onFocus:y}=i,b=`${n}-tab`,x=r(`div`,{key:f,ref:c,class:e(b,{[`${b}-with-remove`]:d.value,[`${b}-active`]:o,[`${b}-disabled`]:m}),style:s.style,onClick:l},[r(`div`,{role:`tab`,"aria-selected":o,id:a&&`${a}-tab-${f}`,class:`${b}-btn`,"aria-controls":a&&`${a}-panel-${f}`,"aria-disabled":m,tabindex:m?null:0,onClick:e=>{e.stopPropagation(),l(e)},onKeydown:e=>{[t.SPACE,t.ENTER].includes(e.which)&&(e.preventDefault(),l(e))},onFocus:y},[typeof p==`function`?p():p]),d.value&&r(`button`,{type:`button`,"aria-label":_||`remove`,tabindex:0,class:`${b}-remove`,onClick:e=>{e.stopPropagation(),u(e)}},[h?.()||v.removeIcon?.()||`×`])]);return g?g(x):x}}});export{o as default};