@navikt/ds-react
Version:
React components from the Norwegian Labour and Welfare Administration.
22 lines (21 loc) • 1.18 kB
TypeScript
import { Locale } from "date-fns";
import React from "react";
import { MonthPickerProps } from "./MonthPicker.types";
type MonthPickerProviderProps = Pick<MonthPickerProps, "dropdownCaption" | "disabled" | "selected" | "defaultSelected" | "onMonthSelect" | "year" | "onYearChange" | "fromDate" | "toDate"> & {
children: React.ReactNode;
locale: Locale;
};
type MonthPickerContextProps = {
caption: "label" | "dropdown";
year: Date;
onYearChange: (year: Date) => void;
selected: MonthPickerProps["selected"];
onMonthSelect: MonthPickerProps["onMonthSelect"];
disabled: NonNullable<MonthPickerProps["disabled"]>;
locale: Locale;
fromDate?: MonthPickerProps["fromDate"];
toDate?: MonthPickerProps["toDate"];
};
declare const useMonthPickerContext: <S extends boolean = true>(strict?: S) => S extends true ? MonthPickerContextProps : MonthPickerContextProps | undefined;
declare const MonthPickerProvider: ({ children, disabled, year, onYearChange, fromDate, toDate, selected, defaultSelected, onMonthSelect, dropdownCaption, locale, }: MonthPickerProviderProps) => React.JSX.Element;
export { MonthPickerProvider, useMonthPickerContext };