{#
/**
 * @file
 * Gutenberg Base theme override for status messages.
 *
 * Displays status, error, and warning messages, grouped by type.
 *
 * Available variables:
 * - message_list: List of messages to be displayed, grouped by type.
 * - status_headings: List of all status types.
 * - attributes: HTML attributes for the element, including:
 *   - class: HTML classes.
 */
#}
<div data-drupal-messages class="messages-list">
  <div class="messages__wrapper">
    {% for type, messages in message_list %}
      {%
        set classes = [
          'messages',
          'messages--' ~ type,
        ]
      %}
      <div{{ attributes
        .addClass(classes)
        .setAttribute('data-drupal-selector', 'messages')
        .setAttribute('role', type == 'error' ? 'alert' : 'status')
        .setAttribute('aria-label', status_headings[type])
      }}>
        {% if status_headings[type] %}
          <h2 class="visually-hidden">{{ status_headings[type] }}</h2>
        {% endif %}
        <div class="messages__content">
          {% if messages|length > 1 %}
            <ul class="messages__list">
              {% for message in messages %}
                <li class="messages__item">{{ message }}</li>
              {% endfor %}
            </ul>
          {% else %}
            {{ messages|first }}
          {% endif %}
        </div>
      </div>
      {% set attributes = attributes.removeClass(classes) %}
    {% endfor %}
  </div>
</div>
