import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2024-2026 GoodData Corporation
import { useState } from "react";
import { ConfigurationBubble } from "../../../../../../widget/common/configuration/ConfigurationBubble.js";
import { ActionSelectionPage } from "./ActionSelectionPage.js";
import { DateFiltersPage } from "./DateFiltersPage.js";
import { LimitingItemsPage } from "./LimitingItemsPage.js";
import { ParentFiltersPage } from "./ParentFiltersPage.js";
const ALIGN_POINTS = [
    {
        align: "tr tl",
        offset: { x: 3, y: -63 },
    },
    {
        align: "tl tr",
        offset: { x: -3, y: -63 },
    },
];
export function AddLimitingItemDialog({ attributeTitle, currentlySelectedItems, parentFilters, validParentFilters, dependentDateFilters, dependentCommonDateFilter, availableDatasets, commonDateFilterTitle, onSelect, onClose, }) {
    const [page, setPage] = useState("options");
    return (_jsxs(ConfigurationBubble, { alignTo: ".attribute-filter__limit__add-button", alignPoints: ALIGN_POINTS, onClose: onClose, classNames: "attribute-filter__limit__popup", children: [page === "options" ? (_jsx(ActionSelectionPage, { onAddFilters: () => setPage("filters"), onAddLimitingItems: () => setPage("items"), onClose: onClose })) : null, page === "filters" ? (_jsx(ParentFiltersPage, { attributeTitle: attributeTitle, parentFilters: parentFilters, validParentFilters: validParentFilters, onSelect: onSelect, onGoBack: () => setPage("options"), onClose: onClose, dependentDateFilters: dependentDateFilters, availableDatasets: availableDatasets, dependentCommonDateFilter: dependentCommonDateFilter, commonDateFilterTitle: commonDateFilterTitle, onCommonDateSelect: () => setPage("dates") })) : null, page === "items" ? (_jsx(LimitingItemsPage, { currentlySelectedItems: currentlySelectedItems, onSelect: onSelect, onGoBack: () => setPage("options"), onClose: onClose })) : null, page === "dates" ? (_jsx(DateFiltersPage, { onSelect: onSelect, onGoBack: () => setPage("options"), onClose: onClose, availableDatasets: availableDatasets, dependentCommonDateFilter: dependentCommonDateFilter, dependentDateFilters: dependentDateFilters })) : null] }));
}
