// #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 { RendererServiceLocator } from '../../../../Dom/Renderer';
import { Busyable } from '../../../Behaviors/Busyable';
import { ContentAlignable } from '../../../Behaviors/ContentAlignable';
import { Fitable } from '../../../Behaviors/Fitable';
import { Iconable } from '../../../Behaviors/Iconable';
import { Labelable } from '../../../Behaviors/Labelable';
import { Orientable } from '../../../Behaviors/Orientable';
import { Reversible } from '../../../Behaviors/Reversible';
import { Component } from '../../../Decorators/ComponentDecorator';
import { Property } from '../../../Decorators/PropertyDecorator';
import { Watch } from '../../../Decorators/WatchDecorator';
import { RippleElement } from '../../Effects/Ripple/RippleElement';
import { StackElement } from '../../Layouts/Stack/StackElement';
import { IconElement } from '../../Media/Icon/IconElement';
import { FocusRingElement } from '../../Primitives/FocusRing/FocusRingElement';
import { TextElement } from '../../Primitives/Text/TextElement';
import { ProgressRingElement } from '../../Ranges/ProgressRing/ProgressRingElement';
import { ButtonBaseElement } from '../Abstracts/ButtonBaseElement';
import { buttonElementRetroStyle } from './Themes/ButtonElement.Retro';
import { buttonElementTemplate } from './ButtonElementTemplate';
import { buttonElementJoyStyle } from './Themes/ButtonElement.Joy';
import { Themeable } from '../../../../Controls/Behaviors/Themeable';
import { buttonElementFluentStyle } from './Themes/ButtonElement.Fluent';
import { buttonElementCosmopolitanStyle } from './Themes/ButtonElement.Cosmopolitan';
// #endregion
/**
 * Button - An interactive UI element typically used to trigger actions or user interactions.
 *
 * @description
 * The Button component is a fundamental user interface element used to create interactive elements within a web application.
 * Buttons are often labeled with text or icons and are used to initiate actions when clicked or pressed. They can trigger
 * various actions, such as form submissions, navigation, or user interactions.
 *
 * @name Button
 * @element mosaik-button
 * @category Buttons
 *
 * @slot label - The label slot.
 * @slot icon - The icon slot.
 * @slot overlay - The overlay slot (useful for badge).
 *
 * @csspart button - the button part.
 * @csspart link - the link part.
 * @csspart focusRing - the focus ring part.
 * @csspart ripple - the ripple part.
 * @csspart icon - the icon part.
 * @csspart label - the label part.
 * @csspart progressRing - the progress ring part.
 *
 * @cssprop {String} --button-font-family - The font family.
 * @cssprop {String} --button-font-size - The font size.
 * @cssprop {String} --button-font-line-height - The font line height.
 * @cssprop {String} --button-font-weight - The font weight.
 * @cssprop {String} --button-font-letter-spacing - The font letter spacing.
 * @cssprop {String} --button-font-text-decoration - The font text decoration.
 * @cssprop {String} --button-font-text-transform - The font text transform.
 * @cssprop {String} --button-padding-top - The padding top.
 * @cssprop {String} --button-padding-right - The padding right.
 * @cssprop {String} --button-padding-bottom - The padding bottom.
 * @cssprop {String} --button-padding-left - The padding left.
 * @cssprop {String} --button-gap - The gap.
 * @cssprop {String} --button-transition-duration - The transition duration.
 * @cssprop {String} --button-transition-mode - The transition mode.
 * @cssprop {String} --button-transition-property - The transition property.
 * @cssprop {String} --button-foreground-color - The foreground color.
 * @cssprop {String} --button-background-color - The background color.
 * @cssprop {String} --button-border-color - The border color.
 * @cssprop {String} --button-border-width - The border width.
 * @cssprop {String} --button-border-radius - The border radius.
 * @cssprop {String} --button-border-style - The border style.
 * @cssprop {String} --button-shadow - The shadow.
 * @cssprop {String} --button-width - The width.
 * @cssprop {String} --button-height - The height.
 * @cssprop {String} --focus-ring-outward-offset - The focus ring outward offset.
 * @cssprop {String} --button-focus-ring-color - The focus ring color.
 * @cssprop {String} --button-progress-thickness - The progress ring thickness.
 *
 * @dependency {StackElement} mosaik-stack - The stack element.
 * @dependency {IconElement} mosaik-icon - The icon element.
 * @dependency {RippleElement} mosaik-ripple - The ripple element.
 * @dependency {FocusRingElement} mosaik-focus-ring - The focus ring element.
 * @dependency {TextElement} mosaik-text - The text element.
 * @dependency {ProgressRingElement} mosaik-progress-ring - The progress ring element.
 *
 * @example
 * ```html
 * <mosaik-button label="Button"></mosaik-button>
 * ```
 *
 * @public
 */
