import React__default, { useRef, useEffect } from 'react';
import { Button } from '../../../Button/index.js';
import { useKeyPress } from '../../../../hooks/useKeyPress.js';
import { Wrapper } from './styles.js';
import { previousMonthButton } from '../header/index.js';

function ActionButtons({ narrow = false, dismissText, confirmText, onConfirm, onDismiss, 'data-testid': dataTestId, }) {
    const ref = useRef(null);
    const tabPressed = useKeyPress('Tab', ref);
    useEffect(() => {
        if (ref.current === document.activeElement) {
            const prevMonthButton = document.getElementsByClassName(previousMonthButton)[0];
            if (prevMonthButton) {
                prevMonthButton.focus();
            }
        }
    }, [tabPressed]);
    return (React__default.createElement(Wrapper, { narrow: narrow, "data-testid": dataTestId },
        React__default.createElement(Button, { variant: "ghost", size: "medium", onClick: onDismiss }, dismissText),
        React__default.createElement(Button, { size: "medium", onClick: onConfirm, ref: ref }, confirmText)));
}

export { ActionButtons };
