import { jsx as _jsx } from "react/jsx-runtime";
// (C) 2022-2025 GoodData Corporation
import cx from "classnames";
import { DialogListEmpty } from "./DialogListEmpty.js";
import { DialogListItemBasic } from "./DialogListItemBasic.js";
import { DialogListLoading } from "./DialogListLoading.js";
/**
 * @internal
 */
export function DialogList({ items, isLoading, className, emptyMessageElement, itemComponent, itemClassName, onItemClick, onItemDelete, }) {
    if (isLoading) {
        return _jsx(DialogListLoading, {});
    }
    if (items.length === 0) {
        return _jsx(DialogListEmpty, { message: emptyMessageElement });
    }
    const ListItemComponent = itemComponent ?? DialogListItemBasic;
    const classNames = cx("gd-dialog-list-wrapper s-dialog-list-wrapper", className);
    return (_jsx("div", { className: classNames, children: _jsx("div", { className: "gd-dialog-list", children: items.map((item) => (_jsx(ListItemComponent, { className: itemClassName, item: item, onClick: onItemClick, onDelete: onItemDelete }, item.id))) }) }));
}
