import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Dropdown, DropdownList } from "@gooddata/sdk-ui-kit";
import { ConfigurationCategory } from "../ConfigurationCategory.js";
import { SelectionModeButton } from "./SelectionModeButton.js";
import { SelectionModeItem } from "./SelectionModeItem.js";
const ITEM_HEIGHT = 28;
const DROPDOWN_WIDTH = 225;
const ALIGN_POINTS = [
    {
        align: "bl tl",
        offset: { x: 0, y: 1 },
    },
    {
        align: "tl bl",
        offset: { x: 0, y: -1 },
    },
];
export function SelectionMode({ selectionTitleText, multiSelectionOptionText, multiSelectionOptionTooltip, singleSelectionOptionText, singleSelectionDisabledTooltip, selectionMode, onSelectionModeChange, disabled, }) {
    const selectionOptionTitleMap = {
        multi: multiSelectionOptionText,
        single: singleSelectionOptionText,
    };
    const items = ["multi", "single"];
    return (_jsxs(_Fragment, { children: [
            _jsx(ConfigurationCategory, { categoryTitle: selectionTitleText }), _jsx("div", { className: "configuration-selection-mode", children: _jsx(Dropdown, { alignPoints: ALIGN_POINTS, renderButton: ({ isOpen, toggleDropdown }) => (_jsx(SelectionModeButton, { isOpen: isOpen, title: selectionOptionTitleMap[selectionMode], toggleDropdown: toggleDropdown })), renderBody: ({ closeDropdown }) => (_jsx(DropdownList, { className: "attribute-display-form-dropdown-body s-selection-mode-dropdown-body", items: items, itemHeight: ITEM_HEIGHT, width: DROPDOWN_WIDTH, renderItem: ({ item }) => (_jsx(SelectionModeItem, { item: item, itemTitle: selectionOptionTitleMap[item], tooltip: item === "multi" ? multiSelectionOptionTooltip : undefined, selected: item === selectionMode, disabled: item === "single" && disabled, disabledTooltip: singleSelectionDisabledTooltip, onClick: () => {
                                closeDropdown();
                                onSelectionModeChange(item);
                            } })) })) }) })
        ] }));
}
//# sourceMappingURL=SelectionMode.js.map