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 { html, LitElement } from 'lit';
import { property } from 'lit/decorators.js';
import { reset } from '../styles.js';
import { styles } from './styles.js';
/**
 * Tab panel component that holds content for individual tabs.
 * Each tab panel should have a name that matches a corresponding tab.
 *
 * [See Storybook for usage examples](https://warp-ds.github.io/elements/?path=/docs/tabs--docs)
 */
export class WarpTabPanel extends LitElement {
    constructor() {
        super(...arguments);
        this.hidden = true;
    }
    static { this.styles = [reset, styles]; }
    connectedCallback() {
        super.connectedCallback();
        this.setAttribute('tabindex', '-1');
        this.setAttribute('role', 'tabpanel');
        // Set aria-labelledby to reference the corresponding tab
        if (this.name) {
            this.setAttribute('aria-labelledby', `warp-tab-${this.name}`);
            this.setAttribute('id', `warp-tabpanel-${this.name}`);
        }
    }
    updated(changedProperties) {
        if (changedProperties.has('name') && this.name) {
            this.setAttribute('aria-labelledby', `warp-tab-${this.name}`);
            this.setAttribute('id', `warp-tabpanel-${this.name}`);
        }
    }
    render() {
        return html `<slot></slot>`;
    }
}
__decorate([
    property({ reflect: true })
], WarpTabPanel.prototype, "name", void 0);
__decorate([
    property({ type: Boolean, reflect: true })
], WarpTabPanel.prototype, "hidden", void 0);
if (!customElements.get('w-tab-panel')) {
    customElements.define('w-tab-panel', WarpTabPanel);
}
