@codecademy/gamut
68.2.268.2.3-alpha.93a7da.0
dist/DatePicker/DatePickerCalendar/Calendar/utils/dateGrid.d.ts+
dist/DatePicker/DatePickerCalendar/Calendar/utils/dateGrid.d.tsNew file+96
Index: package/dist/DatePicker/DatePickerCalendar/Calendar/utils/dateGrid.d.ts
===================================================================
--- package/dist/DatePicker/DatePickerCalendar/Calendar/utils/dateGrid.d.ts
+++ package/dist/DatePicker/DatePickerCalendar/Calendar/utils/dateGrid.d.ts
@@ -0,0 +1,96 @@
+/**
+ * Builds a grid of days for a calendar month using native Date and Intl.
+ * Each row has 7 cells; leading/trailing cells may be null (padding from adjacent months).
+ */
+import type { IsoWeekday } from '../../../utils/locale';
+/**
+ * Normalize to start of day in local time for comparison.
+ */
+export declare const normalizeDate: (date: Date) => number;
+/**
+ * Number of empty cells before the 1st of the month, for a grid whose first column is
+ * `firstWeekday` (ISO: 1 = Monday … 7 = Sunday from `Intl.Locale#getWeekInfo`).
+ */
+export declare const getWeekdayOffsetInGrid: ({ date, firstWeekday, }: {
+ date: Date;
+ firstWeekday: IsoWeekday;
+}) => number;
+export declare const getFirstOfMonth: (date: Date) => Date;
+/**
+ * Returns an array of weeks for the given month. Each week is an array of 7 items:
+ * each item is either a Date (that day) or null (padding from previous/next month).
+ *
+ * @param year - Full year (e.g. 2026)
+ * @param month - Month 0-11 (0 = January)
+ * @param firstWeekday - First day of the week for the calendar row (ISO 1–7, from `getWeekInfo().firstDay`)
+ */
+export declare const getMonthGrid: ({ year, month, firstWeekday, }: {
+ year: number;
+ month: number;
+ firstWeekday: IsoWeekday;
+}) => (Date | null)[][];
+/**
+ * Check if two dates are the same calendar day (ignoring time).
+ */
+export declare const isSameDay: (a: Date | null, b: Date | null) => boolean;
+/**
+ * Calendar-ordered local-midnight instants for two possibly unordered `Date` values.
+ * Matches the bounds used by {@link isDateInRange} (and range selection).
+ */
+export declare const getOrderedCalendarEndpoints: ({ startDate, endDate, }: {
+ startDate: Date;
+ endDate: Date;
+}) => {
+ low: Date;
+ high: Date;
+};
+/**
+ * Check if `date` is between `startDate` and `endDate` (exclusive), ignoring time.
+ */
+export declare const isDateInRange: ({ date, startDate, endDate, }: {
+ date: Date;
+ startDate: Date | null;
+ endDate: Date | null;
+}) => boolean;
+/**
+ * Build a `shouldDisableDate` that disables each listed calendar day (time-of-day ignored).
+ *
+ * @example
+ * ```tsx
+ * <DatePicker
+ * mode="single"
+ * selectedDate={null}
+ * onSelected={() => {}}
+ * shouldDisableDate={matchDisabledDates([new Date(2026, 3, 14)])}
+ * />
+ * ```
+ */
+export declare const matchDisabledDates: (dates?: readonly Date[]) => (date: Date) => boolean;
+/** True when `shouldDisableDate` returns true for this calendar day. */
+export declare const isDateDisabled: ({ date, shouldDisableDate, }: {
+ date: Date;
+ shouldDisableDate?: (date: Date) => boolean;
+}) => boolean;
+/** One visible day in the month grid with its row (for Home/End and keyboard nav). */
+export type DateWithRow = {
+ date: Date;
+ rowIndex: number;
+};
+/** Flat list of dates in grid order (row-major, non-null only) with row index for Home/End */
+export declare const getDatesWithRow: (weeks: (Date | null)[][]) => DateWithRow[];
+/** Add `n` months to the given date. */
+export declare const addMonths: ({ date, n }: {
+ date: Date;
+ n: number;
+}) => Date;
+/**
+ * True if `date` falls in the left visible month, or—when `showSecondMonth`—in the
+ * month shown in the second column. Used to avoid shifting the visible month pair when
+ * the committed date is already on screen (e.g. a click in the right-hand month).
+ */
+export declare const isDateWithinVisibleMonths: ({ date, startOfLeftVisibleMonth, showSecondMonth, }: {
+ date: Date;
+ /** First day of the month rendered in the left calendar column (`displayDate`). */
+ startOfLeftVisibleMonth: Date;
+ showSecondMonth: boolean;
+}) => boolean;