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

  export default {
    name: 'XxCheckboxGroup',

    componentName: 'XxCheckboxGroup',

    mixins: [Emitter],

    inject: {
      xxFormItem: {
        default: ''
      }
    },

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

    computed: {
      _xxFormItemSize() {
        return (this.xxFormItem || {}).xxFormItemSize;
      },
      checkboxGroupSize() {
        return this.size || this._xxFormItemSize || (this.$XXUI || {}).size;
      }
    },

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

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