import Color from "../../../Types/Color";
import { Black, White } from "../../../Types/BrandColors";
import IconProp from "../../../Types/Icon/IconProp";
import Icon from "../Icon/Icon";
import Tooltip from "../Tooltip/Tooltip";
import React from "react";
const RoleLabel = (props) => {
    const resolvedColor = props.color || Black;
    // Convert string icon to IconProp if needed
    const resolvedIcon = (() => {
        if (!props.icon) {
            return undefined;
        }
        if (typeof props.icon === "string") {
            // Check if it's a valid IconProp value
            if (Object.values(IconProp).includes(props.icon)) {
                return props.icon;
            }
            return undefined;
        }
        return props.icon;
    })();
    const iconColor = Color.shouldUseDarkText(resolvedColor)
        ? Black
        : White;
    const element = (React.createElement("div", { className: "flex items-center gap-2" },
        resolvedIcon ? (React.createElement("div", { className: "flex items-center justify-center h-6 w-6 rounded-md flex-shrink-0", style: {
                backgroundColor: resolvedColor.toString(),
            } },
            React.createElement(Icon, { icon: resolvedIcon, className: "h-4 w-4", color: iconColor }))) : (React.createElement("div", { className: "h-3 w-3 rounded-full flex-shrink-0", style: {
                backgroundColor: resolvedColor.toString(),
            }, "aria-hidden": "true" })),
        React.createElement("span", { className: "text-sm font-medium text-gray-900" }, props.name)));
    if (props.description) {
        return React.createElement(Tooltip, { text: props.description }, element);
    }
    return element;
};
export default RoleLabel;
//# sourceMappingURL=RoleLabel.js.map