// #region Imports
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { Listen } from '../../../../Events/Decorators/ListenDecorator';
import { Disableable } from '../../../Behaviors/Disableable';
import { Sizeable } from '../../../Behaviors/Sizeable';
import { TextFormattable } from '../../../Behaviors/TextFormattable';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Placement } from '../../../Types/Placement';
import { Trigger } from '../../../Types/Trigger';
import { CustomElement } from '../../Abstracts/CustomElement';
import { IconElement } from '../../Media/Icon/IconElement';
import { TooltipElement } from '../Tooltip/TooltipElement';
import { toggleTipElementTemplate } from './ToggleTipElementTemplate';
import { toggleTipElementJoyStyle } from './Themes/ToggleTipElement.Joy';
import { toggleTipElementMemphisStyle } from './Themes/ToggleTipElement.Memphis';
import { toggleTipElementCosmopolitanStyle } from './Themes/ToggleTipElement.Cosmopolitan';
import { Themeable } from '../../../Behaviors/Themeable';
// #endregion
/**
 * The `{@link ToggleTipElement}` element.
 *
 * @slot - The default slot.
 *
 * @public
 */
let ToggleTipElement = class ToggleTipElement extends Themeable(Disableable(Sizeable(TextFormattable(CustomElement)))) {
    // #region Fields
    _tooltipElement;
    _content;
    _placement;
    _horizontalOffset;
    _verticalOffset;
    _isOpen;
    _showDelay;
    _hideDelay;
    _trigger;
    _staysOpen;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._content = '';
        this._placement = Placement.Top;
        this._horizontalOffset = 8;
        this._verticalOffset = 0;
        this._isOpen = false;
        this._showDelay = 150; // material is 300
        this._hideDelay = 0; // material is 100
        this._trigger = Trigger.Hover;
        this._staysOpen = false;
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `{@link is}` property.
     * The `{@link is}` property represents natural name of this element.
     *
     * @public
     * @static
     * @readonly
     */
    static get is() {
        return 'mosaik-toggletip';
    }
    /**
     * Gets or sets the `content` property.
     *
     * @public
     * @attr
     */
    get content() {
        return this._content;
    }
    set content(value) {
        if (this._content !== value) {
            this._content = value;
            this.requestUpdate('content');
        }
    }
    /**
     * Gets or sets the `placement` property.
     *
     * @public
     * @attr
     */
    get placement() {
        return this._placement;
    }
    set placement(value) {
        if (this._placement !== value) {
            this._placement = value;
            this.requestUpdate('placement');
        }
    }
    /**
     * Gets or sets the `horizontalOffset` property.
     *
     * @public
     * @attr
     */
    get horizontalOffset() {
        return this._horizontalOffset;
    }
    set horizontalOffset(value) {
        if (this._horizontalOffset !== value) {
            this._horizontalOffset = value;
            this.requestUpdate('horizontalOffset');
        }
    }
    /**
     * Gets or sets the `verticalOffset` property.
     *
     * @public
     * @attr
     */
    get verticalOffset() {
        return this._verticalOffset;
    }
    set verticalOffset(value) {
        if (this._verticalOffset !== value) {
            this._verticalOffset = value;
            this.requestUpdate('verticalOffset');
        }
    }
    /**
     * Gets or sets the `isOpen` property.
     *
     * @public
     * @attr
     */
    get isOpen() {
        return this._isOpen;
    }
    set isOpen(value) {
        if (this._isOpen !== value) {
            this._isOpen = value;
            this.requestUpdate('isOpen');
        }
    }
    /**
     * Gets or sets the `showDelay` property.
     *
     * @public
     * @attr
     */
    get showDelay() {
        return this._showDelay;
    }
    set showDelay(value) {
        if (this._showDelay !== value) {
            this._showDelay = value;
            this.requestUpdate('showDelay');
        }
    }
    /**
     * Gets or sets the `hideDelay` property.
     *
     * @public
     * @attr
     */
    get hideDelay() {
        return this._hideDelay;
    }
    set hideDelay(value) {
        if (this._hideDelay !== value) {
            this._hideDelay = value;
            this.requestUpdate('hideDelay');
        }
    }
    /**
     * Gets or sets the `trigger` property.
     *
     * @public
     * @attr
     */
    get trigger() {
        return this._trigger;
    }
    set trigger(value) {
        if (this._trigger !== value) {
            this._trigger = value;
            this.requestUpdate('trigger');
        }
    }
    /**
     * Gets or sets the `staysOpen` property.
     *
     * @public
     * @attr
     */
    get staysOpen() {
        return this._staysOpen;
    }
    set staysOpen(value) {
        if (this._staysOpen !== value) {
            this._staysOpen = value;
            this.requestUpdate('staysOpen');
        }
    }
    // #endregion
    // #region Methods
    /**
     * @public
     */
    open() {
        void this._tooltipElement.open();
    }
    /**
     * @public
     */
    close() {
        void this._tooltipElement.close();
    }
    onApplyTemplate() {
        super.onApplyTemplate();
        this._tooltipElement = this.getTemplatePart('tooltip');
    }
    /**
     * @protected
     */
    onOpened() {
        this.isOpen = true;
    }
    /**
     * @protected
     */
    onClosed() {
        this.isOpen = false;
    }
};
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], ToggleTipElement.prototype, "content", null);
__decorate([
    Attribute({ type: Placement }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], ToggleTipElement.prototype, "placement", null);
__decorate([
    Attribute({ type: Number }),
    __metadata("design:type", Number),
    __metadata("design:paramtypes", [Number])
], ToggleTipElement.prototype, "horizontalOffset", null);
__decorate([
    Attribute({ type: Number }),
    __metadata("design:type", Number),
    __metadata("design:paramtypes", [Number])
], ToggleTipElement.prototype, "verticalOffset", null);
__decorate([
    Attribute({
        type: Boolean,
        useDefault: true
    }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], ToggleTipElement.prototype, "isOpen", null);
__decorate([
    Attribute({ type: Number }),
    __metadata("design:type", Number),
    __metadata("design:paramtypes", [Number])
], ToggleTipElement.prototype, "showDelay", null);
__decorate([
    Attribute({ type: Number }),
    __metadata("design:type", Number),
    __metadata("design:paramtypes", [Number])
], ToggleTipElement.prototype, "hideDelay", null);
__decorate([
    Attribute({ type: Trigger }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], ToggleTipElement.prototype, "trigger", null);
__decorate([
    Attribute({
        type: Boolean,
        useDefault: true
    }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], ToggleTipElement.prototype, "staysOpen", null);
__decorate([
    Listen('tooltipOpened'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], ToggleTipElement.prototype, "onOpened", null);
__decorate([
    Listen('tooltipClosed'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], ToggleTipElement.prototype, "onClosed", null);
ToggleTipElement = __decorate([
    Component({
        selector: 'mosaik-toggletip',
        template: toggleTipElementTemplate,
        themes: {
            joy: toggleTipElementJoyStyle,
            memphis: toggleTipElementMemphisStyle,
            cosmopolitan: toggleTipElementCosmopolitanStyle
        },
        imports: [
            TooltipElement,
            IconElement
        ]
    }),
    __metadata("design:paramtypes", [])
], ToggleTipElement);
export { ToggleTipElement };
//# sourceMappingURL=ToggleTipElement.js.map