import { jsx as _jsx } from "react/jsx-runtime";
// (C) 2021-2025 GoodData Corporation
import { useMemo } from "react";
import { UserItem } from "./UserItem.js";
import { UsersListEmpty } from "./UsersListEmpty.js";
import { sortByName } from "../utils.js";
export function UsersList({ users, mode, onDelete, isBootstrapUserGroup, bootstrapUserId }) {
    const sortedUsers = useMemo(() => {
        return users ? [...users].sort(sortByName) : [];
    }, [users]);
    if (sortedUsers.length === 0) {
        return _jsx(UsersListEmpty, { mode: mode });
    }
    return (_jsx("div", { className: "gd-share-dialog-grantee-list s-user-management-users-list", children: sortedUsers.map((user) => {
            const isDeleteDisabled = isBootstrapUserGroup && user.id === bootstrapUserId;
            return (_jsx(UserItem, { user: user, onDelete: onDelete, isDeleteDisabled: isDeleteDisabled, mode: mode }, user.id));
        }) }));
}
//# sourceMappingURL=UsersList.js.map