{# templates/widgets/input/button_list.html.j2 #}
{% from "widgets/partials/card_header.html.j2" import render_card_header %}
{% from "widgets/widget_renderer.html.j2" import render_widget %}


{% macro render_button_list(widget, request, depth=0) %}

    <div class="card" id="{{ widget.widget_id }}">
        {{ render_card_header(widget) }}

        <div id="collapse-{{ widget.widget_id }}" class="card-body collapse show">
            {% if widget.buttons %}
                <div class="{{ widget.list_classes }}"
                     {% if widget.style == 'group' %}role="group"
                     aria-label="{{ widget.display_title or 'Button group' }}"{% endif %}>
                    {% for button in widget.buttons %}
                        {{ render_widget(button, request, depth + 1) }}
                    {% endfor %}
                </div>
            {% else %}
                <div class="button-list-empty text-muted text-center py-3">
                    <i class="ti ti-info-circle me-2"></i>
                    <small>No buttons available</small>
                </div>
            {% endif %}
        </div>
    </div>
{% endmacro %}
