import React, { forwardRef } from "react"; import { cl } from "../../../utils/helpers"; import { useDateLocale, useI18n } from "../../../utils/i18n/i18n.hooks"; import { DateTranslationContextProvider, getLocaleFromString, getTranslations, } from "../../Date.locale"; import { MonthPickerProvider } from "../MonthPicker.context"; import { MonthPickerProps } from "../MonthPicker.types"; import { MonthPickerCaption } from "./MonthPicker.Caption"; import { MonthPickerTable } from "./MonthPicker.Table"; export interface MonthPickerStandaloneProps extends Omit< MonthPickerProps, "open" | "onClose" | "onOpenToggle" | "wrapperClassName" | "strategy" > { /** * Monthpicker classname */ className?: string; } export type MonthPickerStandaloneType = React.ForwardRefExoticComponent< MonthPickerStandaloneProps & React.RefAttributes >; export const MonthPickerStandalone = forwardRef< HTMLDivElement, MonthPickerStandaloneProps >( ( { dropdownCaption = false, fromDate, toDate, disabled = [], selected, className, locale, translations, onMonthSelect, defaultSelected, year, onYearChange, }, ref, ) => { const translate = useI18n( "DatePicker", translations, getTranslations(locale), ); const langProviderLocale = useDateLocale(); if (dropdownCaption && (!fromDate || !toDate)) { console.warn("Using dropdownCaption required fromDate and toDate"); return null; } return (
); }, );