import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Tooltip, TooltipContent, TooltipTrigger, } from "../../components/ui/tooltip";
import { cn } from "../../lib/utils";
import React from "react";
function renderWorkspaceIcon(icon) {
    if (!React.isValidElement(icon)) {
        return icon;
    }
    return React.cloneElement(icon, {
        className: "h-5 w-5",
        strokeWidth: 1,
    });
}
export const WorkspaceButton = ({ active, onClick, workspace, numberKey, showSidebarLabels = false, }) => {
    return (_jsxs(Tooltip, { delayDuration: 500, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs("button", { type: "button", "aria-label": workspace.title, "aria-current": active ? "page" : undefined, "data-testid": `workspace-rail-${workspace.id}`, className: cn("flex shrink-0 flex-col items-center justify-center rounded-md border transition-colors", showSidebarLabels
                        ? "h-auto min-h-11 w-full gap-0.5 px-1 py-1.5"
                        : "h-9 w-9", active
                        ? "border-border-default bg-neutral-grey-5 text-neutral-grey-100"
                        : "text-neutral-grey-50 hover:border-border-default hover:bg-neutral-grey-5 hover:text-neutral-grey-100 border-transparent"), onClick: () => onClick(workspace.id), children: [_jsx("div", { className: cn("relative", showSidebarLabels ? "p-0.5" : ""), children: renderWorkspaceIcon(workspace.icon) }), showSidebarLabels && (_jsx("span", { className: "mt-0.5 max-w-full text-center text-[10px] leading-tight font-medium wrap-break-word", children: workspace.title }))] }) }), _jsxs(TooltipContent, { side: "right", children: [workspace.title, numberKey ? ` (Alt+${numberKey})` : ""] })] }));
};
//# sourceMappingURL=WorkspaceButton.js.map