/* eslint-disable @typescript-eslint/naming-convention */
// #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 { Property } from '../Decorators/PropertyDecorator';
import { Watch } from '../Decorators/WatchDecorator';
/**
 * @public
 */
export const Labelable = (base) => {
    class LabelableElement extends base {
        // #region Fields
        _label;
        // #endregion
        // #region Ctor
        /**
         * Constructs a new instance of the `LabelableElement` class.
         *
         * @public
         */
        constructor(...args) {
            super(args);
            this._label = '';
        }
        // #endregion
        // #region Properties
        /**
         * Gets or sets the `label` property.
         * The default value is an empty string, which means no label is displayed.
         *
         * @public
         */
        get label() {
            return this._label;
        }
        set label(value) {
            if (this._label !== value) {
                this._label = value;
                this.requestUpdate('label');
            }
        }
        // #endregion
        // #region Methods
        onLabelPropertyChanged(_, next) {
            if (next) {
                this.setAttribute('aria-label', this.label);
                this.setAttribute('has-label', '');
            }
            else {
                this.removeAttribute('aria-label');
                this.removeAttribute('has-label');
            }
        }
    }
    __decorate([
        Property({ type: String }),
        __metadata("design:type", String),
        __metadata("design:paramtypes", [String])
    ], LabelableElement.prototype, "label", null);
    __decorate([
        Watch('label'),
        __metadata("design:type", Function),
        __metadata("design:paramtypes", [String, String]),
        __metadata("design:returntype", void 0)
    ], LabelableElement.prototype, "onLabelPropertyChanged", null);
    return LabelableElement;
};
//# sourceMappingURL=Labelable.js.map