import { jsx as _jsx } from "react/jsx-runtime";
import React from "react";
import { cn } from "../../../utils/cn";
const spacingStyles = {
    sm: "gap-1",
    md: "gap-2",
    lg: "gap-4",
};
export const ButtonGroup = ({ children, className, orientation = "horizontal", spacing = "md", testId, }) => {
    return (_jsx("div", { className: cn("flex", orientation === "horizontal" ? "flex-row" : "flex-col", spacingStyles[spacing], className), role: "group", "data-testid": testId, children: React.Children.map(children, (child, index) => {
            if (React.isValidElement(child)) {
                return React.cloneElement(child, {
                    testId: testId ? `${testId}.button.${index}` : undefined,
                });
            }
            return child;
        }) }));
};
export default ButtonGroup;
