'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var React = require('react');
var index$1 = require('../../../Button/index.js');
var useKeyPress = require('../../../../hooks/useKeyPress.js');
var styles = require('./styles.js');
var index = require('../header/index.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

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

exports.ActionButtons = ActionButtons;
