import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { components as ReactSelectComponents, } from "react-select";
import { LoadingMask, Typography } from "@gooddata/sdk-ui-kit";
import { isGrantedUserGroup, isSelectErrorOption, } from "../types.js";
import { getUserGroupItemTestId } from "../utils.js";
export function EmptyRenderer() {
    return null;
}
export function LoadingMessageRenderer() {
    return (_jsx("div", { className: "gd-share-dialog-loading-mask-container", children: _jsx(LoadingMask, { size: "small" }) }));
}
export function NoOptionsMessageRenderer(props) {
    return (_jsx("div", { className: "s-user-management-no-option", "aria-label": "Share dialog no match", children: _jsx(ReactSelectComponents.NoOptionsMessage, { ...props }) }));
}
export function MenuListRendered(props) {
    return (_jsx(ReactSelectComponents.MenuList, { ...props, children: _jsx("div", { className: "s-user-management-dialog-menu", "aria-label": "Share dialog menu list", children: props.children }) }));
}
export function InputRendered(props) {
    return (_jsx("div", { className: "gd-share-dialog-input s-user-management-input", children: _jsx(ReactSelectComponents.Input, { ...props }) }));
}
function OptionContentRenderer(item) {
    return _jsxs(_Fragment, { children: [" ", item.label, " "] });
}
export function ErrorOptionRenderer(errorOption) {
    return (_jsx("div", { className: "gd-share-dialog-option-error s-user-management-option-error", "aria-label": "Share dialog error", children: _jsx("span", { className: "gd-share-dialog-option-error-content", children: errorOption.label }) }));
}
export function OptionRenderer({ className, cx, isFocused, innerRef, innerProps, data, }) {
    if (isSelectErrorOption(data)) {
        return ErrorOptionRenderer(data);
    }
    const sTestStyle = isGrantedUserGroup(data.value) ? getUserGroupItemTestId(data.value) : "";
    const componentStyle = cx({
        option: true,
        "option--is-focused": isFocused,
    }, className);
    return (_jsx("div", { ref: innerRef, className: `${componentStyle} ${sTestStyle}`, ...innerProps, children: _jsx("div", { className: "option-content", children: OptionContentRenderer(data) }) }));
}
export function GroupHeadingRenderer(props) {
    const { label } = props.data;
    return (_jsx("div", { className: "gd-share-dialog-select-group-heading", children: _jsx(Typography, { tagName: "h3", children: label }) }));
}
//# sourceMappingURL=AsyncSelectComponents.js.map