// #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 { Emit } from '../../../../Events/Decorators/EmitDecorator';
import { HTMLElementEventEmitter } from '@breadstone/mosaik-elements';
import { Appearanceable } from '../../../Behaviors/Appearanceable';
import { Disableable } from '../../../Behaviors/Disableable';
import { Orientable } from '../../../Behaviors/Orientable';
import { Sizeable } from '../../../Behaviors/Sizeable';
import { Variantable } from '../../../Behaviors/Variantable';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { SpinDirection } from '../../../Types/SpinDirection';
import { UpDownSpinPosition } from '../../../Types/UpDownSpinPosition';
import { CustomElement } from '../../Abstracts/CustomElement';
import { RepeatButtonElement } from '../../Buttons/RepeatButton/RepeatButtonElement';
import { upDownSpinnerElementTemplate } from './UpDownSpinnerElementTemplate';
import { upDownSpinnerElementJoyStyle } from './Themes/UpDownSpinnerElement.Joy';
import { upDownSpinnerElementMemphisStyle } from './Themes/UpDownSpinnerElement.Memphis';
import { upDownSpinnerElementCosmopolitanStyle } from './Themes/UpDownSpinnerElement.Cosmopolitan';
import { Themeable } from '../../../Behaviors/Themeable';
// #endregion
/**
 * Updown Spinner - A visual element that represents a spinner with alternating upward and downward motion.
 * It is commonly used to indicate ongoing processes or loading states within an application.
 *
 * @category Indicators
 * @element mosaik-updown-spinner
 *
 * @slot prefix - The prefix slot.
 * @slot suffix - The suffix slot.
 * @slot - The default slot.
 *
 * @fires spinned - Called when the element is spinned.
 *
 * @public
 */
