@fifteen/design-system-vue
Version:
Vue 3 (Composition API + Typescript) implementation of the Fifteen Design System
2 lines (1 loc) • 1.86 kB
JavaScript
"use strict";const C=require("../FButton.js");;/* empty css */const e=require("vue"),v=require("../../composables/useSmartLink.js"),g=e.defineComponent({__name:"FButtonLink",props:{location:{default:null},submit:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},preventDefault:{type:Boolean,default:!1},ghost:{type:Boolean,default:!1},outlined:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},icon:{type:Boolean,default:!1},size:{default:"medium"},preventClick:{type:Boolean,default:!1},preventBlurOnClick:{type:Boolean,default:!1},color:{default:"primary"},background:{default:""},hoverColor:{default:""},focusColor:{default:""},anchorPoint:{default:"center"},circle:{type:Boolean,default:!1},static:{type:Boolean,default:!1},target:{default:void 0},hreflang:{default:void 0},activeClass:{default:null},exactActiveClass:{default:null},replace:{type:Boolean,default:!1}},emits:["click","focus"],setup(f,{emit:i}){const n=f,l=i;function c(t,o){o(t),l("click",t)}const{isHref:d,isExternal:p,getProps:k,getClasses:B}=v.useSmartLink(n),m=e.computed(()=>n.location);return(t,o)=>{const u=C,y=e.resolveComponent("RouterLink");return t.location&&!e.unref(d)?(e.openBlock(),e.createBlock(y,{key:0,to:t.location,replace:t.replace,custom:""},{default:e.withCtx(({navigate:a,href:s})=>[e.createVNode(u,e.mergeProps({...t.$attrs,...e.unref(k)(s)},{class:e.unref(B)(s),onClick:r=>c(r,a),onFocus:o[0]||(o[0]=r=>l("focus"))}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:2},1040,["class","onClick"])]),_:3},8,["to","replace"])):(e.openBlock(),e.createBlock(u,e.mergeProps({key:1},n,{href:e.unref(m),target:t.target??e.unref(p)?"_blank":"_self",onClick:o[1]||(o[1]=a=>l("click",a)),onFocus:o[2]||(o[2]=a=>l("focus"))}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3},16,["href","target"]))}}});module.exports=g;