@ensi-platform/admin-ui 0.13.2 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Component--pn4mDeS.js +870 -0
- package/dist/Component--pn4mDeS.js.map +1 -0
- package/dist/{Component-BhZC1r4b.js → Component-BJz78zCJ.js} +2 -2
- package/dist/{Component-BhZC1r4b.js.map → Component-BJz78zCJ.js.map} +1 -1
- package/dist/{Component-DV6H96-0.js → Component-BbslNbTq.js} +2 -2
- package/dist/{Component-DV6H96-0.js.map → Component-BbslNbTq.js.map} +1 -1
- package/dist/{Component-B6OSgrmp.js → Component-COgt_U9z.js} +3 -3
- package/dist/{Component-B6OSgrmp.js.map → Component-COgt_U9z.js.map} +1 -1
- package/dist/{Component-kqMyROjC.js → Component-DHBQ3LMI.js} +2 -2
- package/dist/{Component-kqMyROjC.js.map → Component-DHBQ3LMI.js.map} +1 -1
- package/dist/{Component-BoAQ166N.js → Component-DrdEP1wD.js} +3 -3
- package/dist/{Component-BoAQ166N.js.map → Component-DrdEP1wD.js.map} +1 -1
- package/dist/{Component-CMdJyqc-.js → Component-Qhj0uSjq.js} +2 -2
- package/dist/{Component-CMdJyqc-.js.map → Component-Qhj0uSjq.js.map} +1 -1
- package/dist/{Component-CiwX3wP8.js → Component-Zja2mwzK.js} +2 -2
- package/dist/{Component-CiwX3wP8.js.map → Component-Zja2mwzK.js.map} +1 -1
- package/dist/{Component-CS-9-L8S.js → Component-_PP1i9V1.js} +3 -3
- package/dist/{Component-CS-9-L8S.js.map → Component-_PP1i9V1.js.map} +1 -1
- package/dist/{Component-BBzbDcdq.js → Component-yeVZUFid.js} +2 -2
- package/dist/{Component-BBzbDcdq.js.map → Component-yeVZUFid.js.map} +1 -1
- package/dist/{Search-CS1rsu-f.js → Search-dQa9wT3n.js} +3 -3
- package/dist/{Search-CS1rsu-f.js.map → Search-dQa9wT3n.js.map} +1 -1
- package/dist/Star-JBCU7DBD.js +28 -0
- package/dist/Star-JBCU7DBD.js.map +1 -0
- package/dist/action-popup/index.js +2 -2
- package/dist/active-filters/index.js +1 -1
- package/dist/arrangement-settings/index.js +2 -2
- package/dist/assets/Component16.css +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/assets/index27.css +1 -1
- package/dist/assets/index28.css +1 -1
- package/dist/assets/index29.css +1 -1
- package/dist/assets/index30.css +1 -1
- package/dist/assets/index31.css +1 -1
- package/dist/assets/index32.css +1 -1
- package/dist/assets/index33.css +1 -1
- package/dist/assets/index34.css +1 -1
- package/dist/assets/index35.css +1 -0
- package/dist/autocomplete/index.js +1 -1
- package/dist/autocomplete-async/Component.d.ts.map +1 -1
- package/dist/autocomplete-async/index.js +98 -92
- package/dist/autocomplete-async/index.js.map +1 -1
- package/dist/bottom-sheet/index.js +2 -2
- package/dist/cascade-menu/index.js +4 -4
- package/dist/color-field/index.js +2 -2
- package/dist/color-picker/index.js +1 -1
- package/dist/combobox/components/Trigger/index.d.ts +1 -0
- package/dist/combobox/components/Trigger/index.d.ts.map +1 -1
- package/dist/combobox/index.d.ts +1 -1
- package/dist/combobox/index.d.ts.map +1 -1
- package/dist/combobox/index.js +15 -14
- package/dist/copy-button/index.js +1 -1
- package/dist/data-table/Component.d.ts +1 -1
- package/dist/data-table/index.js +2 -2
- package/dist/date-picker/index.js +2 -2
- package/dist/date-range-picker/index.js +2 -2
- package/dist/drawer/index.js +1 -1
- package/dist/dropzone/index.js +2 -2
- package/dist/{hooks-Di5rgHTG.js → hooks-BSSTu-2y.js} +3 -2
- package/dist/{hooks-Di5rgHTG.js.map → hooks-BSSTu-2y.js.map} +1 -1
- package/dist/icons/AlignCenter.d.ts +7 -0
- package/dist/icons/AlignCenter.d.ts.map +1 -0
- package/dist/icons/AlignJustify.d.ts +7 -0
- package/dist/icons/AlignJustify.d.ts.map +1 -0
- package/dist/icons/AlignLeft.d.ts +7 -0
- package/dist/icons/AlignLeft.d.ts.map +1 -0
- package/dist/icons/AlignRight.d.ts +7 -0
- package/dist/icons/AlignRight.d.ts.map +1 -0
- package/dist/icons/Anchor.d.ts +7 -0
- package/dist/icons/Anchor.d.ts.map +1 -0
- package/dist/icons/Bold.d.ts +7 -0
- package/dist/icons/Bold.d.ts.map +1 -0
- package/dist/icons/Code.d.ts +7 -0
- package/dist/icons/Code.d.ts.map +1 -0
- package/dist/icons/HorizontalRule.d.ts +7 -0
- package/dist/icons/HorizontalRule.d.ts.map +1 -0
- package/dist/icons/Indent.d.ts +7 -0
- package/dist/icons/Indent.d.ts.map +1 -0
- package/dist/icons/Italic.d.ts +7 -0
- package/dist/icons/Italic.d.ts.map +1 -0
- package/dist/icons/Link.d.ts +7 -0
- package/dist/icons/Link.d.ts.map +1 -0
- package/dist/icons/List.d.ts +7 -0
- package/dist/icons/List.d.ts.map +1 -0
- package/dist/icons/ListOrdered.d.ts +7 -0
- package/dist/icons/ListOrdered.d.ts.map +1 -0
- package/dist/icons/Maximize.d.ts +7 -0
- package/dist/icons/Maximize.d.ts.map +1 -0
- package/dist/icons/Outdent.d.ts +7 -0
- package/dist/icons/Outdent.d.ts.map +1 -0
- package/dist/icons/Palette.d.ts +7 -0
- package/dist/icons/Palette.d.ts.map +1 -0
- package/dist/icons/Quote.d.ts +7 -0
- package/dist/icons/Quote.d.ts.map +1 -0
- package/dist/icons/Redo.d.ts +7 -0
- package/dist/icons/Redo.d.ts.map +1 -0
- package/dist/icons/Smile.d.ts +7 -0
- package/dist/icons/Smile.d.ts.map +1 -0
- package/dist/icons/Star.d.ts +7 -0
- package/dist/icons/Star.d.ts.map +1 -0
- package/dist/icons/Strike.d.ts +7 -0
- package/dist/icons/Strike.d.ts.map +1 -0
- package/dist/icons/Subscript.d.ts +7 -0
- package/dist/icons/Subscript.d.ts.map +1 -0
- package/dist/icons/Superscript.d.ts +7 -0
- package/dist/icons/Superscript.d.ts.map +1 -0
- package/dist/icons/Table.d.ts +7 -0
- package/dist/icons/Table.d.ts.map +1 -0
- package/dist/icons/Underline.d.ts +7 -0
- package/dist/icons/Underline.d.ts.map +1 -0
- package/dist/icons/Undo.d.ts +7 -0
- package/dist/icons/Undo.d.ts.map +1 -0
- package/dist/icons/Video.d.ts +7 -0
- package/dist/icons/Video.d.ts.map +1 -0
- package/dist/icons/index.d.ts +27 -0
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/icons/index.js +709 -177
- package/dist/icons/index.js.map +1 -1
- package/dist/{index-Co6mzXrw.js → index-CYUeRS10.js} +3 -3
- package/dist/{index-Co6mzXrw.js.map → index-CYUeRS10.js.map} +1 -1
- package/dist/index-Rx06m88a.js +101 -0
- package/dist/index-Rx06m88a.js.map +1 -0
- package/dist/{index-BAFoUNz-.js → index-o14ps46j.js} +2 -2
- package/dist/{index-BAFoUNz-.js.map → index-o14ps46j.js.map} +1 -1
- package/dist/input/index.js +1 -1
- package/dist/loader/index.js +1 -1
- package/dist/mask/index.js +1 -1
- package/dist/menu-list/index.js +1 -1
- package/dist/{metrics-CaN_sENu.js → metrics-D4vChkd-.js} +2 -2
- package/dist/{metrics-CaN_sENu.js.map → metrics-D4vChkd-.js.map} +1 -1
- package/dist/modal/index.js +1 -1
- package/dist/multi-autocomplete/index.js +1 -1
- package/dist/multi-autocomplete-async/index.js +1 -1
- package/dist/multi-select/index.js +2 -2
- package/dist/number-input/index.js +1 -1
- package/dist/number-range/index.js +1 -1
- package/dist/password/index.js +2 -2
- package/dist/provider/context.d.ts.map +1 -1
- package/dist/provider/index.js +2 -2
- package/dist/provider/types.d.ts +2 -0
- package/dist/provider/types.d.ts.map +1 -1
- package/dist/rating/Component.d.ts +5 -0
- package/dist/rating/Component.d.ts.map +1 -0
- package/dist/rating/FormRating.d.ts +6 -0
- package/dist/rating/FormRating.d.ts.map +1 -0
- package/dist/rating/components/Star/index.d.ts +14 -0
- package/dist/rating/components/Star/index.d.ts.map +1 -0
- package/dist/rating/components/Star/theme.d.ts +5 -0
- package/dist/rating/components/Star/theme.d.ts.map +1 -0
- package/dist/rating/components/Track/index.d.ts +41 -0
- package/dist/rating/components/Track/index.d.ts.map +1 -0
- package/dist/rating/index.d.ts +4 -0
- package/dist/rating/index.d.ts.map +1 -0
- package/dist/rating/index.js +361 -0
- package/dist/rating/index.js.map +1 -0
- package/dist/rating/theme.d.ts +5 -0
- package/dist/rating/theme.d.ts.map +1 -0
- package/dist/rating/types.d.ts +56 -0
- package/dist/rating/types.d.ts.map +1 -0
- package/dist/rating/utils.d.ts +11 -0
- package/dist/rating/utils.d.ts.map +1 -0
- package/dist/select/index.js +1 -1
- package/dist/suggest-checklist/index.js +3 -3
- package/dist/table/Component.d.ts +3 -3
- package/dist/table/components/Cell/index.d.ts +1 -1
- package/dist/table/components/Cell/index.d.ts.map +1 -1
- package/dist/table/components/Cell/theme.d.ts +1 -0
- package/dist/table/components/Cell/theme.d.ts.map +1 -1
- package/dist/table/components/CheckboxCell/index.d.ts.map +1 -1
- package/dist/table/components/HeaderCell/index.d.ts +1 -1
- package/dist/table/components/HeaderCell/index.d.ts.map +1 -1
- package/dist/table/components/HeaderCell/theme.d.ts +1 -0
- package/dist/table/components/HeaderCell/theme.d.ts.map +1 -1
- package/dist/table/components/HeaderCheckboxCell/index.d.ts.map +1 -1
- package/dist/table/components/Row/index.d.ts +1 -1
- package/dist/table/components/Row/index.d.ts.map +1 -1
- package/dist/table/components/Row/types.d.ts +6 -0
- package/dist/table/components/Row/types.d.ts.map +1 -1
- package/dist/table/components/TableElement/index.d.ts.map +1 -1
- package/dist/table/hooks/useTablePin.d.ts +6 -0
- package/dist/table/hooks/useTablePin.d.ts.map +1 -0
- package/dist/table/index.js +1 -1
- package/dist/table/types.d.ts +5 -1
- package/dist/table/types.d.ts.map +1 -1
- package/dist/table/utils.d.ts +45 -1
- package/dist/table/utils.d.ts.map +1 -1
- package/dist/tabs/index.js +1 -1
- package/dist/tag/index.js +1 -1
- package/dist/textarea/index.js +1 -1
- package/dist/time-field/index.js +1 -1
- package/dist/toast/index.js +2 -2
- package/dist/typography/index.js +1 -1
- package/dist/{utils-qHAuIhao.js → utils-Dfp1NDWx.js} +3 -3
- package/dist/{utils-qHAuIhao.js.map → utils-Dfp1NDWx.js.map} +1 -1
- package/dist/vertical-tabs/index.js +1 -1
- package/docs/design-language.md +14 -13
- package/package.json +5 -1
- package/src/autocomplete/docs/Description.md +2 -0
- package/src/autocomplete-async/docs/Description.md +1 -1
- package/src/badge/docs/cssVariables.ts +3 -3
- package/src/bottom-sheet/docs/cssVariables.ts +1 -1
- package/src/cascade-menu/docs/cssVariables.ts +7 -7
- package/src/data-table/docs/Description.md +2 -1
- package/src/ds/tokens/docs/Description.md +2 -1
- package/src/link/docs/cssVariables.ts +1 -1
- package/src/provider/docs/cssVariables.ts +1 -1
- package/src/provider/types.ts +2 -0
- package/src/rating/docs/Description.md +47 -0
- package/src/rating/docs/Example.md +9 -0
- package/src/rating/docs/cssVariables.ts +14 -0
- package/src/rating/types.ts +69 -0
- package/src/table/docs/Description.md +10 -8
- package/src/table/docs/Example.md +22 -5
- package/src/table/docs/cssVariables.ts +8 -3
- package/src/table/types.ts +6 -1
- package/src/toast/docs/cssVariables.ts +4 -4
- package/src/tooltip/docs/cssVariables.ts +2 -2
- package/dist/Component-DmKmX7so.js +0 -712
- package/dist/Component-DmKmX7so.js.map +0 -1
- package/dist/index-BHUJOcwj.js +0 -85
- package/dist/index-BHUJOcwj.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-BAFoUNz-.js","sources":["../src/calendar/constants.ts","../src/calendar/utils/date.ts","../src/calendar/hooks/useCalendarGridKeyboard/index.ts","../src/calendar/utils/scroll.ts","../src/calendar/hooks/useFakeScrollCalendar.ts","../src/calendar/components/MonthList/index.tsx","../src/calendar/utils/sticky.ts","../src/calendar/components/DayCell/index.tsx","../src/calendar/components/MonthYearSelect/index.tsx","../src/calendar/components/MonthView/index.tsx"],"sourcesContent":["/** Visible month window size for vertical scroll calendar. */\nexport const CALENDAR_WINDOW_MONTHS = 3;\n\n/** Fallback year bounds when DatePicker has no min/max. */\nexport const DEFAULT_YEAR_MIN = 1900;\nexport const DEFAULT_YEAR_MAX = 2100;\n\n/** Animated `scrollToMonth` duration. */\nexport const SCROLL_TO_MONTH_MS = 200;\n\n/** Idle delay before week-row snap. */\nexport const WEEK_SNAP_IDLE_MS = 300;\n\n/** Week-row snap animation duration. */\nexport const WEEK_SNAP_DURATION_MS = 150;\n","import { CalendarDate, type DateValue, endOfMonth, startOfMonth, toCalendarDate, today } from '@internationalized/date';\n\nimport { CALENDAR_WINDOW_MONTHS, DEFAULT_YEAR_MAX, DEFAULT_YEAR_MIN } from '../constants';\n\n/** Layout metrics for month height estimates (px, match `--aui-calendar-*`). */\nexport interface IMonthHeightMetrics {\n /** Day / weekday cell size. */\n cellSize: number;\n /** Month title block height (padding + line). */\n headingHeight: number;\n /** Gap between heading and grid. */\n monthGap: number;\n /** Weekday header row height. */\n weekdayRowHeight: number;\n /** Space after the month (former viewport gap). */\n monthBottomGap: number;\n}\n\n/** Defaults aligned with semantic calendar tokens (`space-8/16/32`). */\nexport const DEFAULT_MONTH_HEIGHT_METRICS: IMonthHeightMetrics = {\n cellSize: 32,\n headingHeight: 36,\n monthGap: 8,\n weekdayRowHeight: 32,\n monthBottomGap: 16,\n};\n\n/** Fallback viewport height (matches `--aui-calendar-max-h`). */\nexport const CALENDAR_VIEWPORT_HEIGHT = 320;\n\n/** Year bounds from optional min/max date constraints. */\nexport const getYearRange = (\n minValue?: DateValue | null,\n maxValue?: DateValue | null\n): { minYear: number; maxYear: number } => {\n const minYear = minValue != null ? toCalendarDate(minValue).year : DEFAULT_YEAR_MIN;\n const maxYear = maxValue != null ? toCalendarDate(maxValue).year : DEFAULT_YEAR_MAX;\n\n if (minYear > maxYear) {\n return { minYear: maxYear, maxYear: minYear };\n }\n\n return { minYear, maxYear };\n};\n\n/** Allowed month numbers (1–12) for `year` given optional min/max dates. */\nexport const getMonthRangeForYear = (\n year: number,\n minValue?: DateValue | null,\n maxValue?: DateValue | null\n): { minMonth: number; maxMonth: number } => {\n let minMonth = 1;\n let maxMonth = 12;\n\n if (minValue != null) {\n const min = toCalendarDate(minValue);\n if (year < min.year) {\n return { minMonth: 1, maxMonth: 0 };\n }\n if (year === min.year) {\n minMonth = min.month;\n }\n }\n\n if (maxValue != null) {\n const max = toCalendarDate(maxValue);\n if (year > max.year) {\n return { minMonth: 1, maxMonth: 0 };\n }\n if (year === max.year) {\n maxMonth = max.month;\n }\n }\n\n if (minMonth > maxMonth) {\n return { minMonth, maxMonth: minMonth - 1 };\n }\n\n return { minMonth, maxMonth };\n};\n\n/** Localized long month names (index 0 = January). */\nexport const getMonthLabels = (locale: string): string[] => {\n const formatter = new Intl.DateTimeFormat(locale, { month: 'long' });\n\n return Array.from({ length: 12 }, (_, index) => formatter.format(new Date(Date.UTC(2024, index, 1))));\n};\n\n/** Height resolver: measured DOM height or estimate. */\nexport type TGetMonthHeight = (monthKey: string) => number;\n\n/** Month key for DOM data attributes (`yyyy-mm`). */\nexport const toMonthKey = (date: DateValue): string => `${date.year}-${String(date.month).padStart(2, '0')}`;\n\n/** Parse `yyyy-mm` month key back to the first day of that month. */\nexport const parseMonthKey = (monthKey: string): CalendarDate | null => {\n const match = /^(\\d{4})-(\\d{2})$/.exec(monthKey);\n if (!match) {\n return null;\n }\n\n const year = Number(match[1]);\n const month = Number(match[2]);\n if (month < 1 || month > 12) {\n return null;\n }\n\n return new CalendarDate(year, month, 1);\n};\n\n/**\n * Week rows in a month grid.\n * `firstDayOfWeek`: 0 = Sunday … 6 = Saturday (JS `Date#getDay`).\n */\nexport const getMonthWeekCount = (month: DateValue, firstDayOfWeek = 1): number => {\n const start = startOfMonth(toCalendarDate(month));\n const daysInMonth = endOfMonth(start).day;\n const jsDay = start.toDate('UTC').getDay();\n const offset = (jsDay - firstDayOfWeek + 7) % 7;\n\n return Math.ceil((daysInMonth + offset) / 7);\n};\n\n/** Estimated pixel height of a month block (Kontur-style formula). */\nexport const estimateMonthHeight = (\n monthKey: string,\n metrics: IMonthHeightMetrics = DEFAULT_MONTH_HEIGHT_METRICS,\n firstDayOfWeek = 1\n): number => {\n const month = parseMonthKey(monthKey);\n const weeks = month ? getMonthWeekCount(month, firstDayOfWeek) : 5;\n\n return (\n metrics.headingHeight +\n metrics.monthGap +\n metrics.weekdayRowHeight +\n weeks * metrics.cellSize +\n metrics.monthBottomGap\n );\n};\n\n/** Default height getter via estimate. */\nexport const createEstimateGetHeight =\n (metrics: IMonthHeightMetrics = DEFAULT_MONTH_HEIGHT_METRICS): TGetMonthHeight =>\n monthKey =>\n estimateMonthHeight(monthKey, metrics);\n\n/** Calendar date for “today” in the given time zone. */\nexport const getToday = (timeZone = 'UTC'): CalendarDate => today(timeZone);\n\n/** Index of the pinned month at `scrollPosition === 0`. */\nexport const getCenterIndex = (windowMonths = CALENDAR_WINDOW_MONTHS): number => Math.floor(windowMonths / 2);\n\n/** Months before the center month in the window. */\nexport const getRecenterOffset = (windowMonths = CALENDAR_WINDOW_MONTHS): number => getCenterIndex(windowMonths);\n\n/** First month of the window so `center` sits at `getCenterIndex()`. */\nexport const getRecenterAnchor = (center: DateValue, windowMonths = CALENDAR_WINDOW_MONTHS): CalendarDate =>\n startOfMonth(toCalendarDate(center)).subtract({ months: getRecenterOffset(windowMonths) });\n\n/** First month of the window for `scrollToDate` (or today). */\nexport const getWindowAnchor = (scrollToDate: DateValue | null | undefined, timeZone = 'UTC'): CalendarDate =>\n getRecenterAnchor(scrollToDate ? toCalendarDate(scrollToDate) : getToday(timeZone));\n\n/** Center month (pinned near the top at scrollPosition 0). */\nexport const getCenterMonth = (scrollToDate: DateValue | null | undefined, timeZone = 'UTC'): CalendarDate =>\n startOfMonth(scrollToDate ? toCalendarDate(scrollToDate) : getToday(timeZone));\n\n/** Whether `date` falls in the same calendar month as `month`. */\nexport const isSameMonth = (date: DateValue, month: DateValue): boolean =>\n date.year === month.year && date.month === month.month;\n\n/** Whether two dates are the same calendar day. */\nexport const isSameDay = (a: DateValue, b: DateValue): boolean =>\n a.year === b.year && a.month === b.month && a.day === b.day;\n\n/** Inclusive range check (`start`/`end` order-insensitive). */\nexport const isDateInRange = (date: DateValue, start: DateValue, end: DateValue): boolean => {\n const a = toCalendarDate(start);\n const b = toCalendarDate(end);\n const d = toCalendarDate(date);\n const lo = a.compare(b) <= 0 ? a : b;\n const hi = a.compare(b) <= 0 ? b : a;\n\n return d.compare(lo) >= 0 && d.compare(hi) <= 0;\n};\n\n/** Whether `date` is before `min` or after `max` (when set). */\nexport const isDateOutOfBounds = (\n date: DateValue,\n minValue?: DateValue | null,\n maxValue?: DateValue | null\n): boolean => {\n const d = toCalendarDate(date);\n if (minValue != null && d.compare(toCalendarDate(minValue)) < 0) {\n return true;\n }\n if (maxValue != null && d.compare(toCalendarDate(maxValue)) > 0) {\n return true;\n }\n\n return false;\n};\n\n/**\n * Week rows for a month grid (includes outside-month padding days).\n * `firstDayOfWeek`: 0 = Sunday … 6 = Saturday (JS `Date#getDay`).\n */\nexport const getMonthWeeks = (month: DateValue, firstDayOfWeek = 1): CalendarDate[][] => {\n const start = startOfMonth(toCalendarDate(month));\n const weekCount = getMonthWeekCount(start, firstDayOfWeek);\n const jsDay = start.toDate('UTC').getDay();\n const offset = (jsDay - firstDayOfWeek + 7) % 7;\n let cursor = start.subtract({ days: offset });\n const weeks: CalendarDate[][] = [];\n\n for (let week = 0; week < weekCount; week += 1) {\n const row: CalendarDate[] = [];\n for (let day = 0; day < 7; day += 1) {\n row.push(cursor);\n cursor = cursor.add({ days: 1 });\n }\n weeks.push(row);\n }\n\n return weeks;\n};\n\n/** Weekday labels for the header row, starting at `firstDayOfWeek`. */\nexport const getWeekdayLabels = (\n locale: string,\n firstDayOfWeek = 1,\n weekday: Intl.DateTimeFormatOptions['weekday'] = 'short'\n): string[] => {\n const formatter = new Intl.DateTimeFormat(locale, { weekday });\n // 2024-01-07 is Sunday — walk 7 days from firstDayOfWeek.\n const sunday = new Date(Date.UTC(2024, 0, 7));\n\n return Array.from({ length: 7 }, (_, index) => {\n const day = new Date(sunday);\n day.setUTCDate(sunday.getUTCDate() + ((firstDayOfWeek + index) % 7));\n // Keep 2 chars so en/ru headers share the same visual width in 32px cells.\n return Array.from(formatter.format(day)).slice(0, 2).join('');\n });\n};\n\n/** End of month for height estimates / visibility checks. */\nexport const monthEnd = (date: DateValue): CalendarDate => endOfMonth(toCalendarDate(date));\n\n/** Month keys for a window starting at `anchor`. */\nexport const getWindowMonthKeys = (anchor: CalendarDate, count = CALENDAR_WINDOW_MONTHS): string[] =>\n Array.from({ length: count }, (_, index) => toMonthKey(startOfMonth(anchor).add({ months: index })));\n\n/** Centered window keys around `center` (`[c-k … c … c+k]` for odd N). */\nexport const getCenteredMonthKeys = (center: DateValue, count = CALENDAR_WINDOW_MONTHS): string[] => {\n const month = startOfMonth(toCalendarDate(center));\n const offset = getCenterIndex(count);\n\n return getWindowMonthKeys(month.subtract({ months: offset }), count);\n};\n\n/** @deprecated Use `getCenteredMonthKeys`. */\nexport const getTripleMonthKeys = (center: DateValue): string[] => getCenteredMonthKeys(center);\n\n/** Signed month distance `to - from` (year*12 + month). */\nexport const monthIndexDelta = (from: DateValue, to: DateValue): number => {\n const a = startOfMonth(toCalendarDate(from));\n const b = startOfMonth(toCalendarDate(to));\n\n return b.year * 12 + b.month - (a.year * 12 + a.month);\n};\n","import { useCallback, useEffect, useRef, useState, type FocusEvent, type KeyboardEvent, type RefObject } from 'react';\n\nimport { type CalendarDate, getLocalTimeZone, today } from '@internationalized/date';\n\nimport { isDateOutOfBounds, toMonthKey } from '../../utils/date';\n\n/** Week starts Monday (aligned with MonthView). */\nexport const CALENDAR_GRID_FIRST_DAY_OF_WEEK = 1;\n\nexport type TCalendarGridNavKey =\n 'ArrowLeft' | 'ArrowRight' | 'ArrowUp' | 'ArrowDown' | 'Home' | 'End' | 'PageUp' | 'PageDown';\n\nconst NAV_KEYS = new Set<string>([\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowDown',\n 'Home',\n 'End',\n 'PageUp',\n 'PageDown',\n]);\n\n/** Options for grid keyboard movement. */\nexport interface IMoveFocusedDateOptions {\n minValue?: CalendarDate | null;\n maxValue?: CalendarDate | null;\n isDateUnavailable?: (date: CalendarDate) => boolean;\n firstDayOfWeek?: number;\n}\n\nconst isBlocked = (date: CalendarDate, options: IMoveFocusedDateOptions) =>\n isDateOutOfBounds(date, options.minValue, options.maxValue) || Boolean(options.isDateUnavailable?.(date));\n\n/** Day-of-week index relative to `firstDayOfWeek` (0 = start of week). */\nexport const getWeekdayOffset = (date: CalendarDate, firstDayOfWeek = CALENDAR_GRID_FIRST_DAY_OF_WEEK) => {\n const jsDay = date.toDate('UTC').getDay();\n\n return (jsDay - firstDayOfWeek + 7) % 7;\n};\n\n/** One navigation step before skipping blocked days. */\nexport const stepFocusedDate = (\n date: CalendarDate,\n key: TCalendarGridNavKey,\n firstDayOfWeek = CALENDAR_GRID_FIRST_DAY_OF_WEEK\n): CalendarDate => {\n switch (key) {\n case 'ArrowLeft':\n return date.subtract({ days: 1 });\n case 'ArrowRight':\n return date.add({ days: 1 });\n case 'ArrowUp':\n return date.subtract({ days: 7 });\n case 'ArrowDown':\n return date.add({ days: 7 });\n case 'Home': {\n const offset = getWeekdayOffset(date, firstDayOfWeek);\n\n return date.subtract({ days: offset });\n }\n case 'End': {\n const offset = getWeekdayOffset(date, firstDayOfWeek);\n\n return date.add({ days: 6 - offset });\n }\n case 'PageUp':\n return date.subtract({ months: 1 });\n case 'PageDown':\n return date.add({ months: 1 });\n default:\n return date;\n }\n};\n\n/** Direction used when skipping blocked days after a step. */\nexport const getSkipDayDelta = (key: TCalendarGridNavKey): 1 | -1 => {\n switch (key) {\n case 'ArrowLeft':\n case 'ArrowUp':\n case 'Home':\n case 'PageUp':\n return -1;\n default:\n return 1;\n }\n};\n\n/**\n * Move focus by key; skip unavailable / out-of-bounds days in the same direction.\n * Returns `date` unchanged when no valid target exists.\n */\nexport const moveFocusedDate = (\n date: CalendarDate,\n key: TCalendarGridNavKey,\n options: IMoveFocusedDateOptions = {}\n): CalendarDate => {\n const firstDayOfWeek = options.firstDayOfWeek ?? CALENDAR_GRID_FIRST_DAY_OF_WEEK;\n let next = stepFocusedDate(date, key, firstDayOfWeek);\n\n if (isDateOutOfBounds(next, options.minValue, options.maxValue)) {\n if (options.minValue != null && next.compare(options.minValue) < 0) {\n next = options.minValue;\n }\n if (options.maxValue != null && next.compare(options.maxValue) > 0) {\n next = options.maxValue;\n }\n }\n\n if (isBlocked(next, options) && next.compare(date) === 0) {\n return date;\n }\n\n const delta = getSkipDayDelta(key);\n\n for (let guard = 0; guard < 366 && isBlocked(next, options); guard += 1) {\n const candidate = next.add({ days: delta });\n if (isDateOutOfBounds(candidate, options.minValue, options.maxValue)) {\n return date;\n }\n next = candidate;\n }\n\n return isBlocked(next, options) ? date : next;\n};\n\nconst clampIntoBounds = (date: CalendarDate, options: IMoveFocusedDateOptions): CalendarDate => {\n if (options.minValue != null && date.compare(options.minValue) < 0) {\n return options.minValue;\n }\n if (options.maxValue != null && date.compare(options.maxValue) > 0) {\n return options.maxValue;\n }\n\n return date;\n};\n\n/** Initial focus: preferred (clamped) → today → walk to first available. */\nexport const getInitialFocusedDate = (\n preferred: CalendarDate | null | undefined,\n options: IMoveFocusedDateOptions = {}\n): CalendarDate => {\n const timeZone = getLocalTimeZone();\n const todayDate = today(timeZone);\n const start = clampIntoBounds(preferred ?? todayDate, options);\n\n let cursor = start;\n for (let guard = 0; guard < 366 * 3; guard += 1) {\n if (!isBlocked(cursor, options)) {\n return cursor;\n }\n const next = cursor.add({ days: 1 });\n if (options.maxValue != null && next.compare(options.maxValue) > 0) {\n break;\n }\n cursor = next;\n }\n\n cursor = start;\n for (let guard = 0; guard < 366 * 3; guard += 1) {\n if (!isBlocked(cursor, options)) {\n return cursor;\n }\n const prev = cursor.subtract({ days: 1 });\n if (options.minValue != null && prev.compare(options.minValue) < 0) {\n break;\n }\n cursor = prev;\n }\n\n return options.minValue ?? todayDate;\n};\n\n/** Whether `date`'s month is already rendered in the scroll window. */\nexport const shouldScrollToMonth = (monthKeys: readonly string[], date: CalendarDate) =>\n !monthKeys.includes(toMonthKey(date));\n\n/** Move focused day into `year`/`month`, clamping day to month length / bounds. */\nexport const focusedDateInMonth = (\n focusedDate: CalendarDate,\n year: number,\n month: number,\n options: IMoveFocusedDateOptions = {}\n): CalendarDate => {\n const next = focusedDate.set({ year, month });\n const available = getInitialFocusedDate(next, options);\n\n return available;\n};\n\nconst focusDateButton = (viewport: HTMLElement | null, date: CalendarDate) => {\n const iso = date.toString();\n const button =\n viewport?.querySelector(`[data-date=\"${iso}\"]:not([data-outside-month])`) ??\n viewport?.querySelector(`[data-date=\"${iso}\"]`);\n if (button instanceof HTMLElement) {\n button.focus({ preventScroll: true });\n\n return true;\n }\n\n return false;\n};\n\nconst focusDateButtonWhenReady = (viewport: HTMLElement | null, date: CalendarDate, attempts = 12) => {\n if (focusDateButton(viewport, date) || attempts <= 0) {\n return;\n }\n requestAnimationFrame(() => focusDateButtonWhenReady(viewport, date, attempts - 1));\n};\n\n/** Options for calendar grid keyboard hook. */\nexport interface IUseCalendarGridKeyboardOptions {\n viewportRef: RefObject<HTMLElement | null>;\n /** Sync scroll/center month to the focused date (wired to scrollToMonth in calendars). */\n ensureMonthVisible: (date: CalendarDate) => void;\n preferredDate?: CalendarDate | null;\n minValue?: CalendarDate | null;\n maxValue?: CalendarDate | null;\n isDateUnavailable?: (date: CalendarDate) => boolean;\n onSelect?: (date: CalendarDate) => void;\n /** Focus the day cell on mount (keyboard open only). */\n autoFocusDay?: boolean;\n}\n\n/** Roving focus + arrow navigation for the scroll calendar grid. */\nexport const useCalendarGridKeyboard = ({\n viewportRef,\n ensureMonthVisible,\n preferredDate = null,\n minValue = null,\n maxValue = null,\n isDateUnavailable,\n onSelect,\n autoFocusDay = false,\n}: IUseCalendarGridKeyboardOptions) => {\n const moveOptions: IMoveFocusedDateOptions = { minValue, maxValue, isDateUnavailable };\n const [focusedDate, setFocusedDate] = useState(() => getInitialFocusedDate(preferredDate, moveOptions));\n const focusedDateRef = useRef(focusedDate);\n focusedDateRef.current = focusedDate;\n const didInitialFocusRef = useRef(false);\n const [isGridEngaged, setGridEngaged] = useState(autoFocusDay);\n\n useEffect(() => {\n if (didInitialFocusRef.current) {\n return;\n }\n didInitialFocusRef.current = true;\n if (!autoFocusDay) {\n return;\n }\n setGridEngaged(true);\n const frame = requestAnimationFrame(() => {\n focusDateButtonWhenReady(viewportRef.current, focusedDateRef.current);\n });\n\n return () => cancelAnimationFrame(frame);\n }, [autoFocusDay, viewportRef]);\n\n const moveFocusTo = useCallback(\n (next: CalendarDate) => {\n setGridEngaged(true);\n setFocusedDate(next);\n focusedDateRef.current = next;\n // Sync active/center month even when focusedDate already moved (desync with outside cells).\n ensureMonthVisible(next);\n focusDateButtonWhenReady(viewportRef.current, next);\n },\n [ensureMonthVisible, viewportRef]\n );\n\n const onDayFocus = useCallback((date: CalendarDate) => {\n setGridEngaged(true);\n setFocusedDate(date);\n focusedDateRef.current = date;\n }, []);\n\n const onDayBlur = useCallback((event: FocusEvent<HTMLButtonElement>) => {\n const next = event.relatedTarget;\n if (next instanceof Element && next.closest('[data-date]')) {\n return;\n }\n setGridEngaged(false);\n }, []);\n\n const setFocusedDateFromParts = useCallback(\n (year: number, month: number) => {\n const next = focusedDateInMonth(focusedDateRef.current, year, month, moveOptions);\n setGridEngaged(true);\n setFocusedDate(next);\n focusedDateRef.current = next;\n // Do not focus the day cell here — steals focus from MonthYearSelect and drops its popover.\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [isDateUnavailable, maxValue, minValue]\n );\n\n const onDayKeyDown = useCallback(\n (event: KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n onSelect?.(focusedDateRef.current);\n\n return;\n }\n\n if (!NAV_KEYS.has(event.key)) {\n return;\n }\n\n event.preventDefault();\n const next = moveFocusedDate(focusedDateRef.current, event.key as TCalendarGridNavKey, moveOptions);\n if (next.compare(focusedDateRef.current) === 0) {\n return;\n }\n moveFocusTo(next);\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [isDateUnavailable, maxValue, minValue, moveFocusTo, onSelect]\n );\n\n return { focusedDate, onDayFocus, onDayBlur, onDayKeyDown, setFocusedDateFromParts, isGridEngaged };\n};\n","import { type CalendarDate, type DateValue, startOfMonth, toCalendarDate } from '@internationalized/date';\n\nimport { CALENDAR_WINDOW_MONTHS } from '../constants';\n\nimport {\n CALENDAR_VIEWPORT_HEIGHT,\n DEFAULT_MONTH_HEIGHT_METRICS,\n createEstimateGetHeight,\n getCenterIndex,\n getCenterMonth,\n getCenteredMonthKeys,\n getToday,\n monthIndexDelta,\n parseMonthKey,\n toMonthKey,\n type TGetMonthHeight,\n} from './date';\n\n/** Max months to animate across in `scrollToMonth`. */\nexport const MAX_SCROLL_MONTHS = 6;\n\n/**\n * Contiguous month keys from `from` to `to` (inclusive), direction-aware order.\n * Caps distance to `maxMonths`.\n */\nexport const buildScrollPathKeys = (\n from: DateValue,\n to: DateValue,\n maxMonths = MAX_SCROLL_MONTHS\n): { keys: string[]; fromKey: string; toKey: string } => {\n const start = startOfMonth(toCalendarDate(from));\n let delta = monthIndexDelta(start, to);\n let sign = 0;\n if (delta > 0) {\n sign = 1;\n }\n if (delta < 0) {\n sign = -1;\n }\n if (Math.abs(delta) > maxMonths) {\n delta = sign * maxMonths;\n }\n const end = start.add({ months: delta });\n const fromKey = toMonthKey(start);\n const toKey = toMonthKey(end);\n const count = Math.abs(delta) + 1;\n const first = delta >= 0 ? start : end;\n let keys = Array.from({ length: count }, (_, index) => toMonthKey(first.add({ months: index })));\n\n // Padding so the path covers a center-sized window while animating.\n const pad = getCenterIndex(CALENDAR_WINDOW_MONTHS);\n const pathFirst = parseMonthKey(keys[0])!;\n const pathLast = parseMonthKey(keys[keys.length - 1])!;\n const before = Array.from({ length: pad }, (_, index) => toMonthKey(pathFirst.subtract({ months: pad - index })));\n const after = Array.from({ length: pad }, (_, index) => toMonthKey(pathLast.add({ months: index + 1 })));\n keys = [...before, ...keys, ...after];\n\n return { keys, fromKey, toKey };\n};\n\n/**\n * Absolute `top` for each month given Kontur scrollPosition.\n * At `scrollPosition === 0`, the center month (`getCenterIndex`) sits at the viewport top.\n */\nexport const getMonthPositions = (\n monthKeys: readonly string[],\n scrollPosition: number,\n getHeight: TGetMonthHeight = createEstimateGetHeight()\n): number[] => {\n if (monthKeys.length === 0) {\n return [];\n }\n\n const centerIndex = getCenterIndex(monthKeys.length);\n const positions = Array.from({ length: monthKeys.length }, () => 0);\n positions[centerIndex] = scrollPosition;\n\n for (let index = centerIndex - 1; index >= 0; index -= 1) {\n positions[index] = positions[index + 1] - getHeight(monthKeys[index]);\n }\n\n for (let index = centerIndex + 1; index < monthKeys.length; index += 1) {\n positions[index] = positions[index - 1] + getHeight(monthKeys[index - 1]);\n }\n\n return positions;\n};\n\n/** Whether a month block intersects the viewport. */\nexport const isMonthVisible = (top: number, height: number, viewportHeight: number): boolean =>\n top < viewportHeight && top > -height;\n\n/**\n * Linear tops: `positions[0] = scrollOffset`, then stack downward.\n * Used during animated `scrollToMonth` (not the centered pin model).\n */\nexport const getLinearMonthPositions = (\n monthKeys: readonly string[],\n scrollOffset: number,\n getHeight: TGetMonthHeight = createEstimateGetHeight()\n): number[] => {\n if (monthKeys.length === 0) {\n return [];\n }\n\n const positions = Array.from({ length: monthKeys.length }, () => 0);\n positions[0] = scrollOffset;\n for (let index = 1; index < monthKeys.length; index += 1) {\n positions[index] = positions[index - 1] + getHeight(monthKeys[index - 1]);\n }\n\n return positions;\n};\n\n/** Scroll offset that puts `monthKey` at the viewport top in linear layout. */\nexport const linearScrollOffsetForMonthKey = (\n monthKeys: readonly string[],\n monthKey: string,\n getHeight: TGetMonthHeight = createEstimateGetHeight()\n): number => {\n const index = monthKeys.indexOf(monthKey);\n if (index <= 0) {\n return 0;\n }\n\n let sum = 0;\n for (let i = 0; i < index; i += 1) {\n sum += getHeight(monthKeys[i]);\n }\n\n return -sum;\n};\n\n/** Week-row threshold for Kontur-like near-top snap. */\nexport const WEEK_SNAP_THRESHOLD = DEFAULT_MONTH_HEIGHT_METRICS.headingHeight + DEFAULT_MONTH_HEIGHT_METRICS.cellSize;\n\n/**\n * Soft snap only when a month top is within `threshold` of the viewport top.\n * `scrollDirection`: last wheel sign (<0 up / later content, >0 down / earlier) — Kontur uses\n * negative direction to prefer one week below the title.\n */\nexport const getNearTopSnapScrollPosition = (\n monthKeys: readonly string[],\n scrollPosition: number,\n getHeight: TGetMonthHeight = createEstimateGetHeight(),\n threshold: number = WEEK_SNAP_THRESHOLD,\n scrollDirection = 0\n): number => {\n if (monthKeys.length === 0) {\n return scrollPosition;\n }\n\n const positions = getMonthPositions(monthKeys, scrollPosition, getHeight);\n let bestIndex = 0;\n let bestDist = Math.abs(positions[0]);\n\n for (let index = 1; index < positions.length; index += 1) {\n const dist = Math.abs(positions[index]);\n if (dist < bestDist) {\n bestDist = dist;\n bestIndex = index;\n }\n }\n\n if (bestDist > threshold) {\n return scrollPosition;\n }\n\n const centerIndex = getCenterIndex(monthKeys.length);\n // ScrollPosition that puts bestIndex at top (same math as former scrollPositionForIndex).\n let target = 0;\n if (bestIndex < centerIndex) {\n for (let i = bestIndex; i < centerIndex; i += 1) {\n target += getHeight(monthKeys[i]);\n }\n }\n if (bestIndex > centerIndex) {\n for (let i = centerIndex; i < bestIndex; i += 1) {\n target -= getHeight(monthKeys[i]);\n }\n }\n\n // Kontur: when scrolling toward earlier months near top, prefer one week below title.\n if (scrollDirection > 0 && bestDist > 0.5 && Math.abs(target - scrollPosition) < threshold) {\n const week = DEFAULT_MONTH_HEIGHT_METRICS.cellSize;\n const alt = target - week;\n if (Math.abs(alt - scrollPosition) < Math.abs(target - scrollPosition)) {\n return alt;\n }\n }\n\n return target;\n};\n\n/**\n * Apply wheel/touch delta (Kontur `calculateScrollPosition`).\n * Positive `deltaY` scrolls content up (later months).\n */\nexport const applyScrollDelta = (\n monthKeys: readonly string[],\n scrollPosition: number,\n deltaY: number,\n getHeight: TGetMonthHeight = createEstimateGetHeight()\n): { monthKeys: string[]; scrollPosition: number; centerMonth: CalendarDate } => {\n let nextKeys = monthKeys.length > 0 ? [...monthKeys] : getCenteredMonthKeys(getToday());\n let nextPos = scrollPosition - deltaY;\n const maxShifts = 24;\n const centerIndex = getCenterIndex(nextKeys.length);\n\n if (deltaY < 0) {\n for (let shift = 0; shift < maxShifts; shift += 1) {\n const prevKey = nextKeys[centerIndex - 1];\n if (!prevKey || nextPos < getHeight(prevKey)) {\n break;\n }\n nextPos -= getHeight(prevKey);\n const center = parseMonthKey(nextKeys[centerIndex]);\n if (!center) {\n break;\n }\n nextKeys = getCenteredMonthKeys(center.subtract({ months: 1 }));\n }\n }\n\n if (deltaY > 0) {\n for (let shift = 0; shift < maxShifts; shift += 1) {\n const centerKey = nextKeys[centerIndex];\n if (!centerKey || nextPos >= 0) {\n break;\n }\n nextPos += getHeight(centerKey);\n const center = parseMonthKey(centerKey);\n if (!center) {\n break;\n }\n nextKeys = getCenteredMonthKeys(center.add({ months: 1 }));\n }\n }\n\n const centerMonth = parseMonthKey(nextKeys[getCenterIndex(nextKeys.length)]) ?? getCenterMonth(null);\n\n return { monthKeys: nextKeys, scrollPosition: nextPos, centerMonth };\n};\n\n/** Normalize WheelEvent delta to CSS pixels. */\nexport const wheelDeltaToPixels = (event: Pick<WheelEvent, 'deltaY' | 'deltaMode'>): number => {\n const { deltaY, deltaMode } = event;\n if (deltaMode === 1) {\n return deltaY * 16;\n }\n if (deltaMode === 2) {\n return deltaY * CALENDAR_VIEWPORT_HEIGHT;\n }\n\n return deltaY;\n};\n","import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';\n\nimport { type CalendarDate, type DateValue, getLocalTimeZone, toCalendarDate } from '@internationalized/date';\n\nimport { SCROLL_TO_MONTH_MS, WEEK_SNAP_DURATION_MS, WEEK_SNAP_IDLE_MS } from '../constants';\nimport { estimateMonthHeight, getCenterMonth, getCenteredMonthKeys, parseMonthKey, toMonthKey } from '../utils/date';\nimport {\n applyScrollDelta,\n buildScrollPathKeys,\n getLinearMonthPositions,\n getMonthPositions,\n getNearTopSnapScrollPosition,\n linearScrollOffsetForMonthKey,\n wheelDeltaToPixels,\n} from '../utils/scroll';\n\ntype TScrollLayout = 'centered' | 'linear';\n\ninterface IFakeScrollState {\n centerMonth: CalendarDate;\n monthKeys: string[];\n scrollPosition: number;\n layout: TScrollLayout;\n}\n\nexport const toCal = (value: DateValue | null | undefined): CalendarDate | null =>\n value != null ? toCalendarDate(value) : null;\n\nconst createScrollState = (scrollToDate: DateValue | null | undefined, timeZone: string): IFakeScrollState => {\n const centerMonth = getCenterMonth(scrollToDate, timeZone);\n\n return {\n centerMonth,\n monthKeys: getCenteredMonthKeys(centerMonth),\n scrollPosition: 0,\n layout: 'centered',\n };\n};\n\nexport const useFakeScrollCalendar = (scrollToDate: DateValue | null | undefined) => {\n const timeZone = getLocalTimeZone();\n const [state, setState] = useState<IFakeScrollState>(() => createScrollState(scrollToDate, timeZone));\n const [measuredHeights, setMeasuredHeights] = useState<ReadonlyMap<string, number>>(() => new Map());\n const viewportRef = useRef<HTMLDivElement>(null);\n const monthElsRef = useRef(new Map<string, HTMLElement>());\n const heightsRef = useRef(new Map<string, number>());\n const observersRef = useRef(new Map<string, ResizeObserver>());\n const touchStartYRef = useRef<number | null>(null);\n const rafRef = useRef<number | null>(null);\n const animRafRef = useRef<number | null>(null);\n const snapTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const pendingDeltaRef = useRef(0);\n const lastDeltaSignRef = useRef(0);\n const stateRef = useRef(state);\n stateRef.current = state;\n const scrollToMonthKeyDep = scrollToDate ? toMonthKey(scrollToDate) : null;\n\n const getHeight = (monthKey: string) => heightsRef.current.get(monthKey) ?? estimateMonthHeight(monthKey);\n\n const commitHeight = (monthKey: string, height: number) => {\n if (height <= 0 || heightsRef.current.get(monthKey) === height) {\n return;\n }\n heightsRef.current.set(monthKey, height);\n setMeasuredHeights(new Map(heightsRef.current));\n };\n\n const cancelAnimation = () => {\n if (animRafRef.current != null) {\n cancelAnimationFrame(animRafRef.current);\n animRafRef.current = null;\n }\n };\n\n const cancelSnap = () => {\n if (snapTimeoutRef.current != null) {\n clearTimeout(snapTimeoutRef.current);\n snapTimeoutRef.current = null;\n }\n };\n\n const animateScrollPosition = (from: number, to: number, durationMs: number, onEnd?: () => void) => {\n cancelAnimation();\n const start = performance.now();\n const tick = (now: number) => {\n const t = Math.min(1, (now - start) / durationMs);\n const eased = 1 - (1 - t) ** 3;\n const value = from + (to - from) * eased;\n setState(prev => ({ ...prev, scrollPosition: value }));\n if (t >= 1) {\n animRafRef.current = null;\n onEnd?.();\n return;\n }\n animRafRef.current = requestAnimationFrame(tick);\n };\n animRafRef.current = requestAnimationFrame(tick);\n };\n\n const scheduleWeekSnapRef = useRef<() => void>(null as unknown as () => void);\n scheduleWeekSnapRef.current = () => {\n cancelSnap();\n snapTimeoutRef.current = setTimeout(() => {\n snapTimeoutRef.current = null;\n const prev = stateRef.current;\n if (prev.layout !== 'centered') {\n return;\n }\n const target = getNearTopSnapScrollPosition(\n prev.monthKeys,\n prev.scrollPosition,\n getHeight,\n undefined,\n lastDeltaSignRef.current\n );\n if (Math.abs(target - prev.scrollPosition) < 0.5) {\n return;\n }\n animateScrollPosition(prev.scrollPosition, target, WEEK_SNAP_DURATION_MS);\n }, WEEK_SNAP_IDLE_MS);\n };\n\n useEffect(\n () => () => {\n cancelAnimation();\n cancelSnap();\n if (rafRef.current != null) {\n cancelAnimationFrame(rafRef.current);\n }\n // Month refs call setMonthEl(null) on unmount and disconnect observers there.\n observersRef.current.clear();\n },\n []\n );\n\n useLayoutEffect(() => {\n let changed = false;\n Array.from(monthElsRef.current.entries()).forEach(([key]) => {\n if (!state.monthKeys.includes(key)) {\n monthElsRef.current.delete(key);\n if (heightsRef.current.delete(key)) {\n changed = true;\n }\n const ro = observersRef.current.get(key);\n if (ro) {\n ro.disconnect();\n observersRef.current.delete(key);\n }\n }\n });\n if (changed) {\n setMeasuredHeights(new Map(heightsRef.current));\n }\n }, [state.monthKeys]);\n\n useLayoutEffect(() => {\n const viewport = viewportRef.current;\n if (!viewport) {\n return;\n }\n\n const flushDelta = () => {\n rafRef.current = null;\n const deltaY = pendingDeltaRef.current;\n pendingDeltaRef.current = 0;\n if (deltaY === 0) {\n return;\n }\n\n lastDeltaSignRef.current = deltaY > 0 ? 1 : -1;\n\n setState(prev => {\n let { monthKeys } = prev;\n let { scrollPosition } = prev;\n\n if (prev.layout === 'linear') {\n const positions = getLinearMonthPositions(prev.monthKeys, prev.scrollPosition, getHeight);\n let bestIndex = 0;\n let bestDist = Math.abs(positions[0]);\n for (let index = 1; index < positions.length; index += 1) {\n const dist = Math.abs(positions[index]);\n if (dist < bestDist) {\n bestDist = dist;\n bestIndex = index;\n }\n }\n const nearest = parseMonthKey(prev.monthKeys[bestIndex])!;\n const reset = createScrollState(nearest, timeZone);\n monthKeys = reset.monthKeys;\n scrollPosition = reset.scrollPosition;\n }\n\n const next = applyScrollDelta(monthKeys, scrollPosition, deltaY, getHeight);\n\n return {\n centerMonth: next.centerMonth,\n monthKeys: next.monthKeys,\n scrollPosition: next.scrollPosition,\n layout: 'centered',\n };\n });\n };\n\n const queueDelta = (deltaY: number) => {\n cancelAnimation();\n cancelSnap();\n pendingDeltaRef.current += deltaY;\n if (rafRef.current == null) {\n rafRef.current = requestAnimationFrame(flushDelta);\n }\n scheduleWeekSnapRef.current();\n };\n\n const handleWheel = (event: WheelEvent) => {\n event.preventDefault();\n queueDelta(wheelDeltaToPixels(event));\n };\n\n const handleTouchStart = (event: TouchEvent) => {\n cancelAnimation();\n cancelSnap();\n touchStartYRef.current = event.targetTouches[0]?.clientY ?? null;\n };\n\n const handleTouchMove = (event: TouchEvent) => {\n const clientY = event.changedTouches[0]?.clientY;\n if (clientY == null || touchStartYRef.current == null) {\n return;\n }\n\n event.preventDefault();\n const deltaY = touchStartYRef.current - clientY;\n touchStartYRef.current = clientY;\n queueDelta(deltaY);\n };\n\n const handleTouchEnd = () => {\n touchStartYRef.current = null;\n scheduleWeekSnapRef.current();\n };\n\n viewport.addEventListener('wheel', handleWheel, { passive: false });\n viewport.addEventListener('touchstart', handleTouchStart, { passive: true });\n viewport.addEventListener('touchmove', handleTouchMove, { passive: false });\n viewport.addEventListener('touchend', handleTouchEnd);\n viewport.addEventListener('touchcancel', handleTouchEnd);\n\n return () => {\n viewport.removeEventListener('wheel', handleWheel);\n viewport.removeEventListener('touchstart', handleTouchStart);\n viewport.removeEventListener('touchmove', handleTouchMove);\n viewport.removeEventListener('touchend', handleTouchEnd);\n viewport.removeEventListener('touchcancel', handleTouchEnd);\n };\n }, [timeZone]);\n\n const months = useMemo(() => {\n const getMeasuredHeight = (monthKey: string) => measuredHeights.get(monthKey) ?? estimateMonthHeight(monthKey);\n const positions =\n state.layout === 'linear'\n ? getLinearMonthPositions(state.monthKeys, state.scrollPosition, getMeasuredHeight)\n : getMonthPositions(state.monthKeys, state.scrollPosition, getMeasuredHeight);\n\n return state.monthKeys.map((monthKey, index) => ({\n monthKey,\n index,\n top: positions[index],\n height: getMeasuredHeight(monthKey),\n }));\n }, [state.monthKeys, state.scrollPosition, state.layout, measuredHeights]);\n\n const setMonthEl = (monthKey: string, node: HTMLElement | null) => {\n if (!node) {\n monthElsRef.current.delete(monthKey);\n const ro = observersRef.current.get(monthKey);\n if (ro) {\n ro.disconnect();\n observersRef.current.delete(monthKey);\n }\n return;\n }\n\n const prev = monthElsRef.current.get(monthKey);\n monthElsRef.current.set(monthKey, node);\n commitHeight(monthKey, node.offsetHeight);\n\n if (typeof ResizeObserver === 'undefined') {\n return;\n }\n\n if (prev === node && observersRef.current.has(monthKey)) {\n return;\n }\n\n const existing = observersRef.current.get(monthKey);\n if (existing) {\n existing.disconnect();\n }\n\n const ro = new ResizeObserver(() => {\n commitHeight(monthKey, node.offsetHeight);\n });\n ro.observe(node);\n observersRef.current.set(monthKey, ro);\n };\n\n const scrollToMonth = (date: DateValue) => {\n cancelSnap();\n cancelAnimation();\n\n const target = getCenterMonth(date, timeZone);\n const prev = stateRef.current;\n if (\n toMonthKey(prev.centerMonth) === toMonthKey(target) &&\n prev.scrollPosition === 0 &&\n prev.layout === 'centered'\n ) {\n return;\n }\n\n const { keys, fromKey, toKey } = buildScrollPathKeys(prev.centerMonth, target);\n if (fromKey === toKey) {\n setState(createScrollState(target, timeZone));\n return;\n }\n\n const fromOffset = linearScrollOffsetForMonthKey(keys, fromKey, getHeight);\n const toOffset = linearScrollOffsetForMonthKey(keys, toKey, getHeight);\n\n setState({\n centerMonth: target,\n monthKeys: keys,\n scrollPosition: fromOffset,\n layout: 'linear',\n });\n\n requestAnimationFrame(() => {\n animateScrollPosition(fromOffset, toOffset, SCROLL_TO_MONTH_MS, () => {\n setState(createScrollState(target, timeZone));\n });\n });\n };\n\n const scrollToMonthRef = useRef(scrollToMonth);\n scrollToMonthRef.current = scrollToMonth;\n\n const ensureMonthVisible = (date: DateValue) => {\n const targetKey = toMonthKey(getCenterMonth(date, timeZone));\n if (stateRef.current.monthKeys.includes(targetKey)) {\n return;\n }\n scrollToMonth(date);\n };\n\n useEffect(() => {\n if (!scrollToMonthKeyDep || scrollToDate == null) {\n return;\n }\n\n // Skip partial year commits while typing (e.g. 2 / 20 / 202).\n if (toCalendarDate(scrollToDate).year < 1000) {\n return;\n }\n\n scrollToMonthRef.current(scrollToDate);\n }, [scrollToDate, scrollToMonthKeyDep]);\n\n return { months, viewportRef, setMonthEl, scrollToMonth, ensureMonthVisible };\n};\n","import { type ComponentPropsWithoutRef, type ReactNode, type RefObject } from 'react';\n\nimport cn from 'classnames';\n\nimport styles from '../../styles.module.css';\n\nexport interface IMonthListItem {\n monthKey: string;\n index: number;\n top: number;\n height: number;\n}\n\ninterface IMonthListProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {\n months: IMonthListItem[];\n viewportRef: RefObject<HTMLDivElement | null>;\n setMonthEl: (monthKey: string, node: HTMLDivElement | null) => void;\n children: (item: IMonthListItem) => ReactNode;\n}\n\n/** Absolute-positioned month stack inside the fake-scroll viewport. */\nexport const MonthList = ({ months, viewportRef, setMonthEl, className, children, ...props }: IMonthListProps) => (\n <div {...props} ref={viewportRef} className={cn(styles.viewport, className)} data-test-id=\"calendar-viewport\">\n {months.map(item => (\n <div\n key={item.monthKey}\n ref={node => setMonthEl(item.monthKey, node)}\n className={styles.month}\n data-month-key={item.monthKey}\n data-month-offset={item.index}\n style={{ top: item.top }}\n >\n {children(item)}\n </div>\n ))}\n </div>\n);\n\nMonthList.displayName = 'MonthList';\n","import { DEFAULT_MONTH_HEIGHT_METRICS } from './date';\n\n/**\n * Offset for month heading to stick to the viewport top while the month scrolls under it.\n * Kontur-style (absolute months → not CSS `position: sticky`).\n */\nexport const getStickyHeadingOffset = (\n monthTop: number,\n monthHeight: number,\n headingHeight: number = DEFAULT_MONTH_HEIGHT_METRICS.headingHeight\n): number => {\n if (monthTop >= 0 || monthHeight <= 0 || headingHeight <= 0) {\n return 0;\n }\n\n return Math.min(-monthTop, Math.max(0, monthHeight - headingHeight));\n};\n\n/** Max month `top` still treated as near the viewport top (Kontur ~52). */\nexport const HEADING_INTERACTIVE_TOP = 52;\n\n/**\n * Whether month/year selects should be interactive (Kontur sticky/active heading).\n */\nexport const isMonthHeadingInteractive = (\n monthTop: number,\n monthHeight: number,\n headingHeight: number = DEFAULT_MONTH_HEIGHT_METRICS.headingHeight\n): boolean => {\n if (monthHeight <= 0) {\n return false;\n }\n\n const headingOffset = getStickyHeadingOffset(monthTop, monthHeight, headingHeight);\n if (monthTop > HEADING_INTERACTIVE_TOP) {\n return false;\n }\n if (headingOffset >= monthHeight - headingHeight) {\n return false;\n }\n\n return true;\n};\n","import { type FocusEventHandler, type KeyboardEventHandler } from 'react';\n\nimport { type CalendarDate } from '@internationalized/date';\nimport cn from 'classnames';\n\nimport { typographyStyles } from '@ds/typography';\n\nimport styles from './styles.module.css';\n\n/** Day cell chrome props. */\nexport interface IDayCellProps {\n date: CalendarDate;\n label: string;\n isOutsideMonth?: boolean;\n isToday?: boolean;\n isSelected?: boolean;\n isDisabled?: boolean;\n isUnavailable?: boolean;\n isSelectionStart?: boolean;\n isSelectionEnd?: boolean;\n isInRange?: boolean;\n isHovered?: boolean;\n /** Keyboard-engaged focus ring + arrow keys. */\n isFocused?: boolean;\n /** Tab stop override; defaults to `0` when `isFocused`, else `-1`. */\n tabIndex?: number;\n onSelect?: (date: CalendarDate) => void;\n onHoverChange?: (date: CalendarDate | null) => void;\n onFocusDate?: (date: CalendarDate) => void;\n onBlurDate?: FocusEventHandler<HTMLButtonElement>;\n onKeyDown?: KeyboardEventHandler<HTMLButtonElement>;\n}\n\n/** Day button for custom month grid. */\nexport const DayCell = ({\n date,\n label,\n isOutsideMonth = false,\n isToday = false,\n isSelected = false,\n isDisabled = false,\n isUnavailable = false,\n isSelectionStart = false,\n isSelectionEnd = false,\n isInRange = false,\n isHovered = false,\n isFocused = false,\n tabIndex,\n onSelect,\n onHoverChange,\n onFocusDate,\n onBlurDate,\n onKeyDown,\n}: IDayCellProps) => {\n const blocked = isDisabled || isUnavailable;\n\n const handleFocus: FocusEventHandler<HTMLButtonElement> = () => {\n onFocusDate?.(date);\n };\n\n return (\n <button\n type=\"button\"\n className={cn(styles.cell, typographyStyles.bodyS)}\n aria-label={label}\n aria-pressed={isSelected || undefined}\n disabled={blocked}\n tabIndex={tabIndex ?? (isFocused ? 0 : -1)}\n data-date={date.toString()}\n data-outside-month={isOutsideMonth || undefined}\n data-today={isToday || undefined}\n data-selected={isSelected || undefined}\n data-disabled={isDisabled || undefined}\n data-unavailable={isUnavailable || undefined}\n data-selection-start={isSelectionStart || undefined}\n data-selection-end={isSelectionEnd || undefined}\n data-in-range={isInRange || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n onClick={() => onSelect?.(date)}\n onMouseEnter={() => onHoverChange?.(date)}\n onMouseLeave={() => onHoverChange?.(null)}\n onFocus={handleFocus}\n onBlur={onBlurDate}\n onKeyDown={isFocused ? onKeyDown : undefined}\n >\n {date.day}\n </button>\n );\n};\n\nDayCell.displayName = 'DayCell';\n","import { useMemo, useRef } from 'react';\n\nimport cn from 'classnames';\nimport { Button, ListBox, ListBoxItem, Popover, Select, SelectValue, useLocale } from 'react-aria-components';\n\nimport { typographyStyles } from '@ds/typography';\n\nimport { ChevronDown } from '@/icons';\n\nimport { getMonthLabels } from '../../utils/date';\n\nimport styles from './styles.module.css';\n\nexport type TMonthYearSelectType = 'month' | 'year';\n\n/** Caption select for calendar heading (Kontur-like). */\nexport interface IMonthYearSelectProps {\n type: TMonthYearSelectType;\n value: number;\n minValue: number;\n maxValue: number;\n onChange: (value: number) => void;\n /** Fires when the menu opens or closes. */\n onOpenChange?: (isOpen: boolean) => void;\n isDisabled?: boolean;\n 'aria-label'?: string;\n}\n\ninterface ISelectItem {\n id: string;\n label: string;\n}\n\n/** Build select items strictly within `minValue…maxValue` (no expand to typed value). */\nexport const buildMonthYearSelectItems = (\n type: TMonthYearSelectType,\n minValue: number,\n maxValue: number,\n monthLabels: readonly string[] = []\n): ISelectItem[] => {\n if (maxValue < minValue) {\n return [];\n }\n\n if (type === 'month') {\n return Array.from({ length: maxValue - minValue + 1 }, (_, index) => {\n const month = minValue + index;\n\n return { id: String(month), label: monthLabels[month - 1] ?? String(month) };\n });\n }\n\n return Array.from({ length: maxValue - minValue + 1 }, (_, index) => {\n const year = minValue + index;\n\n return { id: String(year), label: String(year) };\n });\n};\n\n/** Month or year caption Select for sticky calendar heading. */\nexport const MonthYearSelect = ({\n type,\n value,\n minValue,\n maxValue,\n onChange,\n onOpenChange,\n isDisabled = false,\n 'aria-label': ariaLabel,\n}: IMonthYearSelectProps) => {\n const { locale } = useLocale();\n const listRef = useRef<HTMLDivElement>(null);\n const monthLabels = useMemo(() => getMonthLabels(locale), [locale]);\n\n const items = useMemo(\n () => buildMonthYearSelectItems(type, minValue, maxValue, monthLabels),\n [type, minValue, maxValue, monthLabels]\n );\n\n const selectedKey = String(value);\n const hasSelectedItem = items.some(item => item.id === selectedKey);\n const displayLabel = type === 'month' ? (monthLabels[value - 1] ?? String(value)) : String(value);\n const testId = type === 'month' ? 'calendar-month-select' : 'calendar-year-select';\n\n const scrollSelectedIntoView = () => {\n requestAnimationFrame(() => {\n const selected = listRef.current?.querySelector('[data-selected]');\n if (selected && typeof selected.scrollIntoView === 'function') {\n selected.scrollIntoView({ block: 'nearest' });\n }\n });\n };\n\n return (\n <Select\n aria-label={ariaLabel}\n selectedKey={hasSelectedItem ? selectedKey : null}\n isDisabled={isDisabled || items.length === 0}\n onOpenChange={isOpen => {\n onOpenChange?.(isOpen);\n if (isOpen) {\n scrollSelectedIntoView();\n }\n }}\n onSelectionChange={key => {\n if (key == null) {\n return;\n }\n const next = Number(key);\n if (!Number.isNaN(next) && next !== value) {\n onChange(next);\n }\n }}\n className={styles.headingSelectRoot}\n data-test-id={testId}\n >\n <Button className={cn(styles.headingSelect, typographyStyles.bodyS)} data-test-id={`${testId}-trigger`}>\n <SelectValue>{() => displayLabel}</SelectValue>\n <ChevronDown className={styles.headingSelectIcon} aria-hidden />\n </Button>\n <Popover className={styles.headingMenu} placement=\"bottom start\">\n <ListBox ref={listRef} className={styles.headingMenuList} items={items}>\n {item => (\n <ListBoxItem id={item.id} textValue={item.label} className={styles.headingMenuItem}>\n {item.label}\n </ListBoxItem>\n )}\n </ListBox>\n </Popover>\n </Select>\n );\n};\n\nMonthYearSelect.displayName = 'MonthYearSelect';\n","import { useMemo, useState, type FocusEventHandler, type KeyboardEventHandler } from 'react';\n\nimport { CalendarDate, getLocalTimeZone, today } from '@internationalized/date';\nimport cn from 'classnames';\nimport { useLocale } from 'react-aria-components';\n\nimport { typographyStyles } from '@ds/typography';\n\nimport {\n getMonthLabels,\n getMonthRangeForYear,\n getMonthWeeks,\n getWeekdayLabels,\n getYearRange,\n isDateInRange,\n isDateOutOfBounds,\n isSameDay,\n isSameMonth,\n parseMonthKey,\n} from '../../utils/date';\nimport { getStickyHeadingOffset, isMonthHeadingInteractive } from '../../utils/sticky';\nimport { DayCell } from '../DayCell';\nimport { MonthYearSelect } from '../MonthYearSelect';\n\nimport styles from './styles.module.css';\n\nconst FIRST_DAY_OF_WEEK = 1;\n\n/** Selection / constraint slice for a month grid. */\nexport interface IMonthViewSelection {\n /** Selected single date. */\n selectedDate?: CalendarDate | null;\n /** Selected range start. */\n rangeStart?: CalendarDate | null;\n /** Selected range end. */\n rangeEnd?: CalendarDate | null;\n /** Anchor while picking the second range end. */\n rangeAnchor?: CalendarDate | null;\n /** Hovered date for range preview. */\n hoveredDate?: CalendarDate | null;\n minValue?: CalendarDate | null;\n maxValue?: CalendarDate | null;\n isDateUnavailable?: (date: CalendarDate) => boolean;\n isDisabled?: boolean;\n onSelect?: (date: CalendarDate) => void;\n onHoverChange?: (date: CalendarDate | null) => void;\n /** Jump fake-scroll window to month/year. */\n onMonthYearChange?: (date: CalendarDate) => void;\n /** Roving keyboard focus date. */\n focusedDate?: CalendarDate | null;\n /** When false, day has no focus ring / arrow keys until focused (tab stop still present). */\n isGridEngaged?: boolean;\n onFocusDate?: (date: CalendarDate) => void;\n onBlurDate?: FocusEventHandler<HTMLButtonElement>;\n onDayKeyDown?: KeyboardEventHandler<HTMLButtonElement>;\n}\n\nexport interface IMonthViewProps extends IMonthViewSelection {\n monthKey: string;\n /** Absolute `top` of the month block in the viewport. */\n monthTop?: number;\n /** Measured / estimated month block height. */\n monthHeight?: number;\n}\n\n/** One month: heading + weekday row + day grid. */\nexport const MonthView = ({\n monthKey,\n monthTop = 0,\n monthHeight = 0,\n selectedDate = null,\n rangeStart = null,\n rangeEnd = null,\n rangeAnchor = null,\n hoveredDate = null,\n minValue = null,\n maxValue = null,\n isDateUnavailable,\n isDisabled = false,\n onSelect,\n onHoverChange,\n onMonthYearChange,\n focusedDate = null,\n isGridEngaged = true,\n onFocusDate,\n onBlurDate,\n onDayKeyDown,\n}: IMonthViewProps) => {\n const { locale } = useLocale();\n const timeZone = getLocalTimeZone();\n const month = useMemo(() => parseMonthKey(monthKey), [monthKey]);\n const weeks = useMemo(() => (month ? getMonthWeeks(month, FIRST_DAY_OF_WEEK) : []), [month]);\n const weekdayLabels = useMemo(() => getWeekdayLabels(locale, FIRST_DAY_OF_WEEK), [locale]);\n const todayDate = today(timeZone);\n const headingOffset = getStickyHeadingOffset(monthTop, monthHeight);\n const headingInteractive = !isDisabled && isMonthHeadingInteractive(monthTop, monthHeight);\n const [monthSelectOpen, setMonthSelectOpen] = useState(false);\n const [yearSelectOpen, setYearSelectOpen] = useState(false);\n const showMonthYearSelect = headingInteractive || monthSelectOpen || yearSelectOpen;\n const yearRange = useMemo(() => getYearRange(minValue, maxValue), [minValue, maxValue]);\n const monthRange = useMemo(\n () => (month ? getMonthRangeForYear(month.year, minValue, maxValue) : { minMonth: 1, maxMonth: 12 }),\n [month, minValue, maxValue]\n );\n const monthLabels = useMemo(() => getMonthLabels(locale), [locale]);\n\n const dateFormatter = useMemo(\n () => new Intl.DateTimeFormat(locale, { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }),\n [locale]\n );\n\n if (!month) {\n return null;\n }\n\n const previewEnd = hoveredDate ?? rangeEnd ?? rangeAnchor;\n const hasCompleteRange = rangeStart != null && rangeEnd != null;\n const hasPreviewRange = rangeAnchor != null && previewEnd != null;\n\n const handleMonthChange = (nextMonth: number) => {\n onMonthYearChange?.(new CalendarDate(month.year, nextMonth, 1));\n };\n\n const handleYearChange = (nextYear: number) => {\n const range = getMonthRangeForYear(nextYear, minValue, maxValue);\n const nextMonth = Math.min(Math.max(month.month, range.minMonth), range.maxMonth);\n onMonthYearChange?.(new CalendarDate(nextYear, nextMonth, 1));\n };\n\n return (\n <>\n <div className={cn(styles.heading, typographyStyles.bodyS)} style={{ top: headingOffset }}>\n {showMonthYearSelect ? (\n <>\n <MonthYearSelect\n type=\"month\"\n value={month.month}\n minValue={monthRange.minMonth}\n maxValue={monthRange.maxMonth}\n isDisabled={isDisabled}\n aria-label={monthLabels[month.month - 1]}\n onChange={handleMonthChange}\n onOpenChange={setMonthSelectOpen}\n />\n <MonthYearSelect\n type=\"year\"\n value={month.year}\n minValue={yearRange.minYear}\n maxValue={yearRange.maxYear}\n isDisabled={isDisabled}\n aria-label={String(month.year)}\n onChange={handleYearChange}\n onOpenChange={setYearSelectOpen}\n />\n </>\n ) : (\n <>\n <span>{monthLabels[month.month - 1]}</span>\n <span>{month.year}</span>\n </>\n )}\n </div>\n <table className={styles.grid} role=\"grid\">\n <thead>\n <tr>\n {weekdayLabels.map(label => (\n <th key={label} scope=\"col\">\n {label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {weeks.map(week => (\n <tr key={week[0]?.toString()} role=\"row\">\n {week.map(date => {\n const outside = !isSameMonth(date, month);\n const outOfBounds = isDateOutOfBounds(date, minValue, maxValue);\n const unavailable = Boolean(isDateUnavailable?.(date));\n const disabled = isDisabled || outOfBounds;\n const isToday = isSameDay(date, todayDate);\n const isFocusDate = focusedDate != null && isSameDay(date, focusedDate) && !outside;\n const isRovingTarget = isFocusDate && isGridEngaged;\n\n let isSelected = false;\n let isSelectionStart = false;\n let isSelectionEnd = false;\n let isInRange = false;\n\n if (selectedDate != null && isSameDay(date, selectedDate)) {\n isSelected = true;\n }\n\n if (hasCompleteRange && rangeStart && rangeEnd) {\n isSelectionStart = isSameDay(date, rangeStart);\n isSelectionEnd = isSameDay(date, rangeEnd);\n isSelected = isSelectionStart || isSelectionEnd;\n isInRange = isDateInRange(date, rangeStart, rangeEnd);\n }\n\n if (!hasCompleteRange && hasPreviewRange && rangeAnchor && previewEnd) {\n isSelectionStart = isSameDay(date, rangeAnchor);\n isSelectionEnd = isSameDay(date, previewEnd);\n isSelected = isSelectionStart || isSelectionEnd;\n isInRange = isDateInRange(date, rangeAnchor, previewEnd);\n }\n\n return (\n <td key={date.toString()} role=\"gridcell\">\n <DayCell\n date={date}\n label={dateFormatter.format(date.toDate(timeZone))}\n isOutsideMonth={outside}\n isToday={isToday}\n isSelected={isSelected}\n isDisabled={disabled}\n isUnavailable={unavailable}\n isSelectionStart={isSelectionStart}\n isSelectionEnd={isSelectionEnd}\n isInRange={isInRange}\n isHovered={hoveredDate != null && isSameDay(date, hoveredDate)}\n isFocused={isRovingTarget}\n tabIndex={isFocusDate ? 0 : -1}\n onSelect={onSelect}\n onHoverChange={onHoverChange}\n onFocusDate={onFocusDate}\n onBlurDate={onBlurDate}\n onKeyDown={onDayKeyDown}\n />\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n </table>\n </>\n );\n};\n\nMonthView.displayName = 'MonthView';\n"],"names":["CALENDAR_WINDOW_MONTHS","DEFAULT_YEAR_MIN","DEFAULT_YEAR_MAX","SCROLL_TO_MONTH_MS","WEEK_SNAP_IDLE_MS","WEEK_SNAP_DURATION_MS","DEFAULT_MONTH_HEIGHT_METRICS","CALENDAR_VIEWPORT_HEIGHT","getYearRange","minValue","maxValue","minYear","toCalendarDate","maxYear","getMonthRangeForYear","year","minMonth","maxMonth","min","max","getMonthLabels","locale","formatter","_","index","toMonthKey","date","parseMonthKey","monthKey","match","month","CalendarDate","getMonthWeekCount","firstDayOfWeek","start","startOfMonth","daysInMonth","endOfMonth","offset","estimateMonthHeight","metrics","weeks","createEstimateGetHeight","getToday","timeZone","today","getCenterIndex","windowMonths","getCenterMonth","scrollToDate","isSameMonth","isSameDay","a","b","isDateInRange","end","d","lo","hi","isDateOutOfBounds","getMonthWeeks","weekCount","cursor","week","row","day","getWeekdayLabels","weekday","sunday","getWindowMonthKeys","anchor","count","getCenteredMonthKeys","center","monthIndexDelta","from","to","CALENDAR_GRID_FIRST_DAY_OF_WEEK","NAV_KEYS","isBlocked","options","getWeekdayOffset","stepFocusedDate","key","getSkipDayDelta","moveFocusedDate","next","delta","guard","candidate","clampIntoBounds","getInitialFocusedDate","preferred","getLocalTimeZone","todayDate","prev","focusedDateInMonth","focusedDate","focusDateButton","viewport","iso","button","focusDateButtonWhenReady","attempts","useCalendarGridKeyboard","viewportRef","ensureMonthVisible","preferredDate","isDateUnavailable","onSelect","autoFocusDay","moveOptions","setFocusedDate","useState","focusedDateRef","useRef","didInitialFocusRef","isGridEngaged","setGridEngaged","useEffect","frame","moveFocusTo","useCallback","onDayFocus","onDayBlur","event","setFocusedDateFromParts","onDayKeyDown","MAX_SCROLL_MONTHS","buildScrollPathKeys","maxMonths","sign","fromKey","toKey","first","keys","pad","pathFirst","pathLast","before","after","getMonthPositions","monthKeys","scrollPosition","getHeight","centerIndex","positions","getLinearMonthPositions","scrollOffset","linearScrollOffsetForMonthKey","sum","i","WEEK_SNAP_THRESHOLD","getNearTopSnapScrollPosition","threshold","scrollDirection","bestIndex","bestDist","dist","target","alt","applyScrollDelta","deltaY","nextKeys","nextPos","maxShifts","shift","prevKey","centerKey","centerMonth","wheelDeltaToPixels","deltaMode","toCal","value","createScrollState","useFakeScrollCalendar","state","setState","measuredHeights","setMeasuredHeights","monthElsRef","heightsRef","observersRef","touchStartYRef","rafRef","animRafRef","snapTimeoutRef","pendingDeltaRef","lastDeltaSignRef","stateRef","scrollToMonthKeyDep","commitHeight","height","cancelAnimation","cancelSnap","animateScrollPosition","durationMs","onEnd","tick","now","t","eased","scheduleWeekSnapRef","useLayoutEffect","changed","ro","flushDelta","nearest","reset","queueDelta","handleWheel","handleTouchStart","handleTouchMove","clientY","handleTouchEnd","months","useMemo","getMeasuredHeight","setMonthEl","node","existing","scrollToMonth","fromOffset","toOffset","scrollToMonthRef","targetKey","MonthList","className","children","props","jsx","cn","styles","item","getStickyHeadingOffset","monthTop","monthHeight","headingHeight","HEADING_INTERACTIVE_TOP","isMonthHeadingInteractive","headingOffset","DayCell","label","isOutsideMonth","isToday","isSelected","isDisabled","isUnavailable","isSelectionStart","isSelectionEnd","isInRange","isHovered","isFocused","tabIndex","onHoverChange","onFocusDate","onBlurDate","onKeyDown","blocked","handleFocus","typographyStyles","buildMonthYearSelectItems","type","monthLabels","MonthYearSelect","onChange","onOpenChange","ariaLabel","useLocale","listRef","items","selectedKey","hasSelectedItem","displayLabel","testId","scrollSelectedIntoView","selected","jsxs","Select","isOpen","Button","SelectValue","ChevronDown","Popover","ListBox","ListBoxItem","FIRST_DAY_OF_WEEK","MonthView","selectedDate","rangeStart","rangeEnd","rangeAnchor","hoveredDate","onMonthYearChange","weekdayLabels","headingInteractive","monthSelectOpen","setMonthSelectOpen","yearSelectOpen","setYearSelectOpen","showMonthYearSelect","yearRange","monthRange","dateFormatter","previewEnd","hasCompleteRange","hasPreviewRange","handleMonthChange","nextMonth","handleYearChange","nextYear","range","Fragment","outside","outOfBounds","unavailable","disabled","isFocusDate","isRovingTarget"],"mappings":";;;;;;;AACO,MAAMA,KAAyB,GAGzBC,KAAmB,MACnBC,KAAmB,MAGnBC,KAAqB,KAGrBC,KAAoB,KAGpBC,KAAwB,KCKxBC,IAAoD;AAAA,EAC7D,UAAU;AAAA,EACV,eAAe;AAAA,EACf,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,gBAAgB;AACpB,GAGaC,KAA2B,KAG3BC,KAAe,CACxBC,GACAC,MACuC;AACvC,QAAMC,IAAUF,KAAY,OAAOG,EAAeH,CAAQ,EAAE,OAAOR,IAC7DY,IAAUH,KAAY,OAAOE,EAAeF,CAAQ,EAAE,OAAOR;AAEnE,SAAIS,IAAUE,IACH,EAAE,SAASA,GAAS,SAASF,EAAA,IAGjC,EAAE,SAAAA,GAAS,SAAAE,EAAA;AACtB,GAGaC,KAAuB,CAChCC,GACAN,GACAC,MACyC;AACzC,MAAIM,IAAW,GACXC,IAAW;AAEf,MAAIR,KAAY,MAAM;AAClB,UAAMS,IAAMN,EAAeH,CAAQ;AACnC,QAAIM,IAAOG,EAAI;AACX,aAAO,EAAE,UAAU,GAAG,UAAU,EAAA;AAEpC,IAAIH,MAASG,EAAI,SACbF,IAAWE,EAAI;AAAA,EAEvB;AAEA,MAAIR,KAAY,MAAM;AAClB,UAAMS,IAAMP,EAAeF,CAAQ;AACnC,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AAAA,YACA,eAAAiJ;AAAA,YACA,aAAAC;AAAA,YACA,YAAAC;AAAA,YACA,WAAWjI;AAAA,UAAA;AAAA,QAAA,KAnBVrG,EAAK,UAqBd;AAAA,MAER,CAAC,KAzDIqC,EAAK,CAAC,GAAG,SAAA,CA0DlB,CACH,EAAA,CACL;AAAA,IAAA,EAAA,CACJ;AAAA,EAAA,GACJ;AAER;AAEAgO,GAAU,cAAc;"}
|
|
1
|
+
{"version":3,"file":"index-o14ps46j.js","sources":["../src/calendar/constants.ts","../src/calendar/utils/date.ts","../src/calendar/hooks/useCalendarGridKeyboard/index.ts","../src/calendar/utils/scroll.ts","../src/calendar/hooks/useFakeScrollCalendar.ts","../src/calendar/components/MonthList/index.tsx","../src/calendar/utils/sticky.ts","../src/calendar/components/DayCell/index.tsx","../src/calendar/components/MonthYearSelect/index.tsx","../src/calendar/components/MonthView/index.tsx"],"sourcesContent":["/** Visible month window size for vertical scroll calendar. */\nexport const CALENDAR_WINDOW_MONTHS = 3;\n\n/** Fallback year bounds when DatePicker has no min/max. */\nexport const DEFAULT_YEAR_MIN = 1900;\nexport const DEFAULT_YEAR_MAX = 2100;\n\n/** Animated `scrollToMonth` duration. */\nexport const SCROLL_TO_MONTH_MS = 200;\n\n/** Idle delay before week-row snap. */\nexport const WEEK_SNAP_IDLE_MS = 300;\n\n/** Week-row snap animation duration. */\nexport const WEEK_SNAP_DURATION_MS = 150;\n","import { CalendarDate, type DateValue, endOfMonth, startOfMonth, toCalendarDate, today } from '@internationalized/date';\n\nimport { CALENDAR_WINDOW_MONTHS, DEFAULT_YEAR_MAX, DEFAULT_YEAR_MIN } from '../constants';\n\n/** Layout metrics for month height estimates (px, match `--aui-calendar-*`). */\nexport interface IMonthHeightMetrics {\n /** Day / weekday cell size. */\n cellSize: number;\n /** Month title block height (padding + line). */\n headingHeight: number;\n /** Gap between heading and grid. */\n monthGap: number;\n /** Weekday header row height. */\n weekdayRowHeight: number;\n /** Space after the month (former viewport gap). */\n monthBottomGap: number;\n}\n\n/** Defaults aligned with semantic calendar tokens (`space-8/16/32`). */\nexport const DEFAULT_MONTH_HEIGHT_METRICS: IMonthHeightMetrics = {\n cellSize: 32,\n headingHeight: 36,\n monthGap: 8,\n weekdayRowHeight: 32,\n monthBottomGap: 16,\n};\n\n/** Fallback viewport height (matches `--aui-calendar-max-h`). */\nexport const CALENDAR_VIEWPORT_HEIGHT = 320;\n\n/** Year bounds from optional min/max date constraints. */\nexport const getYearRange = (\n minValue?: DateValue | null,\n maxValue?: DateValue | null\n): { minYear: number; maxYear: number } => {\n const minYear = minValue != null ? toCalendarDate(minValue).year : DEFAULT_YEAR_MIN;\n const maxYear = maxValue != null ? toCalendarDate(maxValue).year : DEFAULT_YEAR_MAX;\n\n if (minYear > maxYear) {\n return { minYear: maxYear, maxYear: minYear };\n }\n\n return { minYear, maxYear };\n};\n\n/** Allowed month numbers (1–12) for `year` given optional min/max dates. */\nexport const getMonthRangeForYear = (\n year: number,\n minValue?: DateValue | null,\n maxValue?: DateValue | null\n): { minMonth: number; maxMonth: number } => {\n let minMonth = 1;\n let maxMonth = 12;\n\n if (minValue != null) {\n const min = toCalendarDate(minValue);\n if (year < min.year) {\n return { minMonth: 1, maxMonth: 0 };\n }\n if (year === min.year) {\n minMonth = min.month;\n }\n }\n\n if (maxValue != null) {\n const max = toCalendarDate(maxValue);\n if (year > max.year) {\n return { minMonth: 1, maxMonth: 0 };\n }\n if (year === max.year) {\n maxMonth = max.month;\n }\n }\n\n if (minMonth > maxMonth) {\n return { minMonth, maxMonth: minMonth - 1 };\n }\n\n return { minMonth, maxMonth };\n};\n\n/** Localized long month names (index 0 = January). */\nexport const getMonthLabels = (locale: string): string[] => {\n const formatter = new Intl.DateTimeFormat(locale, { month: 'long' });\n\n return Array.from({ length: 12 }, (_, index) => formatter.format(new Date(Date.UTC(2024, index, 1))));\n};\n\n/** Height resolver: measured DOM height or estimate. */\nexport type TGetMonthHeight = (monthKey: string) => number;\n\n/** Month key for DOM data attributes (`yyyy-mm`). */\nexport const toMonthKey = (date: DateValue): string => `${date.year}-${String(date.month).padStart(2, '0')}`;\n\n/** Parse `yyyy-mm` month key back to the first day of that month. */\nexport const parseMonthKey = (monthKey: string): CalendarDate | null => {\n const match = /^(\\d{4})-(\\d{2})$/.exec(monthKey);\n if (!match) {\n return null;\n }\n\n const year = Number(match[1]);\n const month = Number(match[2]);\n if (month < 1 || month > 12) {\n return null;\n }\n\n return new CalendarDate(year, month, 1);\n};\n\n/**\n * Week rows in a month grid.\n * `firstDayOfWeek`: 0 = Sunday … 6 = Saturday (JS `Date#getDay`).\n */\nexport const getMonthWeekCount = (month: DateValue, firstDayOfWeek = 1): number => {\n const start = startOfMonth(toCalendarDate(month));\n const daysInMonth = endOfMonth(start).day;\n const jsDay = start.toDate('UTC').getDay();\n const offset = (jsDay - firstDayOfWeek + 7) % 7;\n\n return Math.ceil((daysInMonth + offset) / 7);\n};\n\n/** Estimated pixel height of a month block (Kontur-style formula). */\nexport const estimateMonthHeight = (\n monthKey: string,\n metrics: IMonthHeightMetrics = DEFAULT_MONTH_HEIGHT_METRICS,\n firstDayOfWeek = 1\n): number => {\n const month = parseMonthKey(monthKey);\n const weeks = month ? getMonthWeekCount(month, firstDayOfWeek) : 5;\n\n return (\n metrics.headingHeight +\n metrics.monthGap +\n metrics.weekdayRowHeight +\n weeks * metrics.cellSize +\n metrics.monthBottomGap\n );\n};\n\n/** Default height getter via estimate. */\nexport const createEstimateGetHeight =\n (metrics: IMonthHeightMetrics = DEFAULT_MONTH_HEIGHT_METRICS): TGetMonthHeight =>\n monthKey =>\n estimateMonthHeight(monthKey, metrics);\n\n/** Calendar date for “today” in the given time zone. */\nexport const getToday = (timeZone = 'UTC'): CalendarDate => today(timeZone);\n\n/** Index of the pinned month at `scrollPosition === 0`. */\nexport const getCenterIndex = (windowMonths = CALENDAR_WINDOW_MONTHS): number => Math.floor(windowMonths / 2);\n\n/** Months before the center month in the window. */\nexport const getRecenterOffset = (windowMonths = CALENDAR_WINDOW_MONTHS): number => getCenterIndex(windowMonths);\n\n/** First month of the window so `center` sits at `getCenterIndex()`. */\nexport const getRecenterAnchor = (center: DateValue, windowMonths = CALENDAR_WINDOW_MONTHS): CalendarDate =>\n startOfMonth(toCalendarDate(center)).subtract({ months: getRecenterOffset(windowMonths) });\n\n/** First month of the window for `scrollToDate` (or today). */\nexport const getWindowAnchor = (scrollToDate: DateValue | null | undefined, timeZone = 'UTC'): CalendarDate =>\n getRecenterAnchor(scrollToDate ? toCalendarDate(scrollToDate) : getToday(timeZone));\n\n/** Center month (pinned near the top at scrollPosition 0). */\nexport const getCenterMonth = (scrollToDate: DateValue | null | undefined, timeZone = 'UTC'): CalendarDate =>\n startOfMonth(scrollToDate ? toCalendarDate(scrollToDate) : getToday(timeZone));\n\n/** Whether `date` falls in the same calendar month as `month`. */\nexport const isSameMonth = (date: DateValue, month: DateValue): boolean =>\n date.year === month.year && date.month === month.month;\n\n/** Whether two dates are the same calendar day. */\nexport const isSameDay = (a: DateValue, b: DateValue): boolean =>\n a.year === b.year && a.month === b.month && a.day === b.day;\n\n/** Inclusive range check (`start`/`end` order-insensitive). */\nexport const isDateInRange = (date: DateValue, start: DateValue, end: DateValue): boolean => {\n const a = toCalendarDate(start);\n const b = toCalendarDate(end);\n const d = toCalendarDate(date);\n const lo = a.compare(b) <= 0 ? a : b;\n const hi = a.compare(b) <= 0 ? b : a;\n\n return d.compare(lo) >= 0 && d.compare(hi) <= 0;\n};\n\n/** Whether `date` is before `min` or after `max` (when set). */\nexport const isDateOutOfBounds = (\n date: DateValue,\n minValue?: DateValue | null,\n maxValue?: DateValue | null\n): boolean => {\n const d = toCalendarDate(date);\n if (minValue != null && d.compare(toCalendarDate(minValue)) < 0) {\n return true;\n }\n if (maxValue != null && d.compare(toCalendarDate(maxValue)) > 0) {\n return true;\n }\n\n return false;\n};\n\n/**\n * Week rows for a month grid (includes outside-month padding days).\n * `firstDayOfWeek`: 0 = Sunday … 6 = Saturday (JS `Date#getDay`).\n */\nexport const getMonthWeeks = (month: DateValue, firstDayOfWeek = 1): CalendarDate[][] => {\n const start = startOfMonth(toCalendarDate(month));\n const weekCount = getMonthWeekCount(start, firstDayOfWeek);\n const jsDay = start.toDate('UTC').getDay();\n const offset = (jsDay - firstDayOfWeek + 7) % 7;\n let cursor = start.subtract({ days: offset });\n const weeks: CalendarDate[][] = [];\n\n for (let week = 0; week < weekCount; week += 1) {\n const row: CalendarDate[] = [];\n for (let day = 0; day < 7; day += 1) {\n row.push(cursor);\n cursor = cursor.add({ days: 1 });\n }\n weeks.push(row);\n }\n\n return weeks;\n};\n\n/** Weekday labels for the header row, starting at `firstDayOfWeek`. */\nexport const getWeekdayLabels = (\n locale: string,\n firstDayOfWeek = 1,\n weekday: Intl.DateTimeFormatOptions['weekday'] = 'short'\n): string[] => {\n const formatter = new Intl.DateTimeFormat(locale, { weekday });\n // 2024-01-07 is Sunday — walk 7 days from firstDayOfWeek.\n const sunday = new Date(Date.UTC(2024, 0, 7));\n\n return Array.from({ length: 7 }, (_, index) => {\n const day = new Date(sunday);\n day.setUTCDate(sunday.getUTCDate() + ((firstDayOfWeek + index) % 7));\n // Keep 2 chars so en/ru headers share the same visual width in 32px cells.\n return Array.from(formatter.format(day)).slice(0, 2).join('');\n });\n};\n\n/** End of month for height estimates / visibility checks. */\nexport const monthEnd = (date: DateValue): CalendarDate => endOfMonth(toCalendarDate(date));\n\n/** Month keys for a window starting at `anchor`. */\nexport const getWindowMonthKeys = (anchor: CalendarDate, count = CALENDAR_WINDOW_MONTHS): string[] =>\n Array.from({ length: count }, (_, index) => toMonthKey(startOfMonth(anchor).add({ months: index })));\n\n/** Centered window keys around `center` (`[c-k … c … c+k]` for odd N). */\nexport const getCenteredMonthKeys = (center: DateValue, count = CALENDAR_WINDOW_MONTHS): string[] => {\n const month = startOfMonth(toCalendarDate(center));\n const offset = getCenterIndex(count);\n\n return getWindowMonthKeys(month.subtract({ months: offset }), count);\n};\n\n/** @deprecated Use `getCenteredMonthKeys`. */\nexport const getTripleMonthKeys = (center: DateValue): string[] => getCenteredMonthKeys(center);\n\n/** Signed month distance `to - from` (year*12 + month). */\nexport const monthIndexDelta = (from: DateValue, to: DateValue): number => {\n const a = startOfMonth(toCalendarDate(from));\n const b = startOfMonth(toCalendarDate(to));\n\n return b.year * 12 + b.month - (a.year * 12 + a.month);\n};\n","import { useCallback, useEffect, useRef, useState, type FocusEvent, type KeyboardEvent, type RefObject } from 'react';\n\nimport { type CalendarDate, getLocalTimeZone, today } from '@internationalized/date';\n\nimport { isDateOutOfBounds, toMonthKey } from '../../utils/date';\n\n/** Week starts Monday (aligned with MonthView). */\nexport const CALENDAR_GRID_FIRST_DAY_OF_WEEK = 1;\n\nexport type TCalendarGridNavKey =\n 'ArrowLeft' | 'ArrowRight' | 'ArrowUp' | 'ArrowDown' | 'Home' | 'End' | 'PageUp' | 'PageDown';\n\nconst NAV_KEYS = new Set<string>([\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowDown',\n 'Home',\n 'End',\n 'PageUp',\n 'PageDown',\n]);\n\n/** Options for grid keyboard movement. */\nexport interface IMoveFocusedDateOptions {\n minValue?: CalendarDate | null;\n maxValue?: CalendarDate | null;\n isDateUnavailable?: (date: CalendarDate) => boolean;\n firstDayOfWeek?: number;\n}\n\nconst isBlocked = (date: CalendarDate, options: IMoveFocusedDateOptions) =>\n isDateOutOfBounds(date, options.minValue, options.maxValue) || Boolean(options.isDateUnavailable?.(date));\n\n/** Day-of-week index relative to `firstDayOfWeek` (0 = start of week). */\nexport const getWeekdayOffset = (date: CalendarDate, firstDayOfWeek = CALENDAR_GRID_FIRST_DAY_OF_WEEK) => {\n const jsDay = date.toDate('UTC').getDay();\n\n return (jsDay - firstDayOfWeek + 7) % 7;\n};\n\n/** One navigation step before skipping blocked days. */\nexport const stepFocusedDate = (\n date: CalendarDate,\n key: TCalendarGridNavKey,\n firstDayOfWeek = CALENDAR_GRID_FIRST_DAY_OF_WEEK\n): CalendarDate => {\n switch (key) {\n case 'ArrowLeft':\n return date.subtract({ days: 1 });\n case 'ArrowRight':\n return date.add({ days: 1 });\n case 'ArrowUp':\n return date.subtract({ days: 7 });\n case 'ArrowDown':\n return date.add({ days: 7 });\n case 'Home': {\n const offset = getWeekdayOffset(date, firstDayOfWeek);\n\n return date.subtract({ days: offset });\n }\n case 'End': {\n const offset = getWeekdayOffset(date, firstDayOfWeek);\n\n return date.add({ days: 6 - offset });\n }\n case 'PageUp':\n return date.subtract({ months: 1 });\n case 'PageDown':\n return date.add({ months: 1 });\n default:\n return date;\n }\n};\n\n/** Direction used when skipping blocked days after a step. */\nexport const getSkipDayDelta = (key: TCalendarGridNavKey): 1 | -1 => {\n switch (key) {\n case 'ArrowLeft':\n case 'ArrowUp':\n case 'Home':\n case 'PageUp':\n return -1;\n default:\n return 1;\n }\n};\n\n/**\n * Move focus by key; skip unavailable / out-of-bounds days in the same direction.\n * Returns `date` unchanged when no valid target exists.\n */\nexport const moveFocusedDate = (\n date: CalendarDate,\n key: TCalendarGridNavKey,\n options: IMoveFocusedDateOptions = {}\n): CalendarDate => {\n const firstDayOfWeek = options.firstDayOfWeek ?? CALENDAR_GRID_FIRST_DAY_OF_WEEK;\n let next = stepFocusedDate(date, key, firstDayOfWeek);\n\n if (isDateOutOfBounds(next, options.minValue, options.maxValue)) {\n if (options.minValue != null && next.compare(options.minValue) < 0) {\n next = options.minValue;\n }\n if (options.maxValue != null && next.compare(options.maxValue) > 0) {\n next = options.maxValue;\n }\n }\n\n if (isBlocked(next, options) && next.compare(date) === 0) {\n return date;\n }\n\n const delta = getSkipDayDelta(key);\n\n for (let guard = 0; guard < 366 && isBlocked(next, options); guard += 1) {\n const candidate = next.add({ days: delta });\n if (isDateOutOfBounds(candidate, options.minValue, options.maxValue)) {\n return date;\n }\n next = candidate;\n }\n\n return isBlocked(next, options) ? date : next;\n};\n\nconst clampIntoBounds = (date: CalendarDate, options: IMoveFocusedDateOptions): CalendarDate => {\n if (options.minValue != null && date.compare(options.minValue) < 0) {\n return options.minValue;\n }\n if (options.maxValue != null && date.compare(options.maxValue) > 0) {\n return options.maxValue;\n }\n\n return date;\n};\n\n/** Initial focus: preferred (clamped) → today → walk to first available. */\nexport const getInitialFocusedDate = (\n preferred: CalendarDate | null | undefined,\n options: IMoveFocusedDateOptions = {}\n): CalendarDate => {\n const timeZone = getLocalTimeZone();\n const todayDate = today(timeZone);\n const start = clampIntoBounds(preferred ?? todayDate, options);\n\n let cursor = start;\n for (let guard = 0; guard < 366 * 3; guard += 1) {\n if (!isBlocked(cursor, options)) {\n return cursor;\n }\n const next = cursor.add({ days: 1 });\n if (options.maxValue != null && next.compare(options.maxValue) > 0) {\n break;\n }\n cursor = next;\n }\n\n cursor = start;\n for (let guard = 0; guard < 366 * 3; guard += 1) {\n if (!isBlocked(cursor, options)) {\n return cursor;\n }\n const prev = cursor.subtract({ days: 1 });\n if (options.minValue != null && prev.compare(options.minValue) < 0) {\n break;\n }\n cursor = prev;\n }\n\n return options.minValue ?? todayDate;\n};\n\n/** Whether `date`'s month is already rendered in the scroll window. */\nexport const shouldScrollToMonth = (monthKeys: readonly string[], date: CalendarDate) =>\n !monthKeys.includes(toMonthKey(date));\n\n/** Move focused day into `year`/`month`, clamping day to month length / bounds. */\nexport const focusedDateInMonth = (\n focusedDate: CalendarDate,\n year: number,\n month: number,\n options: IMoveFocusedDateOptions = {}\n): CalendarDate => {\n const next = focusedDate.set({ year, month });\n const available = getInitialFocusedDate(next, options);\n\n return available;\n};\n\nconst focusDateButton = (viewport: HTMLElement | null, date: CalendarDate) => {\n const iso = date.toString();\n const button =\n viewport?.querySelector(`[data-date=\"${iso}\"]:not([data-outside-month])`) ??\n viewport?.querySelector(`[data-date=\"${iso}\"]`);\n if (button instanceof HTMLElement) {\n button.focus({ preventScroll: true });\n\n return true;\n }\n\n return false;\n};\n\nconst focusDateButtonWhenReady = (viewport: HTMLElement | null, date: CalendarDate, attempts = 12) => {\n if (focusDateButton(viewport, date) || attempts <= 0) {\n return;\n }\n requestAnimationFrame(() => focusDateButtonWhenReady(viewport, date, attempts - 1));\n};\n\n/** Options for calendar grid keyboard hook. */\nexport interface IUseCalendarGridKeyboardOptions {\n viewportRef: RefObject<HTMLElement | null>;\n /** Sync scroll/center month to the focused date (wired to scrollToMonth in calendars). */\n ensureMonthVisible: (date: CalendarDate) => void;\n preferredDate?: CalendarDate | null;\n minValue?: CalendarDate | null;\n maxValue?: CalendarDate | null;\n isDateUnavailable?: (date: CalendarDate) => boolean;\n onSelect?: (date: CalendarDate) => void;\n /** Focus the day cell on mount (keyboard open only). */\n autoFocusDay?: boolean;\n}\n\n/** Roving focus + arrow navigation for the scroll calendar grid. */\nexport const useCalendarGridKeyboard = ({\n viewportRef,\n ensureMonthVisible,\n preferredDate = null,\n minValue = null,\n maxValue = null,\n isDateUnavailable,\n onSelect,\n autoFocusDay = false,\n}: IUseCalendarGridKeyboardOptions) => {\n const moveOptions: IMoveFocusedDateOptions = { minValue, maxValue, isDateUnavailable };\n const [focusedDate, setFocusedDate] = useState(() => getInitialFocusedDate(preferredDate, moveOptions));\n const focusedDateRef = useRef(focusedDate);\n focusedDateRef.current = focusedDate;\n const didInitialFocusRef = useRef(false);\n const [isGridEngaged, setGridEngaged] = useState(autoFocusDay);\n\n useEffect(() => {\n if (didInitialFocusRef.current) {\n return;\n }\n didInitialFocusRef.current = true;\n if (!autoFocusDay) {\n return;\n }\n setGridEngaged(true);\n const frame = requestAnimationFrame(() => {\n focusDateButtonWhenReady(viewportRef.current, focusedDateRef.current);\n });\n\n return () => cancelAnimationFrame(frame);\n }, [autoFocusDay, viewportRef]);\n\n const moveFocusTo = useCallback(\n (next: CalendarDate) => {\n setGridEngaged(true);\n setFocusedDate(next);\n focusedDateRef.current = next;\n // Sync active/center month even when focusedDate already moved (desync with outside cells).\n ensureMonthVisible(next);\n focusDateButtonWhenReady(viewportRef.current, next);\n },\n [ensureMonthVisible, viewportRef]\n );\n\n const onDayFocus = useCallback((date: CalendarDate) => {\n setGridEngaged(true);\n setFocusedDate(date);\n focusedDateRef.current = date;\n }, []);\n\n const onDayBlur = useCallback((event: FocusEvent<HTMLButtonElement>) => {\n const next = event.relatedTarget;\n if (next instanceof Element && next.closest('[data-date]')) {\n return;\n }\n setGridEngaged(false);\n }, []);\n\n const setFocusedDateFromParts = useCallback(\n (year: number, month: number) => {\n const next = focusedDateInMonth(focusedDateRef.current, year, month, moveOptions);\n setGridEngaged(true);\n setFocusedDate(next);\n focusedDateRef.current = next;\n // Do not focus the day cell here — steals focus from MonthYearSelect and drops its popover.\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [isDateUnavailable, maxValue, minValue]\n );\n\n const onDayKeyDown = useCallback(\n (event: KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n onSelect?.(focusedDateRef.current);\n\n return;\n }\n\n if (!NAV_KEYS.has(event.key)) {\n return;\n }\n\n event.preventDefault();\n const next = moveFocusedDate(focusedDateRef.current, event.key as TCalendarGridNavKey, moveOptions);\n if (next.compare(focusedDateRef.current) === 0) {\n return;\n }\n moveFocusTo(next);\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [isDateUnavailable, maxValue, minValue, moveFocusTo, onSelect]\n );\n\n return { focusedDate, onDayFocus, onDayBlur, onDayKeyDown, setFocusedDateFromParts, isGridEngaged };\n};\n","import { type CalendarDate, type DateValue, startOfMonth, toCalendarDate } from '@internationalized/date';\n\nimport { CALENDAR_WINDOW_MONTHS } from '../constants';\n\nimport {\n CALENDAR_VIEWPORT_HEIGHT,\n DEFAULT_MONTH_HEIGHT_METRICS,\n createEstimateGetHeight,\n getCenterIndex,\n getCenterMonth,\n getCenteredMonthKeys,\n getToday,\n monthIndexDelta,\n parseMonthKey,\n toMonthKey,\n type TGetMonthHeight,\n} from './date';\n\n/** Max months to animate across in `scrollToMonth`. */\nexport const MAX_SCROLL_MONTHS = 6;\n\n/**\n * Contiguous month keys from `from` to `to` (inclusive), direction-aware order.\n * Caps distance to `maxMonths`.\n */\nexport const buildScrollPathKeys = (\n from: DateValue,\n to: DateValue,\n maxMonths = MAX_SCROLL_MONTHS\n): { keys: string[]; fromKey: string; toKey: string } => {\n const start = startOfMonth(toCalendarDate(from));\n let delta = monthIndexDelta(start, to);\n let sign = 0;\n if (delta > 0) {\n sign = 1;\n }\n if (delta < 0) {\n sign = -1;\n }\n if (Math.abs(delta) > maxMonths) {\n delta = sign * maxMonths;\n }\n const end = start.add({ months: delta });\n const fromKey = toMonthKey(start);\n const toKey = toMonthKey(end);\n const count = Math.abs(delta) + 1;\n const first = delta >= 0 ? start : end;\n let keys = Array.from({ length: count }, (_, index) => toMonthKey(first.add({ months: index })));\n\n // Padding so the path covers a center-sized window while animating.\n const pad = getCenterIndex(CALENDAR_WINDOW_MONTHS);\n const pathFirst = parseMonthKey(keys[0])!;\n const pathLast = parseMonthKey(keys[keys.length - 1])!;\n const before = Array.from({ length: pad }, (_, index) => toMonthKey(pathFirst.subtract({ months: pad - index })));\n const after = Array.from({ length: pad }, (_, index) => toMonthKey(pathLast.add({ months: index + 1 })));\n keys = [...before, ...keys, ...after];\n\n return { keys, fromKey, toKey };\n};\n\n/**\n * Absolute `top` for each month given Kontur scrollPosition.\n * At `scrollPosition === 0`, the center month (`getCenterIndex`) sits at the viewport top.\n */\nexport const getMonthPositions = (\n monthKeys: readonly string[],\n scrollPosition: number,\n getHeight: TGetMonthHeight = createEstimateGetHeight()\n): number[] => {\n if (monthKeys.length === 0) {\n return [];\n }\n\n const centerIndex = getCenterIndex(monthKeys.length);\n const positions = Array.from({ length: monthKeys.length }, () => 0);\n positions[centerIndex] = scrollPosition;\n\n for (let index = centerIndex - 1; index >= 0; index -= 1) {\n positions[index] = positions[index + 1] - getHeight(monthKeys[index]);\n }\n\n for (let index = centerIndex + 1; index < monthKeys.length; index += 1) {\n positions[index] = positions[index - 1] + getHeight(monthKeys[index - 1]);\n }\n\n return positions;\n};\n\n/** Whether a month block intersects the viewport. */\nexport const isMonthVisible = (top: number, height: number, viewportHeight: number): boolean =>\n top < viewportHeight && top > -height;\n\n/**\n * Linear tops: `positions[0] = scrollOffset`, then stack downward.\n * Used during animated `scrollToMonth` (not the centered pin model).\n */\nexport const getLinearMonthPositions = (\n monthKeys: readonly string[],\n scrollOffset: number,\n getHeight: TGetMonthHeight = createEstimateGetHeight()\n): number[] => {\n if (monthKeys.length === 0) {\n return [];\n }\n\n const positions = Array.from({ length: monthKeys.length }, () => 0);\n positions[0] = scrollOffset;\n for (let index = 1; index < monthKeys.length; index += 1) {\n positions[index] = positions[index - 1] + getHeight(monthKeys[index - 1]);\n }\n\n return positions;\n};\n\n/** Scroll offset that puts `monthKey` at the viewport top in linear layout. */\nexport const linearScrollOffsetForMonthKey = (\n monthKeys: readonly string[],\n monthKey: string,\n getHeight: TGetMonthHeight = createEstimateGetHeight()\n): number => {\n const index = monthKeys.indexOf(monthKey);\n if (index <= 0) {\n return 0;\n }\n\n let sum = 0;\n for (let i = 0; i < index; i += 1) {\n sum += getHeight(monthKeys[i]);\n }\n\n return -sum;\n};\n\n/** Week-row threshold for Kontur-like near-top snap. */\nexport const WEEK_SNAP_THRESHOLD = DEFAULT_MONTH_HEIGHT_METRICS.headingHeight + DEFAULT_MONTH_HEIGHT_METRICS.cellSize;\n\n/**\n * Soft snap only when a month top is within `threshold` of the viewport top.\n * `scrollDirection`: last wheel sign (<0 up / later content, >0 down / earlier) — Kontur uses\n * negative direction to prefer one week below the title.\n */\nexport const getNearTopSnapScrollPosition = (\n monthKeys: readonly string[],\n scrollPosition: number,\n getHeight: TGetMonthHeight = createEstimateGetHeight(),\n threshold: number = WEEK_SNAP_THRESHOLD,\n scrollDirection = 0\n): number => {\n if (monthKeys.length === 0) {\n return scrollPosition;\n }\n\n const positions = getMonthPositions(monthKeys, scrollPosition, getHeight);\n let bestIndex = 0;\n let bestDist = Math.abs(positions[0]);\n\n for (let index = 1; index < positions.length; index += 1) {\n const dist = Math.abs(positions[index]);\n if (dist < bestDist) {\n bestDist = dist;\n bestIndex = index;\n }\n }\n\n if (bestDist > threshold) {\n return scrollPosition;\n }\n\n const centerIndex = getCenterIndex(monthKeys.length);\n // ScrollPosition that puts bestIndex at top (same math as former scrollPositionForIndex).\n let target = 0;\n if (bestIndex < centerIndex) {\n for (let i = bestIndex; i < centerIndex; i += 1) {\n target += getHeight(monthKeys[i]);\n }\n }\n if (bestIndex > centerIndex) {\n for (let i = centerIndex; i < bestIndex; i += 1) {\n target -= getHeight(monthKeys[i]);\n }\n }\n\n // Kontur: when scrolling toward earlier months near top, prefer one week below title.\n if (scrollDirection > 0 && bestDist > 0.5 && Math.abs(target - scrollPosition) < threshold) {\n const week = DEFAULT_MONTH_HEIGHT_METRICS.cellSize;\n const alt = target - week;\n if (Math.abs(alt - scrollPosition) < Math.abs(target - scrollPosition)) {\n return alt;\n }\n }\n\n return target;\n};\n\n/**\n * Apply wheel/touch delta (Kontur `calculateScrollPosition`).\n * Positive `deltaY` scrolls content up (later months).\n */\nexport const applyScrollDelta = (\n monthKeys: readonly string[],\n scrollPosition: number,\n deltaY: number,\n getHeight: TGetMonthHeight = createEstimateGetHeight()\n): { monthKeys: string[]; scrollPosition: number; centerMonth: CalendarDate } => {\n let nextKeys = monthKeys.length > 0 ? [...monthKeys] : getCenteredMonthKeys(getToday());\n let nextPos = scrollPosition - deltaY;\n const maxShifts = 24;\n const centerIndex = getCenterIndex(nextKeys.length);\n\n if (deltaY < 0) {\n for (let shift = 0; shift < maxShifts; shift += 1) {\n const prevKey = nextKeys[centerIndex - 1];\n if (!prevKey || nextPos < getHeight(prevKey)) {\n break;\n }\n nextPos -= getHeight(prevKey);\n const center = parseMonthKey(nextKeys[centerIndex]);\n if (!center) {\n break;\n }\n nextKeys = getCenteredMonthKeys(center.subtract({ months: 1 }));\n }\n }\n\n if (deltaY > 0) {\n for (let shift = 0; shift < maxShifts; shift += 1) {\n const centerKey = nextKeys[centerIndex];\n if (!centerKey || nextPos >= 0) {\n break;\n }\n nextPos += getHeight(centerKey);\n const center = parseMonthKey(centerKey);\n if (!center) {\n break;\n }\n nextKeys = getCenteredMonthKeys(center.add({ months: 1 }));\n }\n }\n\n const centerMonth = parseMonthKey(nextKeys[getCenterIndex(nextKeys.length)]) ?? getCenterMonth(null);\n\n return { monthKeys: nextKeys, scrollPosition: nextPos, centerMonth };\n};\n\n/** Normalize WheelEvent delta to CSS pixels. */\nexport const wheelDeltaToPixels = (event: Pick<WheelEvent, 'deltaY' | 'deltaMode'>): number => {\n const { deltaY, deltaMode } = event;\n if (deltaMode === 1) {\n return deltaY * 16;\n }\n if (deltaMode === 2) {\n return deltaY * CALENDAR_VIEWPORT_HEIGHT;\n }\n\n return deltaY;\n};\n","import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';\n\nimport { type CalendarDate, type DateValue, getLocalTimeZone, toCalendarDate } from '@internationalized/date';\n\nimport { SCROLL_TO_MONTH_MS, WEEK_SNAP_DURATION_MS, WEEK_SNAP_IDLE_MS } from '../constants';\nimport { estimateMonthHeight, getCenterMonth, getCenteredMonthKeys, parseMonthKey, toMonthKey } from '../utils/date';\nimport {\n applyScrollDelta,\n buildScrollPathKeys,\n getLinearMonthPositions,\n getMonthPositions,\n getNearTopSnapScrollPosition,\n linearScrollOffsetForMonthKey,\n wheelDeltaToPixels,\n} from '../utils/scroll';\n\ntype TScrollLayout = 'centered' | 'linear';\n\ninterface IFakeScrollState {\n centerMonth: CalendarDate;\n monthKeys: string[];\n scrollPosition: number;\n layout: TScrollLayout;\n}\n\nexport const toCal = (value: DateValue | null | undefined): CalendarDate | null =>\n value != null ? toCalendarDate(value) : null;\n\nconst createScrollState = (scrollToDate: DateValue | null | undefined, timeZone: string): IFakeScrollState => {\n const centerMonth = getCenterMonth(scrollToDate, timeZone);\n\n return {\n centerMonth,\n monthKeys: getCenteredMonthKeys(centerMonth),\n scrollPosition: 0,\n layout: 'centered',\n };\n};\n\nexport const useFakeScrollCalendar = (scrollToDate: DateValue | null | undefined) => {\n const timeZone = getLocalTimeZone();\n const [state, setState] = useState<IFakeScrollState>(() => createScrollState(scrollToDate, timeZone));\n const [measuredHeights, setMeasuredHeights] = useState<ReadonlyMap<string, number>>(() => new Map());\n const viewportRef = useRef<HTMLDivElement>(null);\n const monthElsRef = useRef(new Map<string, HTMLElement>());\n const heightsRef = useRef(new Map<string, number>());\n const observersRef = useRef(new Map<string, ResizeObserver>());\n const touchStartYRef = useRef<number | null>(null);\n const rafRef = useRef<number | null>(null);\n const animRafRef = useRef<number | null>(null);\n const snapTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const pendingDeltaRef = useRef(0);\n const lastDeltaSignRef = useRef(0);\n const stateRef = useRef(state);\n stateRef.current = state;\n const scrollToMonthKeyDep = scrollToDate ? toMonthKey(scrollToDate) : null;\n\n const getHeight = (monthKey: string) => heightsRef.current.get(monthKey) ?? estimateMonthHeight(monthKey);\n\n const commitHeight = (monthKey: string, height: number) => {\n if (height <= 0 || heightsRef.current.get(monthKey) === height) {\n return;\n }\n heightsRef.current.set(monthKey, height);\n setMeasuredHeights(new Map(heightsRef.current));\n };\n\n const cancelAnimation = () => {\n if (animRafRef.current != null) {\n cancelAnimationFrame(animRafRef.current);\n animRafRef.current = null;\n }\n };\n\n const cancelSnap = () => {\n if (snapTimeoutRef.current != null) {\n clearTimeout(snapTimeoutRef.current);\n snapTimeoutRef.current = null;\n }\n };\n\n const animateScrollPosition = (from: number, to: number, durationMs: number, onEnd?: () => void) => {\n cancelAnimation();\n const start = performance.now();\n const tick = (now: number) => {\n const t = Math.min(1, (now - start) / durationMs);\n const eased = 1 - (1 - t) ** 3;\n const value = from + (to - from) * eased;\n setState(prev => ({ ...prev, scrollPosition: value }));\n if (t >= 1) {\n animRafRef.current = null;\n onEnd?.();\n return;\n }\n animRafRef.current = requestAnimationFrame(tick);\n };\n animRafRef.current = requestAnimationFrame(tick);\n };\n\n const scheduleWeekSnapRef = useRef<() => void>(null as unknown as () => void);\n scheduleWeekSnapRef.current = () => {\n cancelSnap();\n snapTimeoutRef.current = setTimeout(() => {\n snapTimeoutRef.current = null;\n const prev = stateRef.current;\n if (prev.layout !== 'centered') {\n return;\n }\n const target = getNearTopSnapScrollPosition(\n prev.monthKeys,\n prev.scrollPosition,\n getHeight,\n undefined,\n lastDeltaSignRef.current\n );\n if (Math.abs(target - prev.scrollPosition) < 0.5) {\n return;\n }\n animateScrollPosition(prev.scrollPosition, target, WEEK_SNAP_DURATION_MS);\n }, WEEK_SNAP_IDLE_MS);\n };\n\n useEffect(\n () => () => {\n cancelAnimation();\n cancelSnap();\n if (rafRef.current != null) {\n cancelAnimationFrame(rafRef.current);\n }\n // Month refs call setMonthEl(null) on unmount and disconnect observers there.\n observersRef.current.clear();\n },\n []\n );\n\n useLayoutEffect(() => {\n let changed = false;\n Array.from(monthElsRef.current.entries()).forEach(([key]) => {\n if (!state.monthKeys.includes(key)) {\n monthElsRef.current.delete(key);\n if (heightsRef.current.delete(key)) {\n changed = true;\n }\n const ro = observersRef.current.get(key);\n if (ro) {\n ro.disconnect();\n observersRef.current.delete(key);\n }\n }\n });\n if (changed) {\n setMeasuredHeights(new Map(heightsRef.current));\n }\n }, [state.monthKeys]);\n\n useLayoutEffect(() => {\n const viewport = viewportRef.current;\n if (!viewport) {\n return;\n }\n\n const flushDelta = () => {\n rafRef.current = null;\n const deltaY = pendingDeltaRef.current;\n pendingDeltaRef.current = 0;\n if (deltaY === 0) {\n return;\n }\n\n lastDeltaSignRef.current = deltaY > 0 ? 1 : -1;\n\n setState(prev => {\n let { monthKeys } = prev;\n let { scrollPosition } = prev;\n\n if (prev.layout === 'linear') {\n const positions = getLinearMonthPositions(prev.monthKeys, prev.scrollPosition, getHeight);\n let bestIndex = 0;\n let bestDist = Math.abs(positions[0]);\n for (let index = 1; index < positions.length; index += 1) {\n const dist = Math.abs(positions[index]);\n if (dist < bestDist) {\n bestDist = dist;\n bestIndex = index;\n }\n }\n const nearest = parseMonthKey(prev.monthKeys[bestIndex])!;\n const reset = createScrollState(nearest, timeZone);\n monthKeys = reset.monthKeys;\n scrollPosition = reset.scrollPosition;\n }\n\n const next = applyScrollDelta(monthKeys, scrollPosition, deltaY, getHeight);\n\n return {\n centerMonth: next.centerMonth,\n monthKeys: next.monthKeys,\n scrollPosition: next.scrollPosition,\n layout: 'centered',\n };\n });\n };\n\n const queueDelta = (deltaY: number) => {\n cancelAnimation();\n cancelSnap();\n pendingDeltaRef.current += deltaY;\n if (rafRef.current == null) {\n rafRef.current = requestAnimationFrame(flushDelta);\n }\n scheduleWeekSnapRef.current();\n };\n\n const handleWheel = (event: WheelEvent) => {\n event.preventDefault();\n queueDelta(wheelDeltaToPixels(event));\n };\n\n const handleTouchStart = (event: TouchEvent) => {\n cancelAnimation();\n cancelSnap();\n touchStartYRef.current = event.targetTouches[0]?.clientY ?? null;\n };\n\n const handleTouchMove = (event: TouchEvent) => {\n const clientY = event.changedTouches[0]?.clientY;\n if (clientY == null || touchStartYRef.current == null) {\n return;\n }\n\n event.preventDefault();\n const deltaY = touchStartYRef.current - clientY;\n touchStartYRef.current = clientY;\n queueDelta(deltaY);\n };\n\n const handleTouchEnd = () => {\n touchStartYRef.current = null;\n scheduleWeekSnapRef.current();\n };\n\n viewport.addEventListener('wheel', handleWheel, { passive: false });\n viewport.addEventListener('touchstart', handleTouchStart, { passive: true });\n viewport.addEventListener('touchmove', handleTouchMove, { passive: false });\n viewport.addEventListener('touchend', handleTouchEnd);\n viewport.addEventListener('touchcancel', handleTouchEnd);\n\n return () => {\n viewport.removeEventListener('wheel', handleWheel);\n viewport.removeEventListener('touchstart', handleTouchStart);\n viewport.removeEventListener('touchmove', handleTouchMove);\n viewport.removeEventListener('touchend', handleTouchEnd);\n viewport.removeEventListener('touchcancel', handleTouchEnd);\n };\n }, [timeZone]);\n\n const months = useMemo(() => {\n const getMeasuredHeight = (monthKey: string) => measuredHeights.get(monthKey) ?? estimateMonthHeight(monthKey);\n const positions =\n state.layout === 'linear'\n ? getLinearMonthPositions(state.monthKeys, state.scrollPosition, getMeasuredHeight)\n : getMonthPositions(state.monthKeys, state.scrollPosition, getMeasuredHeight);\n\n return state.monthKeys.map((monthKey, index) => ({\n monthKey,\n index,\n top: positions[index],\n height: getMeasuredHeight(monthKey),\n }));\n }, [state.monthKeys, state.scrollPosition, state.layout, measuredHeights]);\n\n const setMonthEl = (monthKey: string, node: HTMLElement | null) => {\n if (!node) {\n monthElsRef.current.delete(monthKey);\n const ro = observersRef.current.get(monthKey);\n if (ro) {\n ro.disconnect();\n observersRef.current.delete(monthKey);\n }\n return;\n }\n\n const prev = monthElsRef.current.get(monthKey);\n monthElsRef.current.set(monthKey, node);\n commitHeight(monthKey, node.offsetHeight);\n\n if (typeof ResizeObserver === 'undefined') {\n return;\n }\n\n if (prev === node && observersRef.current.has(monthKey)) {\n return;\n }\n\n const existing = observersRef.current.get(monthKey);\n if (existing) {\n existing.disconnect();\n }\n\n const ro = new ResizeObserver(() => {\n commitHeight(monthKey, node.offsetHeight);\n });\n ro.observe(node);\n observersRef.current.set(monthKey, ro);\n };\n\n const scrollToMonth = (date: DateValue) => {\n cancelSnap();\n cancelAnimation();\n\n const target = getCenterMonth(date, timeZone);\n const prev = stateRef.current;\n if (\n toMonthKey(prev.centerMonth) === toMonthKey(target) &&\n prev.scrollPosition === 0 &&\n prev.layout === 'centered'\n ) {\n return;\n }\n\n const { keys, fromKey, toKey } = buildScrollPathKeys(prev.centerMonth, target);\n if (fromKey === toKey) {\n setState(createScrollState(target, timeZone));\n return;\n }\n\n const fromOffset = linearScrollOffsetForMonthKey(keys, fromKey, getHeight);\n const toOffset = linearScrollOffsetForMonthKey(keys, toKey, getHeight);\n\n setState({\n centerMonth: target,\n monthKeys: keys,\n scrollPosition: fromOffset,\n layout: 'linear',\n });\n\n requestAnimationFrame(() => {\n animateScrollPosition(fromOffset, toOffset, SCROLL_TO_MONTH_MS, () => {\n setState(createScrollState(target, timeZone));\n });\n });\n };\n\n const scrollToMonthRef = useRef(scrollToMonth);\n scrollToMonthRef.current = scrollToMonth;\n\n const ensureMonthVisible = (date: DateValue) => {\n const targetKey = toMonthKey(getCenterMonth(date, timeZone));\n if (stateRef.current.monthKeys.includes(targetKey)) {\n return;\n }\n scrollToMonth(date);\n };\n\n useEffect(() => {\n if (!scrollToMonthKeyDep || scrollToDate == null) {\n return;\n }\n\n // Skip partial year commits while typing (e.g. 2 / 20 / 202).\n if (toCalendarDate(scrollToDate).year < 1000) {\n return;\n }\n\n scrollToMonthRef.current(scrollToDate);\n }, [scrollToDate, scrollToMonthKeyDep]);\n\n return { months, viewportRef, setMonthEl, scrollToMonth, ensureMonthVisible };\n};\n","import { type ComponentPropsWithoutRef, type ReactNode, type RefObject } from 'react';\n\nimport cn from 'classnames';\n\nimport styles from '../../styles.module.css';\n\nexport interface IMonthListItem {\n monthKey: string;\n index: number;\n top: number;\n height: number;\n}\n\ninterface IMonthListProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {\n months: IMonthListItem[];\n viewportRef: RefObject<HTMLDivElement | null>;\n setMonthEl: (monthKey: string, node: HTMLDivElement | null) => void;\n children: (item: IMonthListItem) => ReactNode;\n}\n\n/** Absolute-positioned month stack inside the fake-scroll viewport. */\nexport const MonthList = ({ months, viewportRef, setMonthEl, className, children, ...props }: IMonthListProps) => (\n <div {...props} ref={viewportRef} className={cn(styles.viewport, className)} data-test-id=\"calendar-viewport\">\n {months.map(item => (\n <div\n key={item.monthKey}\n ref={node => setMonthEl(item.monthKey, node)}\n className={styles.month}\n data-month-key={item.monthKey}\n data-month-offset={item.index}\n style={{ top: item.top }}\n >\n {children(item)}\n </div>\n ))}\n </div>\n);\n\nMonthList.displayName = 'MonthList';\n","import { DEFAULT_MONTH_HEIGHT_METRICS } from './date';\n\n/**\n * Offset for month heading to stick to the viewport top while the month scrolls under it.\n * Kontur-style (absolute months → not CSS `position: sticky`).\n */\nexport const getStickyHeadingOffset = (\n monthTop: number,\n monthHeight: number,\n headingHeight: number = DEFAULT_MONTH_HEIGHT_METRICS.headingHeight\n): number => {\n if (monthTop >= 0 || monthHeight <= 0 || headingHeight <= 0) {\n return 0;\n }\n\n return Math.min(-monthTop, Math.max(0, monthHeight - headingHeight));\n};\n\n/** Max month `top` still treated as near the viewport top (Kontur ~52). */\nexport const HEADING_INTERACTIVE_TOP = 52;\n\n/**\n * Whether month/year selects should be interactive (Kontur sticky/active heading).\n */\nexport const isMonthHeadingInteractive = (\n monthTop: number,\n monthHeight: number,\n headingHeight: number = DEFAULT_MONTH_HEIGHT_METRICS.headingHeight\n): boolean => {\n if (monthHeight <= 0) {\n return false;\n }\n\n const headingOffset = getStickyHeadingOffset(monthTop, monthHeight, headingHeight);\n if (monthTop > HEADING_INTERACTIVE_TOP) {\n return false;\n }\n if (headingOffset >= monthHeight - headingHeight) {\n return false;\n }\n\n return true;\n};\n","import { type FocusEventHandler, type KeyboardEventHandler } from 'react';\n\nimport { type CalendarDate } from '@internationalized/date';\nimport cn from 'classnames';\n\nimport { typographyStyles } from '@ds/typography';\n\nimport styles from './styles.module.css';\n\n/** Day cell chrome props. */\nexport interface IDayCellProps {\n date: CalendarDate;\n label: string;\n isOutsideMonth?: boolean;\n isToday?: boolean;\n isSelected?: boolean;\n isDisabled?: boolean;\n isUnavailable?: boolean;\n isSelectionStart?: boolean;\n isSelectionEnd?: boolean;\n isInRange?: boolean;\n isHovered?: boolean;\n /** Keyboard-engaged focus ring + arrow keys. */\n isFocused?: boolean;\n /** Tab stop override; defaults to `0` when `isFocused`, else `-1`. */\n tabIndex?: number;\n onSelect?: (date: CalendarDate) => void;\n onHoverChange?: (date: CalendarDate | null) => void;\n onFocusDate?: (date: CalendarDate) => void;\n onBlurDate?: FocusEventHandler<HTMLButtonElement>;\n onKeyDown?: KeyboardEventHandler<HTMLButtonElement>;\n}\n\n/** Day button for custom month grid. */\nexport const DayCell = ({\n date,\n label,\n isOutsideMonth = false,\n isToday = false,\n isSelected = false,\n isDisabled = false,\n isUnavailable = false,\n isSelectionStart = false,\n isSelectionEnd = false,\n isInRange = false,\n isHovered = false,\n isFocused = false,\n tabIndex,\n onSelect,\n onHoverChange,\n onFocusDate,\n onBlurDate,\n onKeyDown,\n}: IDayCellProps) => {\n const blocked = isDisabled || isUnavailable;\n\n const handleFocus: FocusEventHandler<HTMLButtonElement> = () => {\n onFocusDate?.(date);\n };\n\n return (\n <button\n type=\"button\"\n className={cn(styles.cell, typographyStyles.bodyS)}\n aria-label={label}\n aria-pressed={isSelected || undefined}\n disabled={blocked}\n tabIndex={tabIndex ?? (isFocused ? 0 : -1)}\n data-date={date.toString()}\n data-outside-month={isOutsideMonth || undefined}\n data-today={isToday || undefined}\n data-selected={isSelected || undefined}\n data-disabled={isDisabled || undefined}\n data-unavailable={isUnavailable || undefined}\n data-selection-start={isSelectionStart || undefined}\n data-selection-end={isSelectionEnd || undefined}\n data-in-range={isInRange || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n onClick={() => onSelect?.(date)}\n onMouseEnter={() => onHoverChange?.(date)}\n onMouseLeave={() => onHoverChange?.(null)}\n onFocus={handleFocus}\n onBlur={onBlurDate}\n onKeyDown={isFocused ? onKeyDown : undefined}\n >\n {date.day}\n </button>\n );\n};\n\nDayCell.displayName = 'DayCell';\n","import { useMemo, useRef } from 'react';\n\nimport cn from 'classnames';\nimport { Button, ListBox, ListBoxItem, Popover, Select, SelectValue, useLocale } from 'react-aria-components';\n\nimport { typographyStyles } from '@ds/typography';\n\nimport { ChevronDown } from '@/icons';\n\nimport { getMonthLabels } from '../../utils/date';\n\nimport styles from './styles.module.css';\n\nexport type TMonthYearSelectType = 'month' | 'year';\n\n/** Caption select for calendar heading (Kontur-like). */\nexport interface IMonthYearSelectProps {\n type: TMonthYearSelectType;\n value: number;\n minValue: number;\n maxValue: number;\n onChange: (value: number) => void;\n /** Fires when the menu opens or closes. */\n onOpenChange?: (isOpen: boolean) => void;\n isDisabled?: boolean;\n 'aria-label'?: string;\n}\n\ninterface ISelectItem {\n id: string;\n label: string;\n}\n\n/** Build select items strictly within `minValue…maxValue` (no expand to typed value). */\nexport const buildMonthYearSelectItems = (\n type: TMonthYearSelectType,\n minValue: number,\n maxValue: number,\n monthLabels: readonly string[] = []\n): ISelectItem[] => {\n if (maxValue < minValue) {\n return [];\n }\n\n if (type === 'month') {\n return Array.from({ length: maxValue - minValue + 1 }, (_, index) => {\n const month = minValue + index;\n\n return { id: String(month), label: monthLabels[month - 1] ?? String(month) };\n });\n }\n\n return Array.from({ length: maxValue - minValue + 1 }, (_, index) => {\n const year = minValue + index;\n\n return { id: String(year), label: String(year) };\n });\n};\n\n/** Month or year caption Select for sticky calendar heading. */\nexport const MonthYearSelect = ({\n type,\n value,\n minValue,\n maxValue,\n onChange,\n onOpenChange,\n isDisabled = false,\n 'aria-label': ariaLabel,\n}: IMonthYearSelectProps) => {\n const { locale } = useLocale();\n const listRef = useRef<HTMLDivElement>(null);\n const monthLabels = useMemo(() => getMonthLabels(locale), [locale]);\n\n const items = useMemo(\n () => buildMonthYearSelectItems(type, minValue, maxValue, monthLabels),\n [type, minValue, maxValue, monthLabels]\n );\n\n const selectedKey = String(value);\n const hasSelectedItem = items.some(item => item.id === selectedKey);\n const displayLabel = type === 'month' ? (monthLabels[value - 1] ?? String(value)) : String(value);\n const testId = type === 'month' ? 'calendar-month-select' : 'calendar-year-select';\n\n const scrollSelectedIntoView = () => {\n requestAnimationFrame(() => {\n const selected = listRef.current?.querySelector('[data-selected]');\n if (selected && typeof selected.scrollIntoView === 'function') {\n selected.scrollIntoView({ block: 'nearest' });\n }\n });\n };\n\n return (\n <Select\n aria-label={ariaLabel}\n selectedKey={hasSelectedItem ? selectedKey : null}\n isDisabled={isDisabled || items.length === 0}\n onOpenChange={isOpen => {\n onOpenChange?.(isOpen);\n if (isOpen) {\n scrollSelectedIntoView();\n }\n }}\n onSelectionChange={key => {\n if (key == null) {\n return;\n }\n const next = Number(key);\n if (!Number.isNaN(next) && next !== value) {\n onChange(next);\n }\n }}\n className={styles.headingSelectRoot}\n data-test-id={testId}\n >\n <Button className={cn(styles.headingSelect, typographyStyles.bodyS)} data-test-id={`${testId}-trigger`}>\n <SelectValue>{() => displayLabel}</SelectValue>\n <ChevronDown className={styles.headingSelectIcon} aria-hidden />\n </Button>\n <Popover className={styles.headingMenu} placement=\"bottom start\">\n <ListBox ref={listRef} className={styles.headingMenuList} items={items}>\n {item => (\n <ListBoxItem id={item.id} textValue={item.label} className={styles.headingMenuItem}>\n {item.label}\n </ListBoxItem>\n )}\n </ListBox>\n </Popover>\n </Select>\n );\n};\n\nMonthYearSelect.displayName = 'MonthYearSelect';\n","import { useMemo, useState, type FocusEventHandler, type KeyboardEventHandler } from 'react';\n\nimport { CalendarDate, getLocalTimeZone, today } from '@internationalized/date';\nimport cn from 'classnames';\nimport { useLocale } from 'react-aria-components';\n\nimport { typographyStyles } from '@ds/typography';\n\nimport {\n getMonthLabels,\n getMonthRangeForYear,\n getMonthWeeks,\n getWeekdayLabels,\n getYearRange,\n isDateInRange,\n isDateOutOfBounds,\n isSameDay,\n isSameMonth,\n parseMonthKey,\n} from '../../utils/date';\nimport { getStickyHeadingOffset, isMonthHeadingInteractive } from '../../utils/sticky';\nimport { DayCell } from '../DayCell';\nimport { MonthYearSelect } from '../MonthYearSelect';\n\nimport styles from './styles.module.css';\n\nconst FIRST_DAY_OF_WEEK = 1;\n\n/** Selection / constraint slice for a month grid. */\nexport interface IMonthViewSelection {\n /** Selected single date. */\n selectedDate?: CalendarDate | null;\n /** Selected range start. */\n rangeStart?: CalendarDate | null;\n /** Selected range end. */\n rangeEnd?: CalendarDate | null;\n /** Anchor while picking the second range end. */\n rangeAnchor?: CalendarDate | null;\n /** Hovered date for range preview. */\n hoveredDate?: CalendarDate | null;\n minValue?: CalendarDate | null;\n maxValue?: CalendarDate | null;\n isDateUnavailable?: (date: CalendarDate) => boolean;\n isDisabled?: boolean;\n onSelect?: (date: CalendarDate) => void;\n onHoverChange?: (date: CalendarDate | null) => void;\n /** Jump fake-scroll window to month/year. */\n onMonthYearChange?: (date: CalendarDate) => void;\n /** Roving keyboard focus date. */\n focusedDate?: CalendarDate | null;\n /** When false, day has no focus ring / arrow keys until focused (tab stop still present). */\n isGridEngaged?: boolean;\n onFocusDate?: (date: CalendarDate) => void;\n onBlurDate?: FocusEventHandler<HTMLButtonElement>;\n onDayKeyDown?: KeyboardEventHandler<HTMLButtonElement>;\n}\n\nexport interface IMonthViewProps extends IMonthViewSelection {\n monthKey: string;\n /** Absolute `top` of the month block in the viewport. */\n monthTop?: number;\n /** Measured / estimated month block height. */\n monthHeight?: number;\n}\n\n/** One month: heading + weekday row + day grid. */\nexport const MonthView = ({\n monthKey,\n monthTop = 0,\n monthHeight = 0,\n selectedDate = null,\n rangeStart = null,\n rangeEnd = null,\n rangeAnchor = null,\n hoveredDate = null,\n minValue = null,\n maxValue = null,\n isDateUnavailable,\n isDisabled = false,\n onSelect,\n onHoverChange,\n onMonthYearChange,\n focusedDate = null,\n isGridEngaged = true,\n onFocusDate,\n onBlurDate,\n onDayKeyDown,\n}: IMonthViewProps) => {\n const { locale } = useLocale();\n const timeZone = getLocalTimeZone();\n const month = useMemo(() => parseMonthKey(monthKey), [monthKey]);\n const weeks = useMemo(() => (month ? getMonthWeeks(month, FIRST_DAY_OF_WEEK) : []), [month]);\n const weekdayLabels = useMemo(() => getWeekdayLabels(locale, FIRST_DAY_OF_WEEK), [locale]);\n const todayDate = today(timeZone);\n const headingOffset = getStickyHeadingOffset(monthTop, monthHeight);\n const headingInteractive = !isDisabled && isMonthHeadingInteractive(monthTop, monthHeight);\n const [monthSelectOpen, setMonthSelectOpen] = useState(false);\n const [yearSelectOpen, setYearSelectOpen] = useState(false);\n const showMonthYearSelect = headingInteractive || monthSelectOpen || yearSelectOpen;\n const yearRange = useMemo(() => getYearRange(minValue, maxValue), [minValue, maxValue]);\n const monthRange = useMemo(\n () => (month ? getMonthRangeForYear(month.year, minValue, maxValue) : { minMonth: 1, maxMonth: 12 }),\n [month, minValue, maxValue]\n );\n const monthLabels = useMemo(() => getMonthLabels(locale), [locale]);\n\n const dateFormatter = useMemo(\n () => new Intl.DateTimeFormat(locale, { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }),\n [locale]\n );\n\n if (!month) {\n return null;\n }\n\n const previewEnd = hoveredDate ?? rangeEnd ?? rangeAnchor;\n const hasCompleteRange = rangeStart != null && rangeEnd != null;\n const hasPreviewRange = rangeAnchor != null && previewEnd != null;\n\n const handleMonthChange = (nextMonth: number) => {\n onMonthYearChange?.(new CalendarDate(month.year, nextMonth, 1));\n };\n\n const handleYearChange = (nextYear: number) => {\n const range = getMonthRangeForYear(nextYear, minValue, maxValue);\n const nextMonth = Math.min(Math.max(month.month, range.minMonth), range.maxMonth);\n onMonthYearChange?.(new CalendarDate(nextYear, nextMonth, 1));\n };\n\n return (\n <>\n <div className={cn(styles.heading, typographyStyles.bodyS)} style={{ top: headingOffset }}>\n {showMonthYearSelect ? (\n <>\n <MonthYearSelect\n type=\"month\"\n value={month.month}\n minValue={monthRange.minMonth}\n maxValue={monthRange.maxMonth}\n isDisabled={isDisabled}\n aria-label={monthLabels[month.month - 1]}\n onChange={handleMonthChange}\n onOpenChange={setMonthSelectOpen}\n />\n <MonthYearSelect\n type=\"year\"\n value={month.year}\n minValue={yearRange.minYear}\n maxValue={yearRange.maxYear}\n isDisabled={isDisabled}\n aria-label={String(month.year)}\n onChange={handleYearChange}\n onOpenChange={setYearSelectOpen}\n />\n </>\n ) : (\n <>\n <span>{monthLabels[month.month - 1]}</span>\n <span>{month.year}</span>\n </>\n )}\n </div>\n <table className={styles.grid} role=\"grid\">\n <thead>\n <tr>\n {weekdayLabels.map(label => (\n <th key={label} scope=\"col\">\n {label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {weeks.map(week => (\n <tr key={week[0]?.toString()} role=\"row\">\n {week.map(date => {\n const outside = !isSameMonth(date, month);\n const outOfBounds = isDateOutOfBounds(date, minValue, maxValue);\n const unavailable = Boolean(isDateUnavailable?.(date));\n const disabled = isDisabled || outOfBounds;\n const isToday = isSameDay(date, todayDate);\n const isFocusDate = focusedDate != null && isSameDay(date, focusedDate) && !outside;\n const isRovingTarget = isFocusDate && isGridEngaged;\n\n let isSelected = false;\n let isSelectionStart = false;\n let isSelectionEnd = false;\n let isInRange = false;\n\n if (selectedDate != null && isSameDay(date, selectedDate)) {\n isSelected = true;\n }\n\n if (hasCompleteRange && rangeStart && rangeEnd) {\n isSelectionStart = isSameDay(date, rangeStart);\n isSelectionEnd = isSameDay(date, rangeEnd);\n isSelected = isSelectionStart || isSelectionEnd;\n isInRange = isDateInRange(date, rangeStart, rangeEnd);\n }\n\n if (!hasCompleteRange && hasPreviewRange && rangeAnchor && previewEnd) {\n isSelectionStart = isSameDay(date, rangeAnchor);\n isSelectionEnd = isSameDay(date, previewEnd);\n isSelected = isSelectionStart || isSelectionEnd;\n isInRange = isDateInRange(date, rangeAnchor, previewEnd);\n }\n\n return (\n <td key={date.toString()} role=\"gridcell\">\n <DayCell\n date={date}\n label={dateFormatter.format(date.toDate(timeZone))}\n isOutsideMonth={outside}\n isToday={isToday}\n isSelected={isSelected}\n isDisabled={disabled}\n isUnavailable={unavailable}\n isSelectionStart={isSelectionStart}\n isSelectionEnd={isSelectionEnd}\n isInRange={isInRange}\n isHovered={hoveredDate != null && isSameDay(date, hoveredDate)}\n isFocused={isRovingTarget}\n tabIndex={isFocusDate ? 0 : -1}\n onSelect={onSelect}\n onHoverChange={onHoverChange}\n onFocusDate={onFocusDate}\n onBlurDate={onBlurDate}\n onKeyDown={onDayKeyDown}\n />\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n </table>\n </>\n );\n};\n\nMonthView.displayName = 'MonthView';\n"],"names":["CALENDAR_WINDOW_MONTHS","DEFAULT_YEAR_MIN","DEFAULT_YEAR_MAX","SCROLL_TO_MONTH_MS","WEEK_SNAP_IDLE_MS","WEEK_SNAP_DURATION_MS","DEFAULT_MONTH_HEIGHT_METRICS","CALENDAR_VIEWPORT_HEIGHT","getYearRange","minValue","maxValue","minYear","toCalendarDate","maxYear","getMonthRangeForYear","year","minMonth","maxMonth","min","max","getMonthLabels","locale","formatter","_","index","toMonthKey","date","parseMonthKey","monthKey","match","month","CalendarDate","getMonthWeekCount","firstDayOfWeek","start","startOfMonth","daysInMonth","endOfMonth","offset","estimateMonthHeight","metrics","weeks","createEstimateGetHeight","getToday","timeZone","today","getCenterIndex","windowMonths","getCenterMonth","scrollToDate","isSameMonth","isSameDay","a","b","isDateInRange","end","d","lo","hi","isDateOutOfBounds","getMonthWeeks","weekCount","cursor","week","row","day","getWeekdayLabels","weekday","sunday","getWindowMonthKeys","anchor","count","getCenteredMonthKeys","center","monthIndexDelta","from","to","CALENDAR_GRID_FIRST_DAY_OF_WEEK","NAV_KEYS","isBlocked","options","getWeekdayOffset","stepFocusedDate","key","getSkipDayDelta","moveFocusedDate","next","delta","guard","candidate","clampIntoBounds","getInitialFocusedDate","preferred","getLocalTimeZone","todayDate","prev","focusedDateInMonth","focusedDate","focusDateButton","viewport","iso","button","focusDateButtonWhenReady","attempts","useCalendarGridKeyboard","viewportRef","ensureMonthVisible","preferredDate","isDateUnavailable","onSelect","autoFocusDay","moveOptions","setFocusedDate","useState","focusedDateRef","useRef","didInitialFocusRef","isGridEngaged","setGridEngaged","useEffect","frame","moveFocusTo","useCallback","onDayFocus","onDayBlur","event","setFocusedDateFromParts","onDayKeyDown","MAX_SCROLL_MONTHS","buildScrollPathKeys","maxMonths","sign","fromKey","toKey","first","keys","pad","pathFirst","pathLast","before","after","getMonthPositions","monthKeys","scrollPosition","getHeight","centerIndex","positions","getLinearMonthPositions","scrollOffset","linearScrollOffsetForMonthKey","sum","i","WEEK_SNAP_THRESHOLD","getNearTopSnapScrollPosition","threshold","scrollDirection","bestIndex","bestDist","dist","target","alt","applyScrollDelta","deltaY","nextKeys","nextPos","maxShifts","shift","prevKey","centerKey","centerMonth","wheelDeltaToPixels","deltaMode","toCal","value","createScrollState","useFakeScrollCalendar","state","setState","measuredHeights","setMeasuredHeights","monthElsRef","heightsRef","observersRef","touchStartYRef","rafRef","animRafRef","snapTimeoutRef","pendingDeltaRef","lastDeltaSignRef","stateRef","scrollToMonthKeyDep","commitHeight","height","cancelAnimation","cancelSnap","animateScrollPosition","durationMs","onEnd","tick","now","t","eased","scheduleWeekSnapRef","useLayoutEffect","changed","ro","flushDelta","nearest","reset","queueDelta","handleWheel","handleTouchStart","handleTouchMove","clientY","handleTouchEnd","months","useMemo","getMeasuredHeight","setMonthEl","node","existing","scrollToMonth","fromOffset","toOffset","scrollToMonthRef","targetKey","MonthList","className","children","props","jsx","cn","styles","item","getStickyHeadingOffset","monthTop","monthHeight","headingHeight","HEADING_INTERACTIVE_TOP","isMonthHeadingInteractive","headingOffset","DayCell","label","isOutsideMonth","isToday","isSelected","isDisabled","isUnavailable","isSelectionStart","isSelectionEnd","isInRange","isHovered","isFocused","tabIndex","onHoverChange","onFocusDate","onBlurDate","onKeyDown","blocked","handleFocus","typographyStyles","buildMonthYearSelectItems","type","monthLabels","MonthYearSelect","onChange","onOpenChange","ariaLabel","useLocale","listRef","items","selectedKey","hasSelectedItem","displayLabel","testId","scrollSelectedIntoView","selected","jsxs","Select","isOpen","Button","SelectValue","ChevronDown","Popover","ListBox","ListBoxItem","FIRST_DAY_OF_WEEK","MonthView","selectedDate","rangeStart","rangeEnd","rangeAnchor","hoveredDate","onMonthYearChange","weekdayLabels","headingInteractive","monthSelectOpen","setMonthSelectOpen","yearSelectOpen","setYearSelectOpen","showMonthYearSelect","yearRange","monthRange","dateFormatter","previewEnd","hasCompleteRange","hasPreviewRange","handleMonthChange","nextMonth","handleYearChange","nextYear","range","Fragment","outside","outOfBounds","unavailable","disabled","isFocusDate","isRovingTarget"],"mappings":";;;;;;;AACO,MAAMA,KAAyB,GAGzBC,KAAmB,MACnBC,KAAmB,MAGnBC,KAAqB,KAGrBC,KAAoB,KAGpBC,KAAwB,KCKxBC,IAAoD;AAAA,EAC7D,UAAU;AAAA,EACV,eAAe;AAAA,EACf,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,CAACe,KAAoBC,KAAmBf,KAAea,MACvDxD,KAAmBrM,EAAUzB,GAAMyQ,CAAW,GAC9C1C,KAAiBtM,EAAUzB,GAAMsR,CAAU,GAC3C3D,KAAaG,MAAoBC,IACjCC,KAAYpM,GAAc5B,GAAMyQ,GAAaa,CAAU,IAIvD,gBAAA1E,EAAC,MAAA,EAAyB,MAAK,YAC3B,UAAA,gBAAAA;AAAA,UAACW;AAAA,UAAA;AAAA,YACG,MAAAvN;AAAA,YACA,OAAOqR,EAAc,OAAOrR,EAAK,OAAOkB,CAAQ,CAAC;AAAA,YACjD,gBAAgB6Q;AAAA,YAChB,SAAArE;AAAA,YACA,YAAAC;AAAA,YACA,YAAYuE;AAAA,YACZ,eAAeD;AAAA,YACf,kBAAAnE;AAAA,YACA,gBAAAC;AAAA,YACA,WAAAC;AAAA,YACA,WAAW0C,KAAe,QAAQjP,EAAUzB,GAAM0Q,CAAW;AAAA,YAC7D,WAAW0B;AAAA,YACX,UAAUD,KAAc,IAAI;AAAA,YAC5B,UAAAhN;AAAA,YACA,eAAAiJ;AAAA,YACA,aAAAC;AAAA,YACA,YAAAC;AAAA,YACA,WAAWjI;AAAA,UAAA;AAAA,QAAA,KAnBVrG,EAAK,UAqBd;AAAA,MAER,CAAC,KAzDIqC,EAAK,CAAC,GAAG,SAAA,CA0DlB,CACH,EAAA,CACL;AAAA,IAAA,EAAA,CACJ;AAAA,EAAA,GACJ;AAER;AAEAgO,GAAU,cAAc;"}
|
package/dist/input/index.js
CHANGED
package/dist/loader/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import u from "classnames";
|
|
3
3
|
import { s as c } from "../index-h8z54aFR.js";
|
|
4
|
-
import { u as _ } from "../hooks-
|
|
4
|
+
import { u as _ } from "../hooks-BSSTu-2y.js";
|
|
5
5
|
import { cva as p } from "class-variance-authority";
|
|
6
6
|
import '../assets/index10.css';const y = "aub_styles-module_root_82fa0", f = "aub_styles-module_overlay_9529c", v = "aub_styles-module_spinner_fd62a", b = "aub_styles-module_sm_916d6", g = "aub_styles-module_md_98210", N = "aub_styles-module_lg_ce385", s = {
|
|
7
7
|
root: y,
|
package/dist/mask/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as c, jsxs as I } from "react/jsx-runtime";
|
|
|
2
2
|
import { useRef as g, useCallback as B, useEffect as O } from "react";
|
|
3
3
|
import { useIMask as j } from "react-imask";
|
|
4
4
|
import { s as M } from "../index-h8z54aFR.js";
|
|
5
|
-
import { I as z } from "../Component-
|
|
5
|
+
import { I as z } from "../Component-BJz78zCJ.js";
|
|
6
6
|
import { F as v, u as D } from "../Component-BJc8tKRD.js";
|
|
7
7
|
import { u as N, g as T } from "../useFieldHook-o47pjrRg.js";
|
|
8
8
|
const C = (r) => ({
|
package/dist/menu-list/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as o, jsxs as c } from "react/jsx-runtime";
|
|
2
|
-
import { u } from "./hooks-
|
|
2
|
+
import { u } from "./hooks-BSSTu-2y.js";
|
|
3
3
|
import { useState as d, useLayoutEffect as b } from "react";
|
|
4
4
|
import './assets/metrics.css';const g = "aub_styles-module_root_ac49d", p = "aub_styles-module_message_e24cf", _ = "aub_styles-module_skeletonList_dc5f9", x = "aub_styles-module_skeletonRow_cadb9", e = {
|
|
5
5
|
root: g,
|
|
@@ -42,4 +42,4 @@ export {
|
|
|
42
42
|
l as r,
|
|
43
43
|
A as u
|
|
44
44
|
};
|
|
45
|
-
//# sourceMappingURL=metrics-
|
|
45
|
+
//# sourceMappingURL=metrics-D4vChkd-.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics-
|
|
1
|
+
{"version":3,"file":"metrics-D4vChkd-.js","sources":["../src/combobox/components/ListStatus/index.tsx","../src/combobox/components/List/metrics.ts"],"sourcesContent":["import { useAuiLabels } from '@/provider';\n\nimport styles from './styles.module.css';\n\nexport interface IComboboxListStatusProps {\n isLoading?: boolean;\n isError?: boolean;\n isEmpty?: boolean;\n}\n\n/** Loading skeleton / empty / error chrome for combobox. */\nexport const ComboboxListStatus = ({ isLoading, isError, isEmpty }: IComboboxListStatusProps) => {\n const { loadingSuggestions, noSuggestions, suggestionsError } = useAuiLabels();\n\n if (isLoading) {\n return (\n <div className={styles.root} role=\"status\" aria-live=\"polite\" aria-label={loadingSuggestions}>\n <div className={styles.skeletonList}>\n <div className={styles.skeletonRow} />\n <div className={styles.skeletonRow} />\n <div className={styles.skeletonRow} />\n </div>\n </div>\n );\n }\n\n if (isError) {\n return (\n <div className={styles.root} role=\"status\" aria-live=\"polite\">\n <p className={styles.message}>{suggestionsError}</p>\n </div>\n );\n }\n\n if (isEmpty) {\n return (\n <div className={styles.root} role=\"status\" aria-live=\"polite\">\n <p className={styles.message}>{noSuggestions}</p>\n </div>\n );\n }\n\n return null;\n};\n\nComboboxListStatus.displayName = 'ComboboxListStatus';\n","import { useLayoutEffect, useState } from 'react';\n\nimport { type TComboboxSize } from '../../types';\n\nconst ROW_VAR: Record<TComboboxSize, string> = {\n sm: '--aui-combobox-item-h-sm',\n md: '--aui-combobox-item-h-md',\n lg: '--aui-combobox-item-h-lg',\n};\n\nconst PAD_VAR: Record<TComboboxSize, string> = {\n sm: '--aui-combobox-list-pad-sm',\n md: '--aui-combobox-list-pad-md',\n lg: '--aui-combobox-list-pad-lg',\n};\n\n/** Pixel fallbacks when tokens are not on the document yet. */\nconst FALLBACK_ROW: Record<TComboboxSize, number> = { sm: 28, md: 32, lg: 44 };\nconst FALLBACK_PAD: Record<TComboboxSize, number> = { sm: 4, md: 4, lg: 8 };\n\nexport const readCssPx = (name: string, fallback: number): number => {\n if (typeof document === 'undefined') {\n return fallback;\n }\n\n const raw = getComputedStyle(document.documentElement).getPropertyValue(name).trim();\n const value = Number.parseFloat(raw);\n\n return Number.isFinite(value) && value >= 0 ? value : fallback;\n};\n\nexport const readComboboxListMetrics = (size: TComboboxSize) => ({\n rowSize: readCssPx(ROW_VAR[size], FALLBACK_ROW[size]),\n padding: readCssPx(PAD_VAR[size], FALLBACK_PAD[size]),\n});\n\n/** Row height and list padding for `ListLayout`, read from combobox tokens. */\nexport const useComboboxListMetrics = (size: TComboboxSize) => {\n const [metrics, setMetrics] = useState(() => readComboboxListMetrics(size));\n\n useLayoutEffect(() => {\n setMetrics(readComboboxListMetrics(size));\n }, [size]);\n\n return metrics;\n};\n"],"names":["ComboboxListStatus","isLoading","isError","isEmpty","loadingSuggestions","noSuggestions","suggestionsError","useAuiLabels","jsx","styles","jsxs","ROW_VAR","PAD_VAR","FALLBACK_ROW","FALLBACK_PAD","readCssPx","name","fallback","raw","value","readComboboxListMetrics","size","useComboboxListMetrics","metrics","setMetrics","useState","useLayoutEffect"],"mappings":";;;;;;;;GAWaA,IAAqB,CAAC,EAAE,WAAAC,GAAW,SAAAC,GAAS,SAAAC,QAAwC;AAC7F,QAAM,EAAE,oBAAAC,GAAoB,eAAAC,GAAe,kBAAAC,EAAA,IAAqBC,EAAA;AAEhE,SAAIN,IAEI,gBAAAO,EAAC,OAAA,EAAI,WAAWC,EAAO,MAAM,MAAK,UAAS,aAAU,UAAS,cAAYL,GACtE,UAAA,gBAAAM,EAAC,OAAA,EAAI,WAAWD,EAAO,cACnB,UAAA;AAAA,IAAA,gBAAAD,EAAC,OAAA,EAAI,WAAWC,EAAO,YAAA,CAAa;AAAA,IACpC,gBAAAD,EAAC,OAAA,EAAI,WAAWC,EAAO,YAAA,CAAa;AAAA,IACpC,gBAAAD,EAAC,OAAA,EAAI,WAAWC,EAAO,YAAA,CAAa;AAAA,EAAA,EAAA,CACxC,EAAA,CACJ,IAIJP,IAEI,gBAAAM,EAAC,OAAA,EAAI,WAAWC,EAAO,MAAM,MAAK,UAAS,aAAU,UACjD,4BAAC,KAAA,EAAE,WAAWA,EAAO,SAAU,aAAiB,GACpD,IAIJN,IAEI,gBAAAK,EAAC,OAAA,EAAI,WAAWC,EAAO,MAAM,MAAK,UAAS,aAAU,UACjD,4BAAC,KAAA,EAAE,WAAWA,EAAO,SAAU,aAAc,GACjD,IAID;AACX;AAEAT,EAAmB,cAAc;ACzCjC,MAAMW,IAAyC;AAAA,EAC3C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACR,GAEMC,IAAyC;AAAA,EAC3C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACR,GAGMC,IAA8C,EAAE,IAAI,IAAI,IAAI,IAAI,IAAI,GAAA,GACpEC,IAA8C,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,EAAA,GAE3DC,IAAY,CAACC,GAAcC,MAA6B;AACjE,MAAI,OAAO,WAAa;AACpB,WAAOA;AAGX,QAAMC,IAAM,iBAAiB,SAAS,eAAe,EAAE,iBAAiBF,CAAI,EAAE,KAAA,GACxEG,IAAQ,OAAO,WAAWD,CAAG;AAEnC,SAAO,OAAO,SAASC,CAAK,KAAKA,KAAS,IAAIA,IAAQF;AAC1D,GAEaG,IAA0B,CAACC,OAAyB;AAAA,EAC7D,SAASN,EAAUJ,EAAQU,CAAI,GAAGR,EAAaQ,CAAI,CAAC;AAAA,EACpD,SAASN,EAAUH,EAAQS,CAAI,GAAGP,EAAaO,CAAI,CAAC;AACxD,IAGaC,IAAyB,CAACD,MAAwB;AAC3D,QAAM,CAACE,GAASC,CAAU,IAAIC,EAAS,MAAML,EAAwBC,CAAI,CAAC;AAE1E,SAAAK,EAAgB,MAAM;AAClB,IAAAF,EAAWJ,EAAwBC,CAAI,CAAC;AAAA,EAC5C,GAAG,CAACA,CAAI,CAAC,GAEFE;AACX;"}
|
package/dist/modal/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as s, jsxs as h } from "react/jsx-runtime";
|
|
2
2
|
import { s as L } from "../index-h8z54aFR.js";
|
|
3
3
|
import { u as v, a as B, i as E } from "../useAsyncSuggest-DuIolQ3l.js";
|
|
4
|
-
import { M as b } from "../Component-
|
|
4
|
+
import { M as b } from "../Component-DrdEP1wD.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import { F as c, u as x } from "../Component-BJc8tKRD.js";
|
|
7
7
|
import { u as C, g as H } from "../useFieldHook-o47pjrRg.js";
|