{% macro toaster( id="toaster", toasts=[], main_attrs=None, is_fragment=false, include_html=true, include_script=false, register_on=["alpine:init"] ) %} {% if not is_fragment and include_script %} {% include "components/toast-script.njk" %} {% endif %} {% if include_html %} {% set iconMapping = { 'error': 'circle-x', 'success': 'circle-check', 'info': 'info', 'warning': 'circle-alert' } %}
{% for toast in toasts %}
{% if toast.category in ["error", "success", "info", "warning"] %} {% lucide iconMapping[toast.category], class="size-4 shrink-0" %} {% endif %}
{% if toast.message is string %}

{{ toast.message }}

{% elif toast.message is mapping %} {% if toast.message.title %}

{{ toast.message.title }}

{% endif %} {% if toast.message.description %}

{{ toast.message.description }}

{% endif %} {% endif %}
{% if toast.message.action or toast.message.cancel %} {% endif %}
{% endfor %}
{% endif %} {% endmacro %}