<script>
  import Emitter from 'xinbao-ui/src/mixins/emitter';

  export default {
    name: 'XbCheckboxGroup',

    componentName: 'XbCheckboxGroup',

    mixins: [Emitter],

    inject: {
      xbFormItem: {
        default: ''
      }
    },

    props: {
      value: {},
      disabled: Boolean,
      min: Number,
      max: Number,
      size: String,
      fill: String,
      textColor: String
    },

    computed: {
      _xbFormItemSize() {
        return (this.xbFormItem || {}).xbFormItemSize;
      },
      checkboxGroupSize() {
        return this.size || this._xbFormItemSize || (this.$XINBAO || {}).size;
      }
    },

    watch: {
      value(value) {
        this.dispatch('XbFormItem', 'el.form.change', [value]);
      }
    }
  };
</script>

<template>
  <div class="xb-checkbox-group" role="group" aria-label="checkbox-group">
    <slot></slot>
  </div>
</template>
