// #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 { Dimensionable } from '../../../Behaviors/Dimensionable';
import { Disableable } from '../../../Behaviors/Disableable';
import { Sizeable } from '../../../Behaviors/Sizeable';
import { TextFormattable } from '../../../Behaviors/TextFormattable';
import { Themeable } from '../../../Behaviors/Themeable';
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 { toggleTipElementCosmopolitanStyle } from './Themes/ToggleTipElement.Cosmopolitan';
import { toggleTipElementJoyStyle } from './Themes/ToggleTipElement.Joy';
import { toggleTipElementMemphisStyle } from './Themes/ToggleTipElement.Memphis';
import { toggleTipElementTemplate } from './ToggleTipElementTemplate';
// #endregion
/**
 * ToggleTip - An interactive icon that displays contextual help content in a toggleable tooltip.
 *
 * @description
 * The ToggleTip element combines an information icon with a tooltip to provide on-demand help and
 * context. Unlike standard tooltips that appear on hover, toggletips are explicitly triggered and
 * can remain visible while users interact with the content. Supports various trigger modes (hover,
 * click, focus), placement options, delays, and customizable offset positioning. The icon automatically
 * uses the info-circle icon but can be customized via CSS. Ideal for inline help, form field
 * explanations, and feature descriptions that users can access without leaving their current context.
 *
 * @name ToggleTip
 * @element mosaik-toggletip
 * @category Primitives
 *
 * @csspart tooltip - The tooltip component container
 *
 * @cssprop {String} --toggle-tip-background-color - The tip background color CSS custom property.
 * @cssprop {String} --toggle-tip-font-family - The tip font family CSS custom property.
 * @cssprop {String} --toggle-tip-font-letter-spacing - The tip font letter spacing CSS custom property.
 * @cssprop {String} --toggle-tip-font-line-height - The tip font line height CSS custom property.
 * @cssprop {String} --toggle-tip-font-size - The tip font size CSS custom property.
 * @cssprop {String} --toggle-tip-font-text-decoration - The tip font text decoration CSS custom property.
 * @cssprop {String} --toggle-tip-font-text-transform - The tip font text transform CSS custom property.
 * @cssprop {String} --toggle-tip-font-weight - The tip font weight CSS custom property.
 * @cssprop {String} --toggle-tip-foreground-color - The tip foreground color CSS custom property.
 * @cssprop {String} --toggle-tip-gap - The tip gap CSS custom property.
 * @cssprop {String} --toggle-tip-padding-bottom - The tip padding bottom CSS custom property.
 * @cssprop {String} --toggle-tip-padding-left - The tip padding left CSS custom property.
 * @cssprop {String} --toggle-tip-padding-right - The tip padding right CSS custom property.
 * @cssprop {String} --toggle-tip-padding-top - The tip padding top CSS custom property.
 * @cssprop {String} --toggle-tip-shadow - The tip shadow CSS custom property.
 * @cssprop {String} --toggle-tip-shadow-blur - The tip shadow blur CSS custom property.
 * @cssprop {String} --toggle-tip-shadow-color - The tip shadow color CSS custom property.
 * @cssprop {String} --toggle-tip-shadow-offset-x - The tip shadow offset x CSS custom property.
 * @cssprop {String} --toggle-tip-shadow-offset-y - The tip shadow offset y CSS custom property.
 * @cssprop {String} --toggle-tip-shadow-spread - The tip shadow spread CSS custom property.
 * @cssprop {String} --toggle-tip-transition-duration - The tip transition duration CSS custom property.
 * @cssprop {String} --toggle-tip-transition-mode - The tip transition mode CSS custom property.
 * @cssprop {String} --toggle-tip-transition-property - The tip transition property CSS custom property.
 * @cssprop {String} --toggle-tip-translate - The tip translate CSS custom property.
 * @cssprop {Color} --toggletip-background-color - Background color of the toggletip
 * @cssprop {Color} --toggletip-foreground-color - Foreground color of the toggletip
 * @cssprop {String} --toggletip-padding-bottom - Padding bottom of the toggletip
 * @cssprop {String} --toggletip-padding-left - Padding left of the toggletip
 * @cssprop {String} --toggletip-padding-right - Padding right of the toggletip
 * @cssprop {String} --toggletip-padding-top - Padding top of the toggletip
 *
 * @dependency mosaik-icon - The Icon element.
 * @dependency mosaik-tooltip - The Tooltip element.
 *
 * @example
 * Basic toggletip with hover trigger:
 * ```html
 * <label for="password">
 *   Password
 *   <mosaik-toggletip
 *     content="Must be at least 8 characters with uppercase, lowercase, and numbers">
 *   </mosaik-toggletip>
 * </label>
 * <input type="password" id="password">
 * ```
 *
 * @example
 * Click-triggered toggletip that stays open:
 * ```html
 * <mosaik-toggletip
 *   content="Click the settings icon to customize your preferences"
 *   trigger="click"
 *   stays-open
 *   placement="right">
 * </mosaik-toggletip>
 * ```
 *
 * @example
 * Toggletip with custom positioning:
 * ```html
 * <mosaik-toggletip
 *   content="This is a detailed explanation that appears above"
 *   placement="top"
 *   horizontal-offset="0"
 *   vertical-offset="12"
 *   size="small">
 * </mosaik-toggletip>
 * ```
 *
 * @example
 * Toggletip with delays and custom formatting:
 * ```html
 * <mosaik-toggletip
 *   id="helpTip"
 *   content="Feature available in {plan} plan"
 *   show-delay="300"
 *   hide-delay="100"
 *   placement="bottom">
 * </mosaik-toggletip>
 *
 * <script>
 *   document.getElementById('helpTip').formatter = (text) =>
 *     text.replace('{plan}', 'Premium');
 * </script>
 * ```
 *
 * @public
 */
let ToggleTipElement = class ToggleTipElement extends Themeable(Disableable(Sizeable(TextFormattable(Dimensionable(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 `is` property.
     * The `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();
    }
    /**
     * @protected
     * @override
     */
    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('opened'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], ToggleTipElement.prototype, "onOpened", null);
__decorate([
    Listen('closed'),
    __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