import React, { Children, isValidElement } from 'react';
import { SplitActionContext } from './SplitActionContext';
import { st, classes } from './SplitAction.st.css.js';
import Divider from '../Divider';
export const SplitAction = (props) => {
    const { children, className, dataHook, skin, priority, size, disabled } = props;
    const sharedProps = { skin, priority, size, disabled };
    return (React.createElement("div", { className: st(classes.root, { size }, className), "data-hook": dataHook }, Children.map(children, (child, index) => {
        if (!isValidElement(child)) {
            return child;
        }
        return (React.createElement(SplitActionContext.Provider, { value: {
                ...sharedProps,
            } },
            index > 0 && (React.createElement(Divider, { direction: "vertical", className: st(classes.divider), skin: sharedProps.priority === 'secondary' && !sharedProps.skin
                    ? 'standard'
                    : sharedProps.skin === 'inverted'
                        ? 'standard'
                        : sharedProps.skin === 'transparent'
                            ? 'light'
                            : sharedProps.skin })),
            React.createElement("div", { className: classes.item }, child)));
    })));
};
SplitAction.displayName = 'SplitAction';
export default SplitAction;
//# sourceMappingURL=SplitAction.js.map