UNPKG

@ntohq/buefy-next

Version:

Lightweight UI components for Vue.js (v3) based on Bulma

3 lines (2 loc) 3.78 kB
/*! Buefy v0.2.0 | MIT License | github.com/buefy/buefy */ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).Radio={},e.Vue)}(this,(function(e,n){"use strict";var i=n.defineComponent({props:{modelValue:[String,Number,Boolean,Function,Object,Array],nativeValue:[String,Number,Boolean,Function,Object,Array],type:String,disabled:Boolean,required:Boolean,name:String,size:String},emits:{"update:modelValue":e=>!0},data(){return{newValue:this.modelValue}},computed:{computedValue:{get(){return this.newValue},set(e){this.newValue=e,this.$emit("update:modelValue",e)}},disabledOrUndefined(){return this.disabled||void 0},requiredOrUndefined(){return this.required||void 0}},watch:{modelValue(e){this.newValue=e}},methods:{focus(){this.$refs.input.focus()}}});const t=n.defineComponent({name:"BRadio",mixins:[i]});var o=(e,n)=>{const i=e.__vccOpts||e;for(const[e,t]of n)i[e]=t;return i};const d=["disabled"],a=["disabled","required","name","value"],l={class:"control-label"};var s=o(t,[["render",function(e,i,t,o,s,r){return n.openBlock(),n.createElementBlock("label",{class:n.normalizeClass(["b-radio radio",[e.size,{"is-disabled":e.disabled}]]),ref:"label",disabled:e.disabledOrUndefined,onClick:i[2]||(i[2]=(...n)=>e.focus&&e.focus(...n)),onKeydown:i[3]||(i[3]=n.withKeys(n.withModifiers((n=>e.$refs.label.click()),["prevent"]),["enter"]))},[n.withDirectives(n.createElementVNode("input",{"onUpdate:modelValue":i[0]||(i[0]=n=>e.computedValue=n),type:"radio",ref:"input",onClick:i[1]||(i[1]=n.withModifiers((()=>{}),["stop"])),disabled:e.disabledOrUndefined,required:e.requiredOrUndefined,name:e.name,value:e.nativeValue},null,8,a),[[n.vModelRadio,e.computedValue]]),n.createElementVNode("span",{class:n.normalizeClass(["check",e.type])},null,2),n.createElementVNode("span",l,[n.renderSlot(e.$slots,"default")])],42,d)}],["__file","/home/runner/work/buefy-next/buefy-next/packages/buefy-next/src/components/radio/Radio.vue"]]);const r=n.defineComponent({name:"BRadioButton",mixins:[i],props:{type:{type:String,default:"is-primary"},expanded:Boolean},data:()=>({isFocused:!1}),computed:{isSelected(){return this.newValue===this.nativeValue},labelClass(){return[this.isSelected?this.type:null,this.size,{"is-selected":this.isSelected,"is-disabled":this.disabled,"is-focused":this.isFocused}]}}});const u=["disabled"],c=["disabled","required","name","value"];var f=o(r,[["render",function(e,i,t,o,d,a){return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["control",{"is-expanded":e.expanded}])},[n.createElementVNode("label",{class:n.normalizeClass(["b-radio radio button",e.labelClass]),ref:"label",disabled:e.disabledOrUndefined,onClick:i[4]||(i[4]=(...n)=>e.focus&&e.focus(...n)),onKeydown:i[5]||(i[5]=n.withKeys(n.withModifiers((n=>e.$refs.label.click()),["prevent"]),["enter"]))},[n.renderSlot(e.$slots,"default"),n.withDirectives(n.createElementVNode("input",{"onUpdate:modelValue":i[0]||(i[0]=n=>e.computedValue=n),type:"radio",ref:"input",onClick:i[1]||(i[1]=n.withModifiers((()=>{}),["stop"])),disabled:e.disabledOrUndefined,required:e.requiredOrUndefined,name:e.name,value:e.nativeValue,onFocus:i[2]||(i[2]=n=>e.isFocused=!0),onBlur:i[3]||(i[3]=n=>e.isFocused=!1)},null,40,c),[[n.vModelRadio,e.computedValue]])],42,u)],2)}],["__file","/home/runner/work/buefy-next/buefy-next/packages/buefy-next/src/components/radio/RadioButton.vue"]]);const p=(e,n,i)=>{const t=i||n.name;if(null==t)throw new Error("Buefy.registerComponent: missing component name");e.component(t,n)},m={install(e){p(e,s),p(e,f)}};e.BRadio=s,e.BRadioButton=f,e.default=m,Object.defineProperty(e,"__esModule",{value:!0})}));