import { __decorate, __extends } from "tslib";
import Vue from 'vue';
import Component from 'vue-class-component';
var ACCORDION_STYLE_TRANSITION = 'max-height 0.3s ease';
var TransitionAccordion = /** @class */ (function (_super) {
    __extends(TransitionAccordion, _super);
    function TransitionAccordion() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    TransitionAccordion.prototype.setTransitionStart = function (el) {
        // tslint:disable-next-line: deprecation
        el.style.webkitTransition = ACCORDION_STYLE_TRANSITION;
        el.style.transition = ACCORDION_STYLE_TRANSITION;
        el.style.height = 'auto';
        el.style.overflow = 'hidden';
    };
    TransitionAccordion.prototype.accordionEnter = function (el, done) {
        var _this = this;
        this.$nextTick(function () {
            if (_this.accordionAnim || _this.accordionAnim === undefined) {
                var height_1 = el.clientHeight;
                el.style.maxHeight = '0';
                _this.setTransitionStart(el);
                setTimeout(function () {
                    el.style.maxHeight = height_1 + 'px';
                    done();
                }, 50);
            }
            else {
                done();
            }
        });
    };
    TransitionAccordion.prototype.accordionAfterEnter = function (el) {
        if (this.accordionAnim || this.accordionAnim === undefined) {
            setTimeout(function () {
                el.style.removeProperty('max-height');
                el.style.removeProperty('overflow');
            }, 300);
        }
    };
    TransitionAccordion.prototype.accordionLeave = function (el, done) {
        var _this = this;
        this.$nextTick(function () {
            if (_this.accordionAnim || _this.accordionAnim === undefined) {
                var height = el.clientHeight;
                el.style.maxHeight = height + 'px';
                _this.setTransitionStart(el);
                setTimeout(function () {
                    el.style.maxHeight = '0';
                    setTimeout(function () {
                        done();
                    }, 300);
                }, 50);
            }
            else {
                done();
            }
        });
    };
    TransitionAccordion = __decorate([
        Component
    ], TransitionAccordion);
    return TransitionAccordion;
}(Vue));
export { TransitionAccordion };
//# sourceMappingURL=transition-accordion.js.map