{% comment %} Nested dropdown menu item. Parameters: - text : trigger text - icon : optional trigger icon class - class : additional classes for the trigger row - menu_class : additional classes for the nested menu - width : custom width class for the nested menu (default: w-56) - direction : "right", "left", or "auto" (default: "auto") - disabled : whether the submenu trigger is disabled - event_name : event name used to coordinate submenu open/close state (default: "dropdown-submenu-open") {% endcomment %}
= menuWidth + 16 ? 'right' : 'left'; } let nextLeft = this.openDirection === 'left' ? triggerRect.left - menuWidth - 8 : triggerRect.right + 8; if (nextLeft + menuWidth > viewportWidth - viewportPadding) { nextLeft = viewportWidth - viewportPadding - menuWidth; } if (nextLeft < viewportPadding) { nextLeft = viewportPadding; } let nextTop = triggerRect.top; const menuBottom = nextTop + menuHeight; if (menuBottom > viewportHeight - viewportPadding) { nextTop = viewportHeight - viewportPadding - menuHeight; } if (nextTop < viewportPadding) { nextTop = viewportPadding; } this.panelLeft = nextLeft; this.panelTop = nextTop; } }" @dropdown-close="open = false" @dropdown-close.window="open = false" @{{ event_name|default:'dropdown-submenu-open' }}.window="if ($event.detail !== submenuId) open = false" >