'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var normalizeComponent = require('./normalize-component-6fa50395.js');
var browser = require('./browser-ae6cec24.js');

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var script = {
  name: 'VRadio',
  props: {
    value: {
      type: [Number, String],
      default: null
    },
    id: {
      type: String,
      default: ''
    },
    error: {
      type: String,
      default: null
    },
    name: {
      type: String,
      default: ''
    },
    options: {
      type: Array,
      default: function _default() {
        return [];
      }
    },
    label: {
      type: String,
      default: null
    }
  },
  computed: {
    selected: {
      get: function get() {
        return this.value;
      },
      set: function set(newVal) {
        this.$emit('input', newVal);
      }
    },
    normalizedOptions: function normalizedOptions() {
      return this.options.reduce(function (acc, item) {
        if (item instanceof Object) {
          return acc.concat(item);
        }

        return acc.concat({
          key: item,
          val: item
        });
      }, []);
    }
  },
  methods: {
    getKeyString: function getKeyString(item) {
      return item.key || item.val || item;
    }
  }
};

/* script */
const __vue_script__ = script;

/* template */
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"field is-horizontal has-addons v-radio"},[(_vm.label)?_c('label',{staticClass:"label"},[_vm._v("\n    "+_vm._s(_vm.label)+"\n  ")]):_vm._e(),_vm._v(" "),_vm._l((_vm.normalizedOptions),function(option){return _c('div',{key:'label' + _vm.getKeyString(option),staticClass:"control"},[_c('label',{staticClass:"button is-multiline",class:{
        'is-info is-selected': option.val === _vm.value,
      },attrs:{"for":_vm.id + _vm.getKeyString(option)}},[_vm._v("\n      "+_vm._s(option.key)+"\n      "),(option.help)?_c('span',{staticClass:"help"},[_vm._v("\n        "+_vm._s(option.help)+"\n      ")]):_vm._e()]),_vm._v(" "),_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.selected),expression:"selected"}],attrs:{"id":_vm.id + _vm.getKeyString(option),"name":_vm.name,"type":"radio"},domProps:{"value":option.val,"checked":_vm._q(_vm.selected,option.val)},on:{"change":function($event){_vm.selected=option.val;}}})])}),_vm._v(" "),(_vm.error)?_c('p',{staticClass:"help is-danger"},[_vm._v("\n    "+_vm._s(_vm.error)+"\n  ")]):_vm._e()],2)};
var __vue_staticRenderFns__ = [];

  /* style */
  const __vue_inject_styles__ = function (inject) {
    if (!inject) return
    inject("data-v-07ae7cd4_0", { source: ".v-radio input{display:none}", map: undefined, media: undefined });

  };
  /* scoped */
  const __vue_scope_id__ = undefined;
  /* module identifier */
  const __vue_module_identifier__ = undefined;
  /* functional template */
  const __vue_is_functional_template__ = false;
  /* style inject SSR */
  

  
  var VRadio = normalizeComponent.__vue_normalize__(
    { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
    __vue_inject_styles__,
    __vue_script__,
    __vue_scope_id__,
    __vue_is_functional_template__,
    __vue_module_identifier__,
    browser.__vue_create_injector__,
    undefined
  );

exports.default = VRadio;
