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 { buttonGroupItemTemplate } from './button-group-item.template.js';
import { buttonGroupItemStyles } from './button-group-item.styles.js';
/**
 * ml-button-group-item - Individual item within a button group
 *
 * @example
 * ```html
 * <ml-button-group-item value="list" icon="list">List View</ml-button-group-item>
 * ```
 *
 * @slot default - Button label content
 */
let ButtonGroupItemComponent = class ButtonGroupItemComponent {
    constructor() {
        /** Item value identifier */
        this.value = '';
        /** Optional icon name */
        this.icon = '';
        /** Disable this item */
        this.disabled = false;
        /** Active state (managed by parent via attribute) */
        this.active = false;
        /** Disabled state from parent group */
        this.groupDisabled = false;
        /** Size from parent group */
        this.groupSize = 'md';
        this.handleClick = () => {
            if (this.isDisabled)
                return;
            this.elementRef.dispatchEvent(new CustomEvent('ml:item-click', {
                bubbles: true,
                composed: true,
                detail: { value: this.value }
            }));
        };
    }
    get isDisabled() {
        return this.disabled || this.groupDisabled;
    }
};
ButtonGroupItemComponent = __decorate([
    MelodicComponent({
        selector: 'ml-button-group-item',
        template: buttonGroupItemTemplate,
        styles: buttonGroupItemStyles,
        attributes: ['value', 'icon', 'disabled', 'active', 'group-disabled', 'group-size']
    })
], ButtonGroupItemComponent);
export { ButtonGroupItemComponent };
