{% block sw_theme_modal %}
    <sw-modal
        class="sw-theme-modal"
        @modal-close="closeModal"
        :title="$tc('sw-theme-manager.themeModal.modalTitle')"
        :subtitle="$tc('sw-theme-manager.themeModal.modalSubtitle')"
    >

        {% block sw_theme_modal_header %}
            <div class="sw-theme-modal__header">
                <sw-card-section class="sw-theme-modal__header-search">
                    <sw-container>
                        <sw-simple-search-field
                            class="sw-theme-modal__header-search"
                            variant="form"
                            :placeholder="$tc('sw-theme-manager.general.placeholderSearchBar')"
                            @search-term-change="onSearch"
                        ></sw-simple-search-field>
                    </sw-container>
                </sw-card-section>

                {# @deprecated tag:v6.7.0 - This block will be removed #}
                {% block sw_theme_modal_header_title %}
                {% endblock %}

                {# @deprecated tag:v6.7.0 - This block will be removed #}
                {% block sw_theme_modal_header_search %}
                {% endblock %}

            </div>
        {% endblock %}

        {% block sw_theme_modal_content %}
            <div class="sw-theme-modal__content">
                {% block sw_theme_modal_loader %}
                    <sw-loader v-if="isLoading"></sw-loader>
                {% endblock %}

                {% block sw_theme_modal_content %}
                    <sw-container v-else columns="repeat(auto-fill, minmax(250px, 1fr))" gap="24px">
                        {% block sw_theme_modal_content_listing %}
                            <div v-for="theme in themes" class="sw-theme-modal__content-item" :class="{ 'is--selected': theme.id === selected }">
                                {% block sw_theme_modal_content_listing_item %}

                                    {% block sw_theme_modal_content_listing_item_checkbox %}
                                        <sw-checkbox-field @update:value="onSelection(theme.id)" :value="theme.id === selected"></sw-checkbox-field>
                                    {% endblock %}

                                    {% block sw_theme_modal_content_listing_item_inner %}
                                        <sw-theme-list-item
                                            :theme="theme"
                                            :key="theme.id"
                                            @item-click="selectItem(theme.id)">
                                        </sw-theme-list-item>
                                    {% endblock %}

                                {% endblock %}
                            </div>
                        {% endblock %}
                    </sw-container>
                {% endblock %}
            </div>
        {% endblock %}

        {% block sw_theme_modal_footer %}
            <template #modal-footer>
                <sw-button @click="closeModal">
                    {{ $tc('sw-theme-manager.themeModal.actionCancel') }}
                </sw-button>
                <sw-button @click="selectLayout" variant="primary">
                    {{ $tc('sw-theme-manager.themeModal.actionConfirm') }}
                </sw-button>
            </template>
        {% endblock %}

    </sw-modal>
{% endblock %}
