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;
};
import { MelodicComponent } from '@melodicdev/core';
import { tagTemplate } from './tag.template.js';
import { tagStyles } from './tag.styles.js';
/**
 * ml-tag - Compact element for labeling, categorizing, and organizing items
 *
 * @example
 * ```html
 * <ml-tag>Label</ml-tag>
 * <ml-tag avatar-src="photo.jpg">Label</ml-tag>
 * <ml-tag dot closable>Label</ml-tag>
 * <ml-tag count="5">Label</ml-tag>
 * <ml-tag checkable>Label</ml-tag>
 * ```
 *
 * @slot default - Tag label content
 * @fires ml:close - Fired when the close button is clicked
 * @fires ml:change - Fired when checkbox state changes (when checkable)
 */
let TagComponent = class TagComponent {
    constructor() {
        /** Tag size */
        this.size = 'md';
        /** Show dot indicator */
        this.dot = false;
        /** Dot color */
        this['dot-color'] = 'success';
        /** Show close button */
        this.closable = false;
        /** Avatar image source */
        this['avatar-src'] = '';
        /** Icon name (Phosphor icon) */
        this.icon = '';
        /** Count value displayed on the right */
        this.count = '';
        /** Show checkbox */
        this.checkable = false;
        /** Checkbox checked state */
        this.checked = false;
        /** Disabled state */
        this.disabled = false;
        /** Handle close button click */
        this.handleClose = (event) => {
            event.stopPropagation();
            if (this.disabled)
                return;
            this.elementRef.dispatchEvent(new CustomEvent('ml:close', {
                bubbles: true,
                composed: true
            }));
        };
        /** Handle checkbox change */
        this.handleCheck = (event) => {
            event.stopPropagation();
            if (this.disabled)
                return;
            this.checked = !this.checked;
            this.elementRef.dispatchEvent(new CustomEvent('ml:change', {
                bubbles: true,
                composed: true,
                detail: { checked: this.checked }
            }));
        };
    }
};
TagComponent = __decorate([
    MelodicComponent({
        selector: 'ml-tag',
        template: tagTemplate,
        styles: tagStyles,
        attributes: ['size', 'dot', 'dot-color', 'closable', 'avatar-src', 'icon', 'count', 'checkable', 'checked', 'disabled']
    })
], TagComponent);
export { TagComponent };
