import { TooltipManager } from './TooltipManager'; type OnChangeCallback = (value: string, name: string, dropdown: HTMLElement) => void; export default class DropdownManager { private readonly element; private readonly tooltipManager; private valueChanged; /** * Initializes a new dropdown manager for the given area. * * @param element the area to check for dropdowns */ constructor(element: HTMLElement, tooltipManager: TooltipManager); /** * Sets the callback to call when the value changes. * * @param callback the callback to call */ onChange(callback: OnChangeCallback): void; /** * Returns a list of all the dropdowns in the area. * * @returns HTMLElement[] */ getDropdowns(): HTMLElement[]; /** * Returns a list of the selected values for all the dropdowns. * * @returns { [key: string]: string } */ getValues(): { [key: string]: string; }; /** * Returns the value of the dropdown with the given name. * @param name the name of the dropdown * @returns */ getValueFor(name: string): string; /** * Sets the value of the dropdown with the given name. * @param name the name of the dropdown * @param value the value to set */ setValueFor(name: string, value: string): void; /** * Closes all the dropdowns. */ closeAll(): void; /** * Sets up the event listeners for the dropdowns. * * The event listeners are: * - Click on the dropdown button * - Click on a dropdown option * - Click outside the dropdown * * @private */ private setupEventListeners; /** * Returns a dropdown element with the given name. * * @param name the name of the dropdown */ private getDropdown; /** * Returns the name of the dropdown. * * @param dropdown the dropdown element * @returns string */ private getDropdownName; /** * Marks the dropdown item as selected. */ private markAsSelected; } export {};