// dropdown.js - Premium Custom Dropdowns export class CustomSelect { constructor(originalSelect) { if (originalSelect.classList.contains('custom-select-initialized')) return; this.originalSelect = originalSelect; this.originalSelect.classList.add('custom-select-initialized'); // Hide original but keep it accessible for form submissions and JS this.originalSelect.style.display = 'none'; // Bind methods this.handleTriggerClick = this.handleTriggerClick.bind(this); this.closeAll = this.closeAll.bind(this); this.handleItemClick = this.handleItemClick.bind(this); this.rebuildMenu = this.rebuildMenu.bind(this); this.init(); // Watch for dynamic changes (like when api fetching populates