import { jsx, jsxs } from "react/jsx-runtime";
import { Button } from "@uipath/apollo-wind";
import { memo } from "react";
import { TOOLBOX_PADDING_X } from "../../constants.js";
import { CanvasTooltip } from "../CanvasTooltip.js";
function QuickActionButton({ action, wide }) {
    return /*#__PURE__*/ jsx(CanvasTooltip, {
        content: action.title,
        children: /*#__PURE__*/ jsx(Button, {
            type: "button",
            variant: "ghost",
            size: "icon",
            className: wide ? 'h-9 w-14 aspect-auto [&_svg]:size-6' : 'h-9 w-9 [&_svg]:size-6',
            "aria-label": action.title,
            disabled: action.disabled,
            onClick: action.onClick,
            onMouseEnter: action.onMouseEnter,
            onMouseLeave: action.onMouseLeave,
            "data-testid": `toolbox-quick-action-${action.id}`,
            children: action.icon
        })
    });
}
const QuickActionsRow_QuickActionsRow = /*#__PURE__*/ memo(function({ actions }) {
    if (!actions.length) return null;
    const leading = actions.filter((a)=>!a.trailing);
    const trailing = actions.filter((a)=>a.trailing);
    return /*#__PURE__*/ jsxs("div", {
        className: "flex items-center justify-center gap-3 min-h-11 pb-2 border-b border-border shrink-0",
        style: {
            paddingInline: TOOLBOX_PADDING_X,
            marginInline: -TOOLBOX_PADDING_X
        },
        "data-testid": "toolbox-quick-actions",
        children: [
            leading.map((action)=>/*#__PURE__*/ jsx(QuickActionButton, {
                    action: action
                }, action.id)),
            trailing.length > 0 && leading.length > 0 && /*#__PURE__*/ jsx("div", {
                className: "w-px self-stretch mx-1 bg-border shrink-0",
                "data-testid": "toolbox-quick-actions-separator"
            }),
            trailing.map((action)=>/*#__PURE__*/ jsx(QuickActionButton, {
                    action: action,
                    wide: true
                }, action.id))
        ]
    });
});
export { QuickActionsRow_QuickActionsRow as QuickActionsRow };
