// Mixins
import { inject as RegistrableInject } from '../registrable';
export function factory(namespace, child, parent) {
  // TODO: ts 3.4 broke directly returning this
  const R = RegistrableInject(namespace, child, parent).extend({
    name: 'groupable',
    props: {
      activeClass: {
        type: String,

        default() {
          if (!this[namespace]) return undefined;
          return this[namespace].activeClass;
        }

      },
      disabled: Boolean
    },

    data() {
      return {
        isActive: false
      };
    },

    computed: {
      groupClasses() {
        if (!this.activeClass) return {};
        return {
          [this.activeClass]: this.isActive
        };
      }

    },

    created() {
      this[namespace] && this[namespace].register(this);
    },

    beforeDestroy() {
      this[namespace] && this[namespace].unregister(this);
    },

    methods: {
      toggle() {
        this.$emit('change');
      }

    }
  });
  return R;
}
/* eslint-disable-next-line no-redeclare */

const Groupable = factory('itemGroup');
export default Groupable;
//# sourceMappingURL=index.js.map