class AliasesBottomSheet extends HTMLElement { constructor() { super(); this.attachShadow({ mode: 'open' }); this.shadowRoot.innerHTML = `

Aliases

Common Aliases

Brand Aliases

`; this.aliasesBottomSheet = this.shadowRoot.getElementById('aliasesSheet'); this.overlay = this.shadowRoot.querySelector('.overlay'); this.closeAliasesBtn = this.shadowRoot.getElementById('closeAliases'); this.closeAliasesBtn.onclick = () => this.hide(); this.overlay.onclick = () => this.hide(); } show(aliases, brand) { const commonAliasesList = this.shadowRoot.getElementById('commonAliasesList'); const brandAliasesList = this.shadowRoot.getElementById('brandAliasesList'); commonAliasesList.innerHTML = ''; brandAliasesList.innerHTML = ''; aliases.aliases.common_aliases.forEach(alias => { const li = document.createElement('li'); li.textContent = alias; commonAliasesList.appendChild(li); }); const brandAliases = aliases.aliases.brand_aliases[brand.key] || []; brandAliases.forEach(alias => { const li = document.createElement('li'); li.textContent = alias; brandAliasesList.appendChild(li); }); this.aliasesBottomSheet.style.display = 'block'; this.overlay.style.display = 'block'; setTimeout(() => this.aliasesBottomSheet.classList.add('show'), 10); } hide() { this.aliasesBottomSheet.classList.remove('show'); setTimeout(() => { this.aliasesBottomSheet.style.display = 'none'; this.overlay.style.display = 'none'; }, 300); // Match with the CSS transition duration } } customElements.define('aliases-bottom-sheet', AliasesBottomSheet);