/**
 * Alpine Dropdown Component
 */
export function registerDropdown(Alpine) {
    Alpine.data('dropdown', () => ({
        open: false,
        init() {
            document.addEventListener('keydown', (e) => {
                if (e.key === 'Escape' && this.open) this.close();
            });
        },
        toggle() { this.open = !this.open; },
        show() { this.open = true; },
        close() { this.open = false; },
    }));
}
