import { __decorate, __extends } from "tslib";
import Vue from 'vue';
import Component from 'vue-class-component';
import { Emit, Prop } from 'vue-property-decorator';
import { Enums } from '../../../utils/enums/enums';
import uuid from '../../../utils/uuid/uuid';
import { MIcon } from '../../icon/icon';
import WithRender from './chip-delete.html?style=./chip-delete.scss';
var MChipSize;
(function (MChipSize) {
    MChipSize["Small"] = "small";
    MChipSize["Large"] = "large";
})(MChipSize || (MChipSize = {}));
var MChipDelete = /** @class */ (function (_super) {
    __extends(MChipDelete, _super);
    function MChipDelete() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.textId = "mChipDeleteText-" + uuid.generate();
        _this.iconHover = false;
        _this.focused = false;
        return _this;
    }
    MChipDelete.prototype.emitClick = function (_event) { };
    MChipDelete.prototype.emitDelete = function (_event) { };
    Object.defineProperty(MChipDelete.prototype, "iconSize", {
        get: function () {
            return this.size === MChipSize.Small ? '8px' : '14px';
        },
        enumerable: false,
        configurable: true
    });
    MChipDelete.prototype.onClick = function (event) {
        if (this.disabled) {
            return;
        }
        this.emitClick(event);
        this.emitDelete(event);
    };
    MChipDelete.prototype.onFocus = function () {
        this.focused = true;
    };
    MChipDelete.prototype.onBlur = function () {
        this.focused = false;
    };
    MChipDelete.prototype.onMouseOver = function () {
        this.iconHover = true;
    };
    MChipDelete.prototype.onMouseLeave = function () {
        this.iconHover = false;
    };
    __decorate([
        Prop()
    ], MChipDelete.prototype, "disabled", void 0);
    __decorate([
        Prop()
    ], MChipDelete.prototype, "tabindex", void 0);
    __decorate([
        Prop({
            default: MChipSize.Large,
            validator: function (value) { return Enums.toValueArray(MChipSize).includes(value); }
        })
    ], MChipDelete.prototype, "size", void 0);
    __decorate([
        Emit('click')
    ], MChipDelete.prototype, "emitClick", null);
    __decorate([
        Emit('delete')
    ], MChipDelete.prototype, "emitDelete", null);
    MChipDelete = __decorate([
        WithRender,
        Component({
            components: {
                MIcon: MIcon
            },
            modul: {
                i18n: {
                    'fr': require('./../chip.lang.fr.json'),
                    'en': require('./../chip.lang.en.json')
                }
            }
        })
    ], MChipDelete);
    return MChipDelete;
}(Vue));
export default MChipDelete;
//# sourceMappingURL=chip-delete.js.map