import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { FormattedMessage } from "react-intl";
import { Message } from "@gooddata/sdk-ui-kit";
import { AttachmentWidgets } from "./AttachmentItems.js";
import { AttachmentsWrapper } from "./AttachmentsWrapper.js";
export function WidgetAttachments({ widgetFilters, areDashboardFiltersChanged, isCrossFiltering, csvSelected, xlsxSelected, settings, scheduledExportToEdit, onWidgetAttachmentsSelectionChange, onAttachmentsSettingsChange, enableAutomationFilterContext, closeOnParentScroll, overlayPositionType, }) {
    const renderFiltersMessage = !enableAutomationFilterContext;
    const isEditing = !!scheduledExportToEdit;
    const handleWidgetAttachmentSelectionChange = (format) => {
        if (format === "CSV") {
            onWidgetAttachmentsSelectionChange(!csvSelected, format, widgetFilters);
        }
        else {
            onWidgetAttachmentsSelectionChange(!xlsxSelected, format, widgetFilters);
        }
    };
    return (_jsx(AttachmentsWrapper, { children: _jsxs("div", { className: "gd-attachment-list-old", children: [
                _jsx(AttachmentWidgets, { csvSelected: csvSelected, xlsxSelected: xlsxSelected, settings: settings, onSelectionChange: handleWidgetAttachmentSelectionChange, onSettingsChange: onAttachmentsSettingsChange, closeOnParentScroll: closeOnParentScroll, overlayPositionType: overlayPositionType }), renderFiltersMessage &&
                    (isEditing || areDashboardFiltersChanged) &&
                    (csvSelected || xlsxSelected) ? (_jsxs("div", { className: "s-scheduled-email-attachments-filters-message", children: [
                        _jsx(FormattedMessage, { id: "dialogs.schedule.management.attachments.filters.using" }), " ", _jsx(FormattedMessage, { id: "dialogs.schedule.management.attachments.filters.edited" })
                    ] })) : null, isCrossFiltering ? (_jsx(Message, { type: "progress", className: "gd-attachment-list-message", children: _jsx(FormattedMessage, { id: "dialogs.schedule.management.attachments.message", values: {
                            strong: (chunks) => _jsx("strong", { children: chunks }),
                        } }) })) : null] }) }));
}
//# sourceMappingURL=WidgetAttachments.js.map