import type { Locale as DateFnsLocale } from "date-fns"; import type { ReactNode } from "react"; import type { DatePickerPopoverProps } from "./components"; export type DatePickerLocale = { /** The date-fns locale object used to localize dates. Defaults to* `en-US`. */ formatter?: DateFnsLocale; /** rtl should be used optionally in conjunction with supported language codes, such as `rtl: true` when code is `arSA` */ rtl?: boolean; /** * custom translations for the DatePicker component unrelated to the date-fns locale. These are used to translate * the buttons and labels of the DatePicker component outside of the month, day, year, etc. */ openButton?: string; cancel?: string; apply?: string; nextMonth?: string; previousMonth?: string; title?: string; }; export type SharedDatePickerProps = { /** * The placement of the `DatePicker`/`DateRangePicker` modal. */ popoverSide?: DatePickerPopoverProps["side"]; /** * The alignment of the `DatePicker`/`DateRangePicker` modal. */ popoverAlign?: DatePickerPopoverProps["align"]; /** * The anchor element for the `DatePicker`/`DateRangePicker` popover. */ popoverAnchor?: ReactNode; /** * The locale of the `DatePicker`/`DateRangePicker`. */ locale?: DatePickerLocale; } & ({ /** * Whether the year is editable. */ editableYear?: false; } | { /** * Whether the year is editable. */ editableYear: true; /** * The years to display in the `DatePicker`/`DateRangePicker`. */ years?: number[]; });