let ButtonElement = class ButtonElement extends Themeable(Reversible(Orientable(ContentAlignable(Fitable(Busyable(Labelable(Iconable(ButtonBaseElement)))))))) {
    // #region Fields
    _href;
    _download;
    _rel;
    _target;
    // #endregion
    // #region Ctor
    /**
     * Constructs a new instance of the `ButtonElement` class.
     *
     * @public
     */
    constructor() {
        super();
        this._href = '';
        this._download = '';
        this._rel = '';
        this._target = '';
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `is` property.
     *
     * @public
     * @static
     * @readonly
    */
    static get is() {
        return 'mosaik-button';
    }
    /**
     * Gets or sets the `href` property.
     *
     * @public
     */
    get href() {
        return this._href;
    }
    set href(value) {
        if (this._href !== value) {
            this._href = value;
            this.requestUpdate('href');
        }
    }
    /**
     * Gets or sets the `download` property.
     *
     * @public
     */
    get download() {
        return this._download;
    }
    set download(value) {
        if (this._download !== value) {
            this._download = value;
            this.requestUpdate('download');
        }
    }
    /**
     * Gets or sets the `rel` property.
     *
     * @public
     */
    get rel() {
        return this._rel;
    }
    set rel(value) {
        if (this._rel !== value) {
            this._rel = value;
            this.requestUpdate('rel');
        }
    }
    /**
     * Gets or sets the `target` property.
     *
     * @public
     */
    get target() {
        return this._target;
    }
    set target(value) {
        if (this._target !== value) {
            this._target = value;
            this.requestUpdate('target');
        }
    }
    // #endregion
    // #region Methods
    /**
     * @protected
     */
    onHrefPropertyChanged(_prev, next) {
        if (next === '') {
            RendererServiceLocator.current.removeAttribute(this, 'has-link');
        }
        else {
            RendererServiceLocator.current.setAttribute(this, 'has-link');
        }
    }
};
__decorate([
    Property({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], ButtonElement.prototype, "href", null);
__decorate([
    Property({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], ButtonElement.prototype, "download", null);
__decorate([
    Property({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], ButtonElement.prototype, "rel", null);
__decorate([
    Property({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], ButtonElement.prototype, "target", null);
__decorate([
    Watch('href'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String]),
    __metadata("design:returntype", void 0)
], ButtonElement.prototype, "onHrefPropertyChanged", null);
ButtonElement = __decorate([
    Component({
        selector: 'mosaik-button',
        template: buttonElementTemplate,
        themes: {
            joy: buttonElementJoyStyle,
            retro: buttonElementRetroStyle,
            fluent: buttonElementFluentStyle,
            cosmopolitan: buttonElementCosmopolitanStyle
        },
        options: {
            mode: 'open',
            delegatesFocus: true
        },
        imports: [
            StackElement,
            IconElement,
            RippleElement,
            FocusRingElement,
            TextElement,
            ProgressRingElement
        ]
    }),
    __metadata("design:paramtypes", [])
], ButtonElement);
export { ButtonElement };
//# sourceMappingURL=ButtonElement.js.map