Localisation updates from https://translatewiki.net.
[mediawiki.git] / resources / lib / codex / modules / CdxButton.cjs
blobfbc9d0519a96b911f56e11d4fd57341be4da349c
1 "use strict";const e=require("vue"),s=require("./constants.js"),m=require("./useIconOnlyButton.js"),b=require("./_plugin-vue_export-helper.js"),g=s.makeStringTypeValidator(s.ButtonActions),k=s.makeStringTypeValidator(s.ButtonWeights),v=s.makeStringTypeValidator(s.ButtonSizes),w=e.defineComponent({name:"CdxButton",props:{action:{type:String,default:"default",validator:g},weight:{type:String,default:"normal",validator:k},size:{type:String,default:"medium",validator:v}},emits:["click"],setup(t,{emit:n,slots:r,attrs:a}){const u=e.ref(),l=m.useIconOnlyButton(r.default,a,"CdxButton"),o=e.ref(!1),d=e.computed(()=>({["cdx-button--action-".concat(t.action)]:!0,["cdx-button--weight-".concat(t.weight)]:!0,["cdx-button--size-".concat(t.size)]:!0,"cdx-button--framed":t.weight!=="quiet","cdx-button--icon-only":l.value,"cdx-button--is-active":o.value})),p=i=>{n("click",i)},c=i=>{o.value=i};function f(){c(!0)}function y(){var i;c(!1),(i=u.value)==null||i.click()}return{button:u,rootClasses:d,onClick:p,onKeyDown:f,onKeyUp:y}}});function C(t,n,r,a,u,l){return e.openBlock(),e.createElementBlock("button",{ref:"button",class:e.normalizeClass(["cdx-button",t.rootClasses]),onKeydown:n[0]||(n[0]=e.withKeys(e.withModifiers((...o)=>t.onKeyDown&&t.onKeyDown(...o),["prevent"]),["space","enter"])),onKeyup:n[1]||(n[1]=e.withKeys((...o)=>t.onKeyUp&&t.onKeyUp(...o),["space","enter"])),onClick:n[2]||(n[2]=(...o)=>t.onClick&&t.onClick(...o))},[e.renderSlot(t.$slots,"default")],34)}const B=b._export_sfc(w,[["render",C]]);module.exports=B;