"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CustomDayPicker = CustomDayPicker;
exports.default = void 0;
exports.formatMonthCaption = formatMonthCaption;

var _react = _interopRequireDefault(require("react"));

var _CustomDayPickerCaption = _interopRequireDefault(require("./CustomDayPickerCaption"));

var _format = _interopRequireDefault(require("date-fns/format"));

var _reactDayPicker = require("react-day-picker");

var _Icons = require("../Icons");

var _i18n = require("../i18n");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

/**
 * The default formatter for the Month caption.
 */
function formatMonthCaption(month, options) {
  return (0, _format.default)(month, 'LLL', options);
}

function CustomDayPicker(props) {
  return /*#__PURE__*/_react.default.createElement(_reactDayPicker.DayPicker, _extends({
    mode: "single",
    footer: /*#__PURE__*/_react.default.createElement("span", {
      className: "ds-u-visibility--screen-reader"
    }, (0, _i18n.t)('singleInputDateField.arrowKeyInstructions')),
    captionLayout: "dropdown",
    components: {
      Caption: _CustomDayPickerCaption.default,
      IconDropdown: _Icons.ArrowsStackedIcon
    },
    formatters: {
      formatMonthCaption: formatMonthCaption
    }
  }, props));
}

var _default = CustomDayPicker;
exports.default = _default;