import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { FormattedMessage } from "react-intl";
import { DrillAttributeSelectorList } from "./DrillAttributeSelectorList.js";
import { DrillMeasureSelectorList } from "./DrillMeasureSelectorList.js";
export function DrillOriginSelectorBody({ onCloseDropdown, onSelect, supportedItems, }) {
    const stopPropagation = (e) => {
        e.stopPropagation();
    };
    return (_jsxs("div", { className: "gd-drill-item-selector-dropdown s-drill-item-selector-dropdown", onScroll: stopPropagation, children: [
            _jsxs("div", { className: "gd-drill-item-selector-header", children: [
                    _jsx(FormattedMessage, { id: "configurationPanel.drillConfig.clickHint" }), _jsx("button", { className: "gd-button-link gd-button-icon-only gd-icon-cross", onClick: onCloseDropdown })
                ] }), _jsxs("div", { className: "gd-drill-item-selector-body", children: [
                    _jsx(DrillMeasureSelectorBody, { supportedItems: supportedItems, onSelect: onSelect, onCloseDropdown: onCloseDropdown }), _jsx(DrillAttributeSelectorBody, { supportedItems: supportedItems, onSelect: onSelect, onCloseDropdown: onCloseDropdown })
                ] })
        ] }));
}
function DrillMeasureSelectorBody({ supportedItems, onSelect, onCloseDropdown, }) {
    return supportedItems.measures?.length ? (_jsxs(_Fragment, { children: [
            _jsx("div", { className: "gd-drill-origin-selector-separator", children: _jsx("span", { children: _jsx(FormattedMessage, { id: "configurationPanel.drillConfig.measureValue" }) }) }), _jsx(DrillMeasureSelectorList, { supportedItems: supportedItems.measures, onSelect: onSelect, onCloseDropdown: onCloseDropdown })
        ] })) : null;
}
function DrillAttributeSelectorBody({ supportedItems, onSelect, onCloseDropdown, }) {
    return supportedItems.attributes?.length ? (_jsxs(_Fragment, { children: [
            _jsx("div", { className: "gd-drill-origin-selector-separator", children: _jsx("span", { children: _jsx(FormattedMessage, { id: "configurationPanel.drillConfig.attributeValue" }) }) }), _jsx(DrillAttributeSelectorList, { supportedItems: supportedItems.attributes, onSelect: onSelect, onCloseDropdown: onCloseDropdown })
        ] })) : null;
}
