<script>
  import Emitter from 'ai-vue/src/mixins/emitter';

  export default {
    name: 'AiCheckboxGroup',

    componentName: 'AiCheckboxGroup',

    mixins: [Emitter],

    inject: {
      aiFormItem: {
        default: ''
      }
    },

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

    computed: {
      _elFormItemSize() {
        return (this.aiFormItem || {}).elFormItemSize;
      },
      checkboxGroupSize() {
        return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
      }
    },

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

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