import { r as registerInstance, h, g as getElement } from './index-e78ba223.js';

const EclTimelineItem = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.theme = 'ec';
        this.styleClass = undefined;
        this.label = undefined;
        this.type = undefined;
        this.itemTitle = undefined;
    }
    getClass() {
        const styleClasses = [
            `ecl-timeline__item`,
            `sc-ecl-timeline-${this.theme}`,
            this.styleClass
        ];
        if (this.type === 'toggle') {
            styleClasses.push(`ecl-timeline__item--toggle`);
        }
        return styleClasses.join(' ');
    }
    componentDidRender() {
        const element = this.el;
        let previousSibling = element.previousElementSibling;
        while (previousSibling) {
            if (previousSibling instanceof HTMLElement && previousSibling.getAttribute('type') === 'toggle') {
                this.el.firstElementChild.classList.add('ecl-timeline__item--collapsed');
                break;
            }
            previousSibling = previousSibling.previousElementSibling;
        }
    }
    render() {
        return (h("li", { class: this.getClass() }, this.type !== 'toggle' ?
            h("div", { class: `ecl-timeline__tooltip sc-ecl-timeline-${this.theme}` }, h("div", { class: `ecl-timeline__tooltip-arrow sc-ecl-timeline-${this.theme}` }), this.label ?
                h("div", { class: `ecl-timeline__label sc-ecl-timeline-${this.theme}` }, this.label) : '', this.itemTitle ?
                h("div", { class: `ecl-timeline__title sc-ecl-timeline-${this.theme}` }, this.itemTitle) : '', h("div", { class: `ecl-timeline__content sc-ecl-timeline-${this.theme}` }, h("slot", null))) : '', this.type === 'toggle' ?
            h("ecl-button", { theme: this.theme, variant: "secondary", "data-ecl-timeline-button": true, styleClass: `sc-ecl-timeline-${this.theme}` }, h("ecl-icon", { styleClass: `ecl-button__icon--after sc-ecl-timeline-${this.theme}`, icon: "corner-arrow", size: "xs", transform: "rotate-180", slot: "icon-after", theme: this.theme }), h("slot", null)) : ''));
    }
    get el() { return getElement(this); }
};

export { EclTimelineItem as ecl_timeline_item };

//# sourceMappingURL=ecl-timeline-item.entry.js.map