"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.default = void 0;

var _create = _interopRequireDefault(require("../utils/create"));

var _default = (0, _create.default)({
  render: function render() {
    var _vm = this;

    var _h = _vm.$createElement;

    var _c = _vm._self._c || _h;

    return _c('div', {
      class: _vm.b(_vm.direction)
    }, [_vm._t("default")], 2);
  },
  name: 'checkbox-group',
  props: {
    max: Number,
    value: Array,
    disabled: Boolean,
    direction: String,
    iconSize: [Number, String],
    checkedColor: String
  },
  watch: {
    value: function value(val) {
      this.$emit('change', val);
    }
  },
  methods: {
    toggleAll: function toggleAll(checked) {
      if (checked === false) {
        this.$emit('input', []);
        return;
      }

      var $children = this.$children;

      if (!checked) {
        $children = $children.filter(function (item) {
          return !item.checked;
        });
      }

      var names = $children.map(function (item) {
        return item.name;
      });
      this.$emit('input', names);
    }
  }
});

exports.default = _default;