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 { tabTemplate } from './tab.template.js';
import { tabStyles } from './tab.styles.js';
/**
 * ml-tab - Individual tab header for use within ml-tabs
 *
 * @example
 * ```html
 * <ml-tabs>
 *   <ml-tab slot="tab" value="tab1" label="First Tab"></ml-tab>
 *   <ml-tab slot="tab" value="tab2" label="Second Tab" icon="gear"></ml-tab>
 *   <ml-tab slot="tab" value="tab3" label="Disabled" disabled></ml-tab>
 * </ml-tabs>
 * ```
 */
let TabComponent = class TabComponent {
    constructor() {
        /** Tab identifier (must match ml-tab-panel value) */
        this.value = '';
        /** Tab label text */
        this.label = '';
        /** Optional icon name */
        this.icon = '';
        /** Disable this tab */
        this.disabled = false;
        /** Active state (managed by parent ml-tabs) */
        this.active = false;
        /** URL for routed tabs */
        this.href = '';
        /** Handle click on tab */
        this.handleClick = () => {
            if (this.disabled)
                return;
            // Dispatch event for parent ml-tabs to handle
            this.elementRef.dispatchEvent(new CustomEvent('ml:tab-click', {
                bubbles: true,
                composed: true,
                detail: { value: this.value, href: this.href }
            }));
        };
    }
};
TabComponent = __decorate([
    MelodicComponent({
        selector: 'ml-tab',
        template: tabTemplate,
        styles: tabStyles,
        attributes: ['value', 'label', 'icon', 'disabled', 'active', 'href']
    })
], TabComponent);
export { TabComponent };
