import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2023-2025 GoodData Corporation
import { useCallback } from "react";
import { defineMessages } from "react-intl";
import { ItemsWrapper, Overlay } from "@gooddata/sdk-ui-kit";
import { HierarchicalPermissionDropdownItem } from "./HierarchicalPermissionDropdownItem.js";
const messages = defineMessages({
    enabled: { id: "userManagement.workspace.hierarchicalPermission.yes.tooltip" },
    disabled: { id: "userManagement.workspace.hierarchicalPermission.no.tooltip" },
});
const overlayAlignPoints = [{ align: "br tr" }];
export function PermissionsDropdownList({ alignTo, isShowDropdown, selectedPermission, toggleDropdown, onSelect, }) {
    const handleOnSelect = useCallback((hierarchical) => {
        onSelect(hierarchical);
        toggleDropdown();
    }, [onSelect, toggleDropdown]);
    if (!isShowDropdown) {
        return null;
    }
    return (_jsx(Overlay, { alignTo: alignTo, alignPoints: overlayAlignPoints, className: "s-user-management-permissions-overlay", closeOnMouseDrag: true, closeOnOutsideClick: true, closeOnParentScroll: true, onClose: toggleDropdown, children: _jsxs(ItemsWrapper, { smallItemsSpacing: true, children: [_jsx(HierarchicalPermissionDropdownItem, { isHierarchicalPermission: false, selectedPermission: selectedPermission, toggleDropdown: toggleDropdown, onSelect: handleOnSelect, bubbleTextId: messages.disabled.id }), _jsx(HierarchicalPermissionDropdownItem, { isHierarchicalPermission: true, selectedPermission: selectedPermission, toggleDropdown: toggleDropdown, onSelect: handleOnSelect, bubbleTextId: messages.enabled.id })] }) }, "GranularPermissionsSelect"));
}
//# sourceMappingURL=HierarchicalPermissionsDropdownList.js.map