import{defineComponent as k,shallowRef as m,onMounted as C,createVNode as E}from"vue";import a from"./KeyCode.mjs";const g={border:0,background:"transparent",padding:0,lineHeight:"inherit",display:"inline-block"},K=k({compatConfig:{MODE:3},name:"TransButton",inheritAttrs:!1,props:{noStyle:{type:Boolean,default:void 0},onClick:Function,disabled:{type:Boolean,default:void 0},autofocus:{type:Boolean,default:void 0}},setup(l,{slots:s,emit:i,attrs:d,expose:f}){const n=m(),r=e=>{const{keyCode:o}=e;o===a.ENTER&&e.preventDefault()},c=e=>{const{keyCode:o}=e;o===a.ENTER&&i("click",e)},p=e=>{i("click",e)},u=()=>{n.value&&n.value.focus()},y=()=>{n.value&&n.value.blur()};return C(()=>{l.autofocus&&u()}),f({focus:u,blur:y}),()=>{const{noStyle:e,disabled:o,...b}=l;let t={};return e||(t={...g}),o&&(t.pointerEvents="none"),E("div",{role:"button",tabindex:0,ref:n,...b,...d,onClick:p,onKeydown:r,onKeyup:c,style:{...t,...d.style||{}}},[s.default?.()])}}});export{K as default};
