UNPKG

@talentsoft-opensource/uxp-themes

Version:

Talentsoft UX themes

32 lines (31 loc) 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ListDropdown = /** @class */ (function () { function ListDropdown($element, $listElement) { this.isOpen = false; this.ddlElement = $element; this.listElement = $listElement; } ListDropdown.prototype.initializeDropDownList = function () { var _this = this; this.ddlElement.addEventListener('click', function (event) { _this.toggleDropDown(); }); }; ListDropdown.prototype.toggleDropDown = function () { this.listElement.classList.toggle('list-dropdown--hidden'); var $icon = this.ddlElement.querySelector('.dropdown__icon'); if (this.isOpen && $icon) { $icon.classList.remove('icon-top'); $icon.classList.add('icon-bottom'); this.isOpen = false; } else if ($icon) { $icon.classList.remove('icon-bottom'); $icon.classList.add('icon-top'); this.isOpen = true; } }; return ListDropdown; }()); exports.default = ListDropdown;