import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2023-2025 GoodData Corporation
import cx from "classnames";
import { useIntl } from "react-intl";
import { Bubble, BubbleHoverTrigger } from "@gooddata/sdk-ui-kit";
import { messages } from "../locales.js";
function GranteeUserIcon() {
    return (_jsx("div", { className: "gd-grantee-item-icon-left-background", children: _jsx("span", { className: "gd-grantee-item-icon gd-grantee-icon-user gd-grantee-item-icon-left" }) }));
}
const alignPoints = [{ align: "cr cl" }];
function RemoveIcon({ mode, onClick, isDisabled }) {
    const intl = useIntl();
    return (_jsxs(BubbleHoverTrigger, { showDelay: 0, hideDelay: 0, className: "gd-grantee-item-delete", children: [_jsx("span", { className: cx("gd-grantee-item-icon gd-grantee-icon-trash gd-grantee-item-icon-right s-user-management-item-delete", { "is-disabled": isDisabled }), onClick: isDisabled ? undefined : onClick, "aria-label": "Group dialog user member delete" }), _jsx(Bubble, { className: "bubble-primary", alignPoints: alignPoints, children: mode === "VIEW"
                    ? intl.formatMessage(isDisabled
                        ? messages.removeSavedUserDisabledTooltip
                        : messages.removeSavedUserTooltip)
                    : intl.formatMessage(messages.removeUnsavedUserTooltip) })] }));
}
export function UserItem({ mode, onDelete, user, isDeleteDisabled }) {
    const itemClassName = cx("s-user-management-item", "gd-share-dialog-grantee-item");
    return (_jsxs("div", { className: itemClassName, children: [_jsx(RemoveIcon, { mode: mode, onClick: () => onDelete(user), isDisabled: !!isDeleteDisabled }), _jsxs("div", { className: "gd-grantee-content", children: [_jsx("div", { className: "gd-grantee-content-label", children: user.title }), _jsx("div", { className: "gd-grantee-content-label gd-grantee-content-email", children: user.email })] }), _jsx(GranteeUserIcon, {})] }));
}
//# sourceMappingURL=UserItem.js.map