{# The body of a row's actions dropdown.

   Shared by the lazy fragment ({@see ListActionsController}) and by the eager
   fallback in _list_row / _list_item, so both render the same markup.

   Expects `actions`: the already-filtered, displayed menu items. #}
{% set sections = actions|map(a => a.extra('section', 'default'))|reduce((unique, s) => s in unique ? unique : unique|merge([s]), []) %}
{% for section in sections %}
    <div class="py-1">
        {% for action in actions|filter(a => a.extra('section', 'default') == section) %}
            {% set itemAttrs = action.extra('attr', [])|merge(action.linkAttributes|default([])) %}
            <twig:Admin:DropdownItem
                href="{{ action.uri }}"
                :attributes="itemAttrs"
                :method="action.extra('method', 'get')"
            >
                {% trans_default_domain 'admin' %}
                <span class="mr-1.5 size-4 flex-shrink-0 {{ action.extra('color') }}">{{ action.extra('icon') ? ux_icon('ph:'~action.extra('icon')) }}</span>
                {%- set label = action.label -%}
                {%- set label = label|trans(action.extra('translation_params', {})) -%}
                <span class="text-left leading-tight">{{ label }}</span>
            </twig:Admin:DropdownItem>
        {% endfor %}
    </div>
{% endfor %}
