"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.MonthPickerStandalone = void 0;
const react_1 = __importStar(require("react"));
const helpers_1 = require("../../../utils/helpers");
const consoleWarning_1 = require("../../../utils/helpers/consoleWarning");
const i18n_hooks_1 = require("../../../utils/i18n/i18n.hooks");
const Date_locale_1 = require("../../Date.locale");
const MonthPicker_context_1 = require("../MonthPicker.context");
const MonthPicker_Caption_1 = require("./MonthPicker.Caption");
const MonthPicker_Table_1 = require("./MonthPicker.Table");
exports.MonthPickerStandalone = (0, react_1.forwardRef)(({ dropdownCaption = false, fromDate, toDate, disabled = [], selected, className, locale, translations, onMonthSelect, defaultSelected, year, onYearChange, }, ref) => {
    const translate = (0, i18n_hooks_1.useI18n)("DatePicker", translations, (0, Date_locale_1.getTranslations)(locale));
    const langProviderLocale = (0, i18n_hooks_1.useDateLocale)();
    if (dropdownCaption && (!fromDate || !toDate)) {
        (0, consoleWarning_1.consoleWarning)("MonthPicker.Standalone: Using dropdownCaption requires `fromDate` and `toDate` props to be defined.");
        return null;
    }
    return (react_1.default.createElement("div", { ref: ref, className: (0, helpers_1.cl)("aksel-date__wrapper", className) },
        react_1.default.createElement(Date_locale_1.DateTranslationContextProvider, { translate: translate },
            react_1.default.createElement(MonthPicker_context_1.MonthPickerProvider, { dropdownCaption: dropdownCaption, defaultSelected: defaultSelected, selected: selected, disabled: disabled, fromDate: fromDate, toDate: toDate, year: year, onYearChange: onYearChange, onMonthSelect: onMonthSelect, locale: locale ? (0, Date_locale_1.getLocaleFromString)(locale) : langProviderLocale },
                react_1.default.createElement("div", { className: "aksel-date rdp-month" },
                    react_1.default.createElement(MonthPicker_Caption_1.MonthPickerCaption, null),
                    react_1.default.createElement(MonthPicker_Table_1.MonthPickerTable, null))))));
});
//# sourceMappingURL=MonthPicker.Standalone.js.map