var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
import React, { useContext } from 'react';
import { useEmotion, useStyles } from '../../lib/renderEnvironment/index.js';
import { ThemeContext } from '../../lib/theming/ThemeContext.js';
import { ArrowRightIcon } from './ArrowRightIcon.js';
import { ArrowLeftIcon } from './ArrowLeftIcon.js';
import { globalClasses, getStyles } from './Button.styles.js';
var ButtonArrow = function (_a) {
    var arrow = _a.arrow, size = _a.size;
    var theme = useContext(ThemeContext);
    var cx = useEmotion().cx;
    var styles = useStyles(getStyles);
    var getArrowIconRootClassName = function () {
        var _a;
        return cx(styles.arrowIconRoot(), globalClasses.arrow, (_a = {},
            _a[styles.arrowIconRootSmall(theme)] = size === 'small',
            _a[styles.arrowIconRootMedium(theme)] = size === 'medium',
            _a[styles.arrowIconRootLarge(theme)] = size === 'large',
            _a[styles.arrowIconLeft()] = arrow === 'left',
            _a));
    };
    var arrowIcons = {
        right: ArrowRightIcon,
        left: ArrowLeftIcon,
    };
    var side = arrow === 'left' ? 'left' : 'right';
    var ArrowIcon = arrowIcons[side];
    var arrowNode = (React.createElement("div", { className: getArrowIconRootClassName() },
        React.createElement(ArrowIcon, { size: size })));
    return arrowNode;
};
export function useButtonArrow(props, theme, styles, cx) {
    var arrow = props.arrow, size = props.size, use = props.use;
    var canRender = use !== 'link' && (arrow === true || arrow === 'left');
    var rootClassName = canRender
        ? cx(arrow === true && size === 'small' && styles.withArrowIconRightSmall(theme), arrow === true && size === 'medium' && styles.withArrowIconRightMedium(theme), arrow === true && size === 'large' && styles.withArrowIconRightLarge(theme), arrow === 'left' && size === 'small' && styles.withArrowIconLeftSmall(theme), arrow === 'left' && size === 'medium' && styles.withArrowIconLeftMedium(theme), arrow === 'left' && size === 'large' && styles.withArrowIconLeftLarge(theme))
        : '';
    var arrowNode = canRender ? React.createElement(ButtonArrow, __assign({}, props)) : null;
    return [rootClassName, arrowNode];
}
//# sourceMappingURL=ButtonArrow.js.map