/** * Footer Accordion Item Component * Expandable accordion item for footer navigation */ class FooterAccordionItem extends HTMLElement { static _idCounter = 0; constructor() { super(); this.attachShadow({ mode: "open" }); this._expanded = false; this._uniqueId = `accordion-${FooterAccordionItem._idCounter++}`; } static get observedAttributes() { return ["title"]; } connectedCallback() { this.render(); this.setupEventListeners(); } attributeChangedCallback() { this.render(); this.setupEventListeners(); } setupEventListeners() { const header = this.shadowRoot.querySelector(".accordion-header"); if (header) { header.addEventListener("click", () => this.toggle()); } } toggle() { this._expanded = !this._expanded; const content = this.shadowRoot.querySelector(".accordion-content"); const icon = this.shadowRoot.querySelector(".accordion-icon"); const header = this.shadowRoot.querySelector(".accordion-header"); if (content) { content.classList.toggle("expanded", this._expanded); } if (icon) { icon.classList.toggle("rotated", this._expanded); } if (header) { header.setAttribute("aria-expanded", this._expanded.toString()); } } render() { const title = this.getAttribute("title") || ""; this.shadowRoot.innerHTML = `
`; } } customElements.define("footer-accordion-item", FooterAccordionItem);