// #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 { DomServiceLocator } from '../../../../Dom/Dom';
import { Listen } from '../../../../Events/Decorators/ListenDecorator';
import { Disableable } from '../../../Behaviors/Disableable';
import { Focusable } from '../../../Behaviors/Focusable';
import { Valueable } from '../../../Behaviors/Valueable';
import { Variantable } from '../../../Behaviors/Variantable';
import { Attribute } from '../../../Decorators/AttributeDecorator';
import { Component } from '../../../Decorators/ComponentDecorator';
import { SelectionMode } from '../../../Types/SelectionMode';
import { RippleElement } from '../../Effects/Ripple/RippleElement';
import { CheckmarkElement } from '../../Primitives/Checkmark/CheckmarkElement';
import { TextElement } from '../../Primitives/Text/TextElement';
import { SelectorItemElement } from '../Abstracts/Selector/SelectorItemElement';
import { ListElement } from './ListElement';
import { listItemElementTemplate } from './ListItemElementTemplate';
import { listItemElementJoyStyle } from './Themes/ListItemElement.Joy';
import { listItemElementMemphisStyle } from './Themes/ListItemElement.Memphis';
import { listItemElementCosmopolitanStyle } from './Themes/ListItemElement.Cosmopolitan';
import { Themeable } from '../../../Behaviors/Themeable';
// #endregion
/**
 * List Item - An individual item within a list component. List items can contain various types of content, such as text, icons, or images, and are typically organized vertically or horizontally.
 *
 * @element mosaik-list-item
 *
 * @slot - The default slot;
 * @slot prefix - The prefix slot;
 * @slot suffix - The suffix slot;
 *
 * @public
 */
let ListItemElement = class ListItemElement extends Themeable(Disableable(Valueable(Variantable(Focusable(SelectorItemElement))))) {
    // #region Fields
    _isChecked;
    // #endregion
    // #region Ctor
    /**
     * @public
     */
    constructor() {
        super();
        this._isChecked = false;
    }
    // #endregion
    // #region Properties
    /**
     * Returns the `{@link is}` property.
     * The `{@link is}` property represents natural name of this element.
     *
     * @public
     * @static
     * @override
     * @readonly
     */
    // eslint-disable-next-line @typescript-eslint/ban-ts-comment
    // @ts-ignore
    static get is() {
        return 'mosaik-list-item';
    }
    /**
     * Gets or sets the `isChecked` property.
     *
     * @public
     */
    get isChecked() {
        return this._isChecked;
    }
    set isChecked(value) {
        if (this._isChecked !== value) {
            this._isChecked = value;
            this.requestUpdate('isChecked');
        }
    }
    /**
     * Gets the `parent` list of this item.
     *
     * @protected
     * @readonly
     */
    get parent() {
        return DomServiceLocator.current.findAncestor(this, ListElement.is, { strict: true });
    }
    // #endregion
    // #region Methods
    /**
     * @protected
     */
    onClick(event) {
        if (this.disabled) {
            return;
        }
        if (this === event.currentTarget) {
            if (!(this.parent.selectionMode === SelectionMode.Single || this.parent.selectionMode === SelectionMode.None)) {
                this.isChecked = !this._isChecked;
            }
        }
    }
};
__decorate([
    Attribute({
        type: Boolean,
        useDefault: true
    }),
    __metadata("design:type", Boolean),
    __metadata("design:paramtypes", [Boolean])
], ListItemElement.prototype, "isChecked", null);
__decorate([
    Listen('click'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Event]),
    __metadata("design:returntype", void 0)
], ListItemElement.prototype, "onClick", null);
ListItemElement = __decorate([
    Component({
        selector: 'mosaik-list-item',
        template: listItemElementTemplate,
        themes: {
            joy: listItemElementJoyStyle,
            memphis: listItemElementMemphisStyle,
            cosmopolitan: listItemElementCosmopolitanStyle
        },
        imports: [
            CheckmarkElement,
            TextElement,
            RippleElement
        ]
    }),
    __metadata("design:paramtypes", [])
], ListItemElement);
export { ListItemElement };
//# sourceMappingURL=ListItemElement.js.map