let UpDownSpinnerElement = class UpDownSpinnerElement extends Themeable(Variantable(Sizeable(Appearanceable(Orientable(Disableable(CustomElement)))))) {
    // #region Fields
    _spinned;
    _delay;
    _interval;
    _position;
    _increaseDisabled;
    _increaseIcon;
    _decreaseDisabled;
    _decreaseIcon;
    _focusable;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._position = UpDownSpinPosition.After;
        this._delay = 500;
        this._interval = 330;
        this._increaseDisabled = false;
        this._increaseIcon = '';
        this._decreaseDisabled = false;
        this._decreaseIcon = '';
        this._focusable = false;
        this._spinned = new HTMLElementEventEmitter(this, 'spinned', { cancelable: true });
    }
    // #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-updown-spinner';
    }
    /**
     * Gets or sets the `delay` property.
     *
     * @public
     * @attr
     */
    get delay() {
        return this._delay;
    }
    set delay(value) {
        if (this._delay !== value) {
            this._delay = value;
            this.requestUpdate('delay');
        }
    }
    /**
     * Gets or sets the `interval` property.
     *
     * @public
     * @attr
     */
    get interval() {
        return this._interval;
    }
    set interval(value) {
        if (this._interval !== value) {
            this._interval = value;
            this.requestUpdate('interval');
        }
    }
    /**
     * Gets or sets the `position` property.
     *
     * @public
     * @attr
     */
    get position() {
        return this._position;
    }
    set position(value) {
        if (this._position !== value) {
            this._position = value;
            this.requestUpdate('position');
        }
    }
    /**
     * Gets or sets the `increaseDisabled` property.
     *
     * @public
     * @attr
     */
    get increaseDisabled() {
        return this._increaseDisabled;
    }
    set increaseDisabled(value) {
        if (this._increaseDisabled !== value) {
            this._increaseDisabled = value;
            this.requestUpdate('increaseDisabled');
        }
    }
    /**
     * Gets or sets the `increaseIcon` property.
     *
     * @public
     * @attr
     */
    get increaseIcon() {
        return this._increaseIcon;
    }
    set increaseIcon(value) {
        if (this._increaseIcon !== value) {
            this._increaseIcon = value;
            this.requestUpdate('increaseIcon');
        }
    }
    /**
     * Gets or sets the `decreaseDisabled` property.
     *
     * @public
     * @attr
     */
    get decreaseDisabled() {
        return this._decreaseDisabled;
    }
    set decreaseDisabled(value) {
        if (this._decreaseDisabled !== value) {
            this._decreaseDisabled = value;
            this.requestUpdate('decreaseDisabled');
        }
    }
    /**
     * Gets or sets the `decreaseIcon` property.
     *
     * @public
     * @attr
     */
    get decreaseIcon() {
        return this._decreaseIcon;
    }
    set decreaseIcon(value) {
        if (this._decreaseIcon !== value) {
            this._decreaseIcon = value;
            this.requestUpdate('decreaseIcon');
        }
    }
    /**
     * Gets or sets the `focusable` property.
     *
     * @public
     * @attr
     */
    get focusable() {
        return this._focusable;
    }
    set focusable(value) {
        if (this._focusable !== value) {
            this._focusable = value;
            this.requestUpdate('focusable');
        }
    }
    /**
     * Called when the element is spinned.
     * Provides reference to `ISpinEventDetail` as event argument.
     *
     * @public
     * @readonly
     * @eventProperty
     */
    get spinned() {
        return this._spinned;
    }
    /**
     * Emits the {@link spinned} event.
     *
     * @protected
     */
    onSpinned(args) {
        this._spinned.emit(args);
    }
    // #endregion
    // #region Methods
    /**
     * @private
     * @template
     */
    onIncrease(event) {
        event?.stopPropagation();
        event?.preventDefault();
        const args = {
            direction: SpinDirection.Increase,
            cancel: false
        };
        this._spinned.emit(args);
    }
    /**
     * @private
     * @template
     */
    onDecrease(event) {
        event?.stopPropagation();
        event?.preventDefault();
        const args = {
            direction: SpinDirection.Decrease,
            cancel: false
        };
        this._spinned.emit(args);
    }
};
__decorate([
    Attribute({ type: Number }),
    __metadata("design:type", Number),
    __metadata("design:paramtypes", [Number])
], UpDownSpinnerElement.prototype, "delay", null);
__decorate([
    Attribute({ type: Number }),
    __metadata("design:type", Number),
    __metadata("design:paramtypes", [Number])
], UpDownSpinnerElement.prototype, "interval", null);
__decorate([
    Attribute({ type: UpDownSpinPosition }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], UpDownSpinnerElement.prototype, "position", null);
__decorate([
    Attribute({
        type: Boolean,
        useDefault: true
    }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], UpDownSpinnerElement.prototype, "increaseDisabled", null);
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], UpDownSpinnerElement.prototype, "increaseIcon", null);
__decorate([
    Attribute({
        type: Boolean,
        useDefault: true
    }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], UpDownSpinnerElement.prototype, "decreaseDisabled", null);
__decorate([
    Attribute({ type: String }),
    __metadata("design:type", String),
    __metadata("design:paramtypes", [String])
], UpDownSpinnerElement.prototype, "decreaseIcon", null);
__decorate([
    Attribute({
        type: Boolean,
        useDefault: true
    }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], UpDownSpinnerElement.prototype, "focusable", null);
__decorate([
    Emit(),
    __metadata("design:type", Object),
    __metadata("design:paramtypes", [])
], UpDownSpinnerElement.prototype, "spinned", null);
UpDownSpinnerElement = __decorate([
    Component({
        selector: 'mosaik-updown-spinner',
        template: upDownSpinnerElementTemplate,
        themes: {
            joy: upDownSpinnerElementJoyStyle,
            memphis: upDownSpinnerElementMemphisStyle,
            cosmopolitan: upDownSpinnerElementCosmopolitanStyle
        },
        imports: [
            RepeatButtonElement
        ]
    }),
    __metadata("design:paramtypes", [])
], UpDownSpinnerElement);
export { UpDownSpinnerElement };
//# sourceMappingURL=UpDownSpinnerElement.js.map