var _a;
import { __decorate, __extends } from "tslib";
import Component from 'vue-class-component';
import { Emit, Prop, Watch } from 'vue-property-decorator';
import { MediaQueries } from '../../mixins/media-queries/media-queries';
import MediaQueriesPlugin from '../../utils/media-queries/media-queries';
import uuid from '../../utils/uuid/uuid';
import { ModulVue } from '../../utils/vue/vue';
import { ICON_BUTTON_NAME, LINK_NAME, POPUP_NAME, TOOLTIP_NAME } from '../component-names';
import { MIconButton } from '../icon-button/icon-button';
import { MLink } from '../link/link';
import { MPopperPlacement } from '../popper/popper';
import { MPopup } from '../popup/popup';
import WithRender from './tooltip.html';
import './tooltip.scss';
export var MTooltipMode;
(function (MTooltipMode) {
    MTooltipMode["Icon"] = "icon";
    MTooltipMode["Link"] = "link";
    MTooltipMode["Definition"] = "definition";
})(MTooltipMode || (MTooltipMode = {}));
export var MTooltipSize;
(function (MTooltipSize) {
    MTooltipSize["Small"] = "small";
    MTooltipSize["Large"] = "large";
})(MTooltipSize || (MTooltipSize = {}));
var MTooltip = /** @class */ (function (_super) {
    __extends(MTooltip, _super);
    function MTooltip() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.tooltipId = "mTooltip-" + uuid.generate();
        _this.propOpen = false;
        return _this;
    }
    MTooltip.prototype.mounted = function () {
        this.propOpen = this.open;
    };
    MTooltip.prototype.onClick = function (event) {
    };
    Object.defineProperty(MTooltip.prototype, "isModeIcon", {
        get: function () {
            return this.mode === MTooltipMode.Icon;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MTooltip.prototype, "isModeLink", {
        get: function () {
            return this.mode === MTooltipMode.Link;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MTooltip.prototype, "isModeDefinition", {
        get: function () {
            return this.mode === MTooltipMode.Definition;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MTooltip.prototype, "isSizeLarge", {
        get: function () {
            return this.size === MTooltipSize.Large;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MTooltip.prototype, "hasCloseButton", {
        get: function () {
            return this.as().isMqMaxS ? false : this.closeButton;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MTooltip.prototype, "title", {
        get: function () {
            return this.propOpen ? this.CloseTitle : this.OpenTitle;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MTooltip.prototype, "OpenTitle", {
        get: function () {
            return this.openTitle === undefined ? this.$i18n.translate('m-tooltip:open') : this.openTitle;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MTooltip.prototype, "CloseTitle", {
        get: function () {
            return this.closeTitle === undefined ? this.$i18n.translate('m-tooltip:close') : this.closeTitle;
        },
        enumerable: false,
        configurable: true
    });
    MTooltip.prototype.close = function () {
        this.propOpen = false;
    };
    Object.defineProperty(MTooltip.prototype, "hasDefaultSlot", {
        get: function () {
            return !!this.$slots.default;
        },
        enumerable: false,
        configurable: true
    });
    MTooltip.prototype.openChanged = function (open) {
        this.propOpen = open;
    };
    MTooltip.prototype.onOpen = function () {
    };
    MTooltip.prototype.onClose = function () {
    };
    __decorate([
        Prop()
    ], MTooltip.prototype, "open", void 0);
    __decorate([
        Prop({
            default: MTooltipMode.Icon,
            validator: function (value) {
                return value === MTooltipMode.Icon ||
                    value === MTooltipMode.Link ||
                    value === MTooltipMode.Definition;
            }
        })
    ], MTooltip.prototype, "mode", void 0);
    __decorate([
        Prop({
            default: MPopperPlacement.Bottom,
            validator: function (value) {
                return value === MPopperPlacement.Bottom ||
                    value === MPopperPlacement.BottomEnd ||
                    value === MPopperPlacement.BottomStart ||
                    value === MPopperPlacement.Left ||
                    value === MPopperPlacement.LeftEnd ||
                    value === MPopperPlacement.LeftStart ||
                    value === MPopperPlacement.Right ||
                    value === MPopperPlacement.RightEnd ||
                    value === MPopperPlacement.RightStart ||
                    value === MPopperPlacement.Top ||
                    value === MPopperPlacement.TopEnd ||
                    value === MPopperPlacement.TopStart;
            }
        })
    ], MTooltip.prototype, "placement", void 0);
    __decorate([
        Prop({ default: true })
    ], MTooltip.prototype, "closeButton", void 0);
    __decorate([
        Prop()
    ], MTooltip.prototype, "disabled", void 0);
    __decorate([
        Prop()
    ], MTooltip.prototype, "openTitle", void 0);
    __decorate([
        Prop()
    ], MTooltip.prototype, "closeTitle", void 0);
    __decorate([
        Prop()
    ], MTooltip.prototype, "className", void 0);
    __decorate([
        Prop({
            default: MTooltipSize.Small,
            validator: function (value) {
                return value === MTooltipSize.Large ||
                    value === MTooltipSize.Small;
            }
        })
    ], MTooltip.prototype, "size", void 0);
    __decorate([
        Prop({ default: 'm-svg__information' })
    ], MTooltip.prototype, "iconName", void 0);
    __decorate([
        Emit('close')
    ], MTooltip.prototype, "onClick", null);
    __decorate([
        Watch('open')
    ], MTooltip.prototype, "openChanged", null);
    __decorate([
        Emit('open')
    ], MTooltip.prototype, "onOpen", null);
    __decorate([
        Emit('close')
    ], MTooltip.prototype, "onClose", null);
    MTooltip = __decorate([
        WithRender,
        Component({
            components: (_a = {},
                _a[POPUP_NAME] = MPopup,
                _a[ICON_BUTTON_NAME] = MIconButton,
                _a[LINK_NAME] = MLink,
                _a),
            mixins: [MediaQueries]
        })
    ], MTooltip);
    return MTooltip;
}(ModulVue));
export { MTooltip };
var TooltipPlugin = {
    install: function (v, options) {
        v.use(MediaQueriesPlugin);
        v.component(TOOLTIP_NAME, MTooltip);
    }
};
export default TooltipPlugin;
//# sourceMappingURL=tooltip.js.map