Localisation updates from https://translatewiki.net.
[mediawiki.git] / resources / lib / codex / modules / CdxButtonGroup.cjs
blob03dc38d3f1590646ed06cdbe500439e609841a87
1 "use strict";const e=require("vue"),i=require("./useButtonGroupKeyboardNav.js"),B=require("./CdxButton.cjs"),m=require("./Icon.js"),f=require("./_plugin-vue_export-helper.js"),k=e.defineComponent({name:"CdxButtonGroup",components:{CdxButton:B,CdxIcon:m.CdxIcon},props:{buttons:{type:Array,required:!0,validator:o=>Array.isArray(o)&&o.length>=1},disabled:{type:Boolean,default:!1}},emits:["click"],setup(o){const{rootElement:r,assignTemplateRef:l,onFocus:s,onBlur:c,onKeydown:a}=i.useButtonGroupKeyboardNav(e.toRef(o,"buttons"));return{rootElement:r,assignTemplateRef:l,onFocus:s,onBlur:c,onKeydown:a,getButtonLabel:i.getButtonLabel}}}),y={ref:"rootElement",class:"cdx-button-group"};function b(o,r,l,s,c,a){const d=e.resolveComponent("cdx-icon"),p=e.resolveComponent("cdx-button");return e.openBlock(),e.createElementBlock("div",y,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.buttons,(n,u)=>(e.openBlock(),e.createBlock(p,{key:n.value,ref_for:!0,ref:t=>o.assignTemplateRef(t,u),disabled:n.disabled||o.disabled,"aria-label":n.ariaLabel,onClick:t=>o.$emit("click",n.value),onFocus:t=>o.onFocus(u),onBlur:o.onBlur,onKeydown:o.onKeydown},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"default",{button:n},()=>[n.icon?(e.openBlock(),e.createBlock(d,{key:0,icon:n.icon},null,8,["icon"])):e.createCommentVNode("v-if",!0),e.createTextVNode(" "+e.toDisplayString(o.getButtonLabel(n)),1)])]),_:2},1032,["disabled","aria-label","onClick","onFocus","onBlur","onKeydown"]))),128))],512)}const C=f._export_sfc(k,[["render",b]]);module.exports=C;