@klinking/colander 3.1.0-alpha.2 → 3.1.0-alpha.4

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.
Files changed (57) hide show
  1. package/dist/formats/date.cjs +1 -1
  2. package/dist/formats/date.d.cts +1 -1
  3. package/dist/formats/date.d.mts +1 -1
  4. package/dist/formats/date.mjs +1 -1
  5. package/dist/formats/object.cjs +1 -1
  6. package/dist/formats/object.d.cts +1 -1
  7. package/dist/formats/object.d.mts +1 -1
  8. package/dist/formats/object.mjs +1 -1
  9. package/dist/formats/plain-date-time.cjs +1 -1
  10. package/dist/formats/plain-date-time.d.cts +1 -1
  11. package/dist/formats/plain-date-time.d.mts +1 -1
  12. package/dist/formats/plain-date-time.mjs +1 -1
  13. package/dist/formats/plain-date.cjs +1 -1
  14. package/dist/formats/plain-date.d.cts +1 -1
  15. package/dist/formats/plain-date.d.mts +1 -1
  16. package/dist/formats/plain-date.mjs +1 -1
  17. package/dist/formats/plain-month-day.cjs +1 -1
  18. package/dist/formats/plain-month-day.d.cts +1 -1
  19. package/dist/formats/plain-month-day.d.mts +1 -1
  20. package/dist/formats/plain-month-day.mjs +1 -1
  21. package/dist/formats/plain-year-month.cjs +1 -1
  22. package/dist/formats/plain-year-month.d.cts +1 -1
  23. package/dist/formats/plain-year-month.d.mts +1 -1
  24. package/dist/formats/plain-year-month.mjs +1 -1
  25. package/dist/formats/zoned-date-time.cjs +1 -1
  26. package/dist/formats/zoned-date-time.d.cts +1 -1
  27. package/dist/formats/zoned-date-time.d.mts +1 -1
  28. package/dist/formats/zoned-date-time.mjs +1 -1
  29. package/dist/index.cjs +1 -1
  30. package/dist/index.d.cts +11 -2
  31. package/dist/index.d.mts +11 -2
  32. package/dist/index.mjs +1 -1
  33. package/dist/{weeks-navigation-BRxzsy0z.cjs → weeks-navigation-DV538__x.cjs} +115 -135
  34. package/dist/{weeks-navigation-CXRaVP02.mjs → weeks-navigation-elCpdfQ3.mjs} +115 -135
  35. package/dist/{index-CJgr0MEp.d.cts → weeks-view-context-CUCy8njs.d.cts} +3 -8
  36. package/dist/{index-DB6V_Y6x.d.mts → weeks-view-context-E1NwyNgQ.d.mts} +3 -8
  37. package/package.json +1 -1
  38. package/src/calendar-provider.tsx +6 -0
  39. package/src/calendar-types.ts +2 -0
  40. package/src/day-cell.tsx +17 -16
  41. package/src/drag-handle.tsx +2 -2
  42. package/src/grid-header.tsx +3 -3
  43. package/src/grid.tsx +20 -61
  44. package/src/month-view.tsx +32 -17
  45. package/src/navigation.tsx +3 -2
  46. package/src/range-preview.tsx +3 -5
  47. package/src/selected-range.tsx +3 -5
  48. package/src/today.test.tsx +98 -0
  49. package/src/utils.test.ts +25 -0
  50. package/src/utils.ts +17 -0
  51. package/src/view-context.test.tsx +126 -0
  52. package/src/view-context.ts +43 -0
  53. package/src/week-number.tsx +3 -3
  54. package/src/weeks-navigation.tsx +3 -3
  55. package/src/weeks-view-state.ts +31 -17
  56. package/src/weeks-view.test.tsx +115 -13
  57. package/src/weeks-view.tsx +22 -51
@@ -47,6 +47,17 @@ function getSystemTimeZone(T) {
47
47
  return T.Now.timeZoneId();
48
48
  }
49
49
  /**
50
+ * The date a view opens on: the selected date, else today in the provider's time zone.
51
+ *
52
+ * @param selected - The currently selected value, or `undefined`.
53
+ * @param today - Reads today's date in the provider's time zone.
54
+ * @param timeZone - IANA time zone.
55
+ * @param T - Temporal namespace.
56
+ */
57
+ function resolveInitialAnchor(selected, today, timeZone, T) {
58
+ return selectedToZdt(selected, timeZone, T)?.toPlainDate() ?? today();
59
+ }
60
+ /**
50
61
  * Converts any {@link DateValueObject} into a `Temporal.ZonedDateTime`.
51
62
  *
52
63
  * Handles all supported value formats (`PlainDate`, `PlainDateTime`,
@@ -803,6 +814,7 @@ function CalendarProvider(props) {
803
814
  const locale = localeProp ?? "en-US";
804
815
  const timeZone = timeZoneProp ?? getSystemTimeZone(T);
805
816
  const weekStartDay = weekStartDayProp ?? 0;
817
+ const today = useCallback(() => T.Now.zonedDateTimeISO(timeZone).toPlainDate(), [T, timeZone]);
806
818
  const resolvedFormat = formatProp ?? "PlainDate";
807
819
  const selectionMode = selectionModeProp ?? "single";
808
820
  const disabled = disabledProp ?? false;
@@ -1205,6 +1217,7 @@ function CalendarProvider(props) {
1205
1217
  ...minValue !== void 0 && { minValue },
1206
1218
  ...maxValue !== void 0 && { maxValue },
1207
1219
  timeZone,
1220
+ today,
1208
1221
  locale,
1209
1222
  temporal: T,
1210
1223
  weekStartDay,
@@ -1222,6 +1235,7 @@ function CalendarProvider(props) {
1222
1235
  minValue,
1223
1236
  maxValue,
1224
1237
  timeZone,
1238
+ today,
1225
1239
  locale,
1226
1240
  T,
1227
1241
  weekStartDay,
@@ -1302,6 +1316,22 @@ function useViewContext() {
1302
1316
  if (!ctx) throw new Error("useViewContext must be used within MonthView or WeeksView");
1303
1317
  return ctx;
1304
1318
  }
1319
+ /** @internal Context for {@link ViewStableContextValue}. */
1320
+ const ViewStableContext = createContext(null);
1321
+ /** @internal Context for {@link ViewStateContextValue}. */
1322
+ const ViewStateContext = createContext(null);
1323
+ /** Returns the nearest view's stable values. */
1324
+ function useViewStable() {
1325
+ const ctx = useContext(ViewStableContext);
1326
+ if (!ctx) throw new Error("useViewStable must be used within MonthView or WeeksView");
1327
+ return ctx;
1328
+ }
1329
+ /** Returns the nearest view's volatile state. */
1330
+ function useViewState() {
1331
+ const ctx = useContext(ViewStateContext);
1332
+ if (!ctx) throw new Error("useViewState must be used within MonthView or WeeksView");
1333
+ return ctx;
1334
+ }
1305
1335
  //#endregion
1306
1336
  //#region src/month-view.tsx
1307
1337
  function MonthViewRoot(props) {
@@ -1313,7 +1343,7 @@ function MonthViewRoot(props) {
1313
1343
  const calStable = useCalendarStable();
1314
1344
  const calState = useCalendarState();
1315
1345
  const T = calStable.temporal;
1316
- const { timeZone, weekStartDay, isDateDisabled } = calStable;
1346
+ const { timeZone, today, weekStartDay, isDateDisabled } = calStable;
1317
1347
  const isMonthControlled = monthProp !== void 0;
1318
1348
  const [internalMonth, setInternalMonth] = useState(() => {
1319
1349
  if (monthProp) return {
@@ -1324,27 +1354,17 @@ function MonthViewRoot(props) {
1324
1354
  year: defaultMonthProp.year,
1325
1355
  month: defaultMonthProp.month
1326
1356
  };
1327
- if (calState.selected) {
1328
- const zdt = toZonedDateTime(calState.selected, timeZone, T);
1329
- return {
1330
- year: zdt.year,
1331
- month: zdt.month
1332
- };
1333
- }
1334
- const now = T.Now.zonedDateTimeISO(timeZone);
1357
+ const anchor = resolveInitialAnchor(calState.selected, today, timeZone, T);
1335
1358
  return {
1336
- year: now.year,
1337
- month: now.month
1359
+ year: anchor.year,
1360
+ month: anchor.month
1338
1361
  };
1339
1362
  });
1340
1363
  const currentMonth = isMonthControlled ? {
1341
1364
  year: monthProp.year,
1342
1365
  month: monthProp.month
1343
1366
  } : internalMonth;
1344
- const [focusedDate, setFocusedDate] = useState(() => {
1345
- if (calState.selected) return toZonedDateTime(calState.selected, timeZone, T).toPlainDate();
1346
- return T.Now.plainDateISO();
1347
- });
1367
+ const [focusedDate, setFocusedDate] = useState(() => resolveInitialAnchor(calState.selected, today, timeZone, T));
1348
1368
  const [gridHasFocus, setGridHasFocus] = useState(false);
1349
1369
  const gridFocusedRef = useRef(false);
1350
1370
  const [gridLabelIds, setGridLabelIds] = useState({});
@@ -1623,13 +1643,27 @@ function MonthViewRoot(props) {
1623
1643
  tabTargetDate,
1624
1644
  gridHasFocus
1625
1645
  ]);
1646
+ const viewStableCtx = useMemo(() => ({
1647
+ gridFocusedRef,
1648
+ outsideDays
1649
+ }), [outsideDays]);
1650
+ const viewStateCtx = useMemo(() => ({
1651
+ currentDateTime,
1652
+ rootState
1653
+ }), [currentDateTime, rootState]);
1626
1654
  return /* @__PURE__ */ jsx(MonthViewStableContext.Provider, {
1627
1655
  value: stableCtx,
1628
1656
  children: /* @__PURE__ */ jsx(MonthViewStateContext.Provider, {
1629
1657
  value: stateCtx,
1630
- children: /* @__PURE__ */ jsx(ViewContext.Provider, {
1631
- value: viewCtx,
1632
- children
1658
+ children: /* @__PURE__ */ jsx(ViewStableContext.Provider, {
1659
+ value: viewStableCtx,
1660
+ children: /* @__PURE__ */ jsx(ViewStateContext.Provider, {
1661
+ value: viewStateCtx,
1662
+ children: /* @__PURE__ */ jsx(ViewContext.Provider, {
1663
+ value: viewCtx,
1664
+ children
1665
+ })
1666
+ })
1633
1667
  })
1634
1668
  })
1635
1669
  });
@@ -1665,7 +1699,7 @@ const GridMonthContext = createContext(null);
1665
1699
  //#region src/grid-header.tsx
1666
1700
  function useGridHeaderCellState(index) {
1667
1701
  const { locale, temporal: T, weekStartDay } = useCalendarStable();
1668
- const { rootState } = useMonthViewState();
1702
+ const { rootState } = useViewState();
1669
1703
  const weekdayNames = useMemo(() => getWeekdayNames(locale, T, weekStartDay), [
1670
1704
  locale,
1671
1705
  T,
@@ -1741,7 +1775,7 @@ function GridHeaderCellFn(props, ref) {
1741
1775
  const GridHeaderCell = forwardRef(GridHeaderCellFn);
1742
1776
  function GridHeaderFn(props, ref) {
1743
1777
  const { render, children, ...otherProps } = props;
1744
- const { rootState } = useMonthViewState();
1778
+ const { rootState } = useViewState();
1745
1779
  const state = useMemo(() => ({ root: rootState }), [rootState]);
1746
1780
  return useRender({
1747
1781
  defaultTagName: "thead",
@@ -2222,7 +2256,7 @@ function computeWeeksKeyNav(input) {
2222
2256
  //#endregion
2223
2257
  //#region src/day-cell.tsx
2224
2258
  /** Computes derived day cell state from context values. Pure function, no hooks. */
2225
- function computeDayCellState(date, orientation, columnIndex, rootState, selectedDates, currentDateTime, disabled, isDateDisabled, focusedDate, rangeStart, rangeEnd, tabTargetDate, T, selectionMode, outsideDays, previewStart, previewEnd) {
2259
+ function computeDayCellState(date, orientation, columnIndex, rootState, selectedDates, currentDateTime, disabled, isDateDisabled, focusedDate, rangeStart, rangeEnd, tabTargetDate, today, T, selectionMode, outsideDays, previewStart, previewEnd) {
2226
2260
  const isCurrentMonth = date.year === currentDateTime.year && date.month === currentDateTime.month;
2227
2261
  if (!isCurrentMonth && outsideDays === "hidden") return {
2228
2262
  root: rootState,
@@ -2253,7 +2287,6 @@ function computeDayCellState(date, orientation, columnIndex, rootState, selected
2253
2287
  rangePreviewHasEnd: false,
2254
2288
  isTabTarget: false
2255
2289
  };
2256
- const today = T.Now.plainDateISO();
2257
2290
  const isToday = T.PlainDate.compare(date, today) === 0;
2258
2291
  const isRange = selectionMode === "range";
2259
2292
  let isRangeStart = false;
@@ -2447,13 +2480,14 @@ const DayCellInstance = memo(DayCellInstanceFn, dayCellInstancePropsAreEqual);
2447
2480
  function DayCellTemplate(props) {
2448
2481
  const { date: dateProp, ...restProps } = props;
2449
2482
  const weekData = useContext(WeekDataContext);
2450
- const { disabled, isDateDisabled, selectionMode, temporal: T, weekStartDay } = useCalendarStable();
2483
+ const { disabled, isDateDisabled, selectionMode, temporal: T, today, weekStartDay } = useCalendarStable();
2484
+ const todayDate = today();
2451
2485
  const { selectedDates, rangeStart, rangeEnd, previewStart, previewEnd } = useCalendarState();
2452
2486
  const viewCtx = useViewContext();
2453
2487
  const { focusedDate, tabTargetDate } = viewCtx;
2454
- const monthStable = useContext(MonthViewStableContext);
2455
- const { rootState, weeks, currentMonth: currentDateTime } = useMonthViewState();
2456
- const outsideDays = monthStable?.outsideDays ?? "enabled";
2488
+ const { rootState, currentDateTime } = useViewState();
2489
+ const { outsideDays } = useViewStable();
2490
+ const monthState = useContext(MonthViewStateContext);
2457
2491
  const isWeeksView = viewCtx.viewType === "weeks";
2458
2492
  const cellMonth = isWeeksView ? null : weekData?.gridMonth ?? currentDateTime;
2459
2493
  const { orientation } = useContext(GridContext);
@@ -2462,21 +2496,21 @@ function DayCellTemplate(props) {
2462
2496
  const derived = computeDayCellState(dateProp, orientation, (dateProp.dayOfWeek % daysInWeek - weekStartDay + daysInWeek) % daysInWeek, rootState, selectedDates, isWeeksView ? {
2463
2497
  year: dateProp.year,
2464
2498
  month: dateProp.month
2465
- } : cellMonth, disabled, isDateDisabled, focusedDate, rangeStart, rangeEnd, tabTargetDate, T, selectionMode, outsideDays, previewStart, previewEnd);
2499
+ } : cellMonth, disabled, isDateDisabled, focusedDate, rangeStart, rangeEnd, tabTargetDate, todayDate, T, selectionMode, outsideDays, previewStart, previewEnd);
2466
2500
  return /* @__PURE__ */ jsx(DayCellInstance, {
2467
2501
  ...restProps,
2468
2502
  date: dateProp,
2469
2503
  _derivedState: derived
2470
2504
  });
2471
2505
  }
2472
- const days = weekData ? weekData.days : weeks.flat();
2506
+ const days = weekData ? weekData.days : monthState?.weeks.flat() ?? [];
2473
2507
  const perWeek = weekData != null;
2474
2508
  return /* @__PURE__ */ jsx(Fragment, { children: days.map((day, i) => {
2475
2509
  const daysInWeek = day.daysInWeek;
2476
2510
  const derived = computeDayCellState(day, orientation, perWeek ? i : (day.dayOfWeek % daysInWeek - weekStartDay + daysInWeek) % daysInWeek, rootState, selectedDates, isWeeksView ? {
2477
2511
  year: day.year,
2478
2512
  month: day.month
2479
- } : cellMonth, disabled, isDateDisabled, focusedDate, rangeStart, rangeEnd, tabTargetDate, T, selectionMode, outsideDays, previewStart, previewEnd);
2513
+ } : cellMonth, disabled, isDateDisabled, focusedDate, rangeStart, rangeEnd, tabTargetDate, todayDate, T, selectionMode, outsideDays, previewStart, previewEnd);
2480
2514
  return /* @__PURE__ */ jsx(DayCellInstance, {
2481
2515
  ...restProps,
2482
2516
  date: day,
@@ -2489,7 +2523,7 @@ function DayButtonInnerFn(props, ref) {
2489
2523
  const { render, date, _derivedState, ...otherProps } = props;
2490
2524
  const { onSelect, locale, readOnly, setHoveredDate } = useCalendarStable();
2491
2525
  const { setFocusedDate } = useViewContext();
2492
- const gridFocusedRef = useContext(MonthViewStableContext).gridFocusedRef;
2526
+ const { gridFocusedRef } = useViewStable();
2493
2527
  const internalRef = useRef(null);
2494
2528
  const isHidden = _derivedState?.hidden ?? false;
2495
2529
  const isFocused = _derivedState?.focused ?? false;
@@ -2569,19 +2603,19 @@ function DayButtonFallbackFn(props, ref) {
2569
2603
  const { date, ...restProps } = props;
2570
2604
  const { orientation } = useContext(GridContext);
2571
2605
  const weekData = useContext(WeekDataContext);
2572
- const { disabled, isDateDisabled, selectionMode, temporal: T, weekStartDay } = useCalendarStable();
2606
+ const { disabled, isDateDisabled, selectionMode, temporal: T, today, weekStartDay } = useCalendarStable();
2607
+ const todayDate = today();
2573
2608
  const { selectedDates, rangeStart, rangeEnd, previewStart, previewEnd } = useCalendarState();
2574
2609
  const viewCtx = useViewContext();
2575
2610
  const { focusedDate, tabTargetDate } = viewCtx;
2576
- const monthStable = useContext(MonthViewStableContext);
2577
- const { rootState, currentMonth: currentDateTime } = useMonthViewState();
2578
- const outsideDays = monthStable?.outsideDays ?? "enabled";
2611
+ const { rootState, currentDateTime } = useViewState();
2612
+ const { outsideDays } = useViewStable();
2579
2613
  const cellMonth = viewCtx.viewType === "weeks" ? {
2580
2614
  year: date.year,
2581
2615
  month: date.month
2582
2616
  } : weekData?.gridMonth ?? currentDateTime;
2583
2617
  const daysInWeek = date.daysInWeek;
2584
- const derived = computeDayCellState(date, orientation, (date.dayOfWeek % daysInWeek - weekStartDay + daysInWeek) % daysInWeek, rootState, selectedDates, cellMonth, disabled, isDateDisabled, focusedDate, rangeStart, rangeEnd, tabTargetDate, T, selectionMode, outsideDays, previewStart, previewEnd);
2618
+ const derived = computeDayCellState(date, orientation, (date.dayOfWeek % daysInWeek - weekStartDay + daysInWeek) % daysInWeek, rootState, selectedDates, cellMonth, disabled, isDateDisabled, focusedDate, rangeStart, rangeEnd, tabTargetDate, todayDate, T, selectionMode, outsideDays, previewStart, previewEnd);
2585
2619
  return /* @__PURE__ */ jsx(DayButtonInner, {
2586
2620
  ...restProps,
2587
2621
  ref,
@@ -2691,17 +2725,15 @@ const gridStateAttributesMapping = {
2691
2725
  * delegates to the appropriate internal renderer.
2692
2726
  */
2693
2727
  function GridFn(props, ref) {
2694
- const monthState = useContext(MonthViewStableContext);
2695
- const weeksState = useContext(WeeksViewStateContext);
2696
- if (monthState) return /* @__PURE__ */ jsx(MonthGrid, {
2728
+ const view = useContext(ViewContext);
2729
+ if (!view) throw new Error("Grid must be used inside MonthView.Root or WeeksView.Root.");
2730
+ return view.viewType === "weeks" ? /* @__PURE__ */ jsx(WeeksViewGrid, {
2697
2731
  ref,
2698
2732
  ...props
2699
- });
2700
- if (weeksState) return /* @__PURE__ */ jsx(WeeksViewGrid, {
2733
+ }) : /* @__PURE__ */ jsx(MonthGrid, {
2701
2734
  ref,
2702
2735
  ...props
2703
2736
  });
2704
- throw new Error("Grid must be used inside MonthView.Root or WeeksView.Root.");
2705
2737
  }
2706
2738
  const Grid = forwardRef(GridFn);
2707
2739
  function MonthGridFn(props, ref) {
@@ -2808,7 +2840,7 @@ function WeeksViewGridFn(props, ref) {
2808
2840
  const weeksStable = useWeeksViewStable();
2809
2841
  const weeksState = useWeeksViewState();
2810
2842
  const { gridFocusedRef } = weeksStable;
2811
- const { gridLabelIds, weeks, currentDateTime } = weeksState;
2843
+ const { gridLabelIds, weeks } = weeksState;
2812
2844
  const handleKeyDown = useWeeksGridKeyboard();
2813
2845
  const gridRef = useRef(null);
2814
2846
  useEffect(() => {
@@ -2879,47 +2911,16 @@ function WeeksViewGridFn(props, ref) {
2879
2911
  props: mergeProps(defaultProps, otherProps)
2880
2912
  });
2881
2913
  const orientationCtx = useMemo(() => ({ orientation: resolvedOrientation }), [resolvedOrientation]);
2882
- const monthViewStableShim = useMemo(() => ({
2883
- numberOfMonths: 1,
2884
- fixedWeeks: false,
2885
- outsideDays: "enabled",
2886
- outOfRangeBehavior: "unbounded",
2887
- goNextMonth: () => {},
2888
- goPrevMonth: () => {},
2889
- setGridLabelId: () => {},
2890
- gridFocusedRef
2891
- }), [gridFocusedRef]);
2892
- const monthViewStateShim = useMemo(() => ({
2893
- currentMonth: {
2894
- year: currentDateTime.year,
2895
- month: currentDateTime.month
2896
- },
2897
- weeks: [],
2898
- allMonths: [],
2899
- currentDateTime,
2900
- gridLabelIds,
2901
- rootState: weeksState.rootState
2902
- }), [
2903
- currentDateTime,
2904
- gridLabelIds,
2905
- weeksState.rootState
2906
- ]);
2907
- return /* @__PURE__ */ jsx(MonthViewStableContext.Provider, {
2908
- value: monthViewStableShim,
2909
- children: /* @__PURE__ */ jsx(MonthViewStateContext.Provider, {
2910
- value: monthViewStateShim,
2911
- children: /* @__PURE__ */ jsx(GridContext.Provider, {
2912
- value: orientationCtx,
2913
- children: el
2914
- })
2915
- })
2914
+ return /* @__PURE__ */ jsx(GridContext.Provider, {
2915
+ value: orientationCtx,
2916
+ children: el
2916
2917
  });
2917
2918
  }
2918
2919
  const WeeksViewGrid = forwardRef(WeeksViewGridFn);
2919
2920
  const gridBodyStateAttributesMapping = { root: () => null };
2920
2921
  /** Table body wrapping the week rows. Renders a `<tbody>` by default. */
2921
2922
  function GridBodyFn(props, ref) {
2922
- if (useContext(WeeksViewStateContext)) {
2923
+ if (useContext(ViewContext)?.viewType === "weeks") {
2923
2924
  const { children, className, style } = props;
2924
2925
  return /* @__PURE__ */ jsx(WeeksGrid, {
2925
2926
  className,
@@ -2935,7 +2936,7 @@ function GridBodyFn(props, ref) {
2935
2936
  const GridBody = forwardRef(GridBodyFn);
2936
2937
  function MonthGridBodyFn(props, ref) {
2937
2938
  const { render, ...otherProps } = props;
2938
- const { rootState } = useMonthViewState();
2939
+ const { rootState } = useViewState();
2939
2940
  const state = useMemo(() => ({ root: rootState }), [rootState]);
2940
2941
  const defaultProps = { children: props.children ?? /* @__PURE__ */ jsx(WeekTemplate, { children: /* @__PURE__ */ jsx(DayCellTemplate, { children: /* @__PURE__ */ jsx(DayButton, {}) }) }) };
2941
2942
  const { children: _children, ...restOtherProps } = otherProps;
@@ -2957,7 +2958,7 @@ const weekInstanceStateAttributesMapping = {
2957
2958
  function WeekInstance(props) {
2958
2959
  const { render, ...otherProps } = props;
2959
2960
  const weekData = useContext(WeekDataContext);
2960
- const { rootState } = useMonthViewState();
2961
+ const { rootState } = useViewState();
2961
2962
  return useRender({
2962
2963
  defaultTagName: "tr",
2963
2964
  render,
@@ -2982,8 +2983,8 @@ function WeekInstance(props) {
2982
2983
  function WeekTemplate(props) {
2983
2984
  const outerWeekData = useContext(WeekDataContext);
2984
2985
  const gridMonthCtx = useContext(GridMonthContext);
2985
- const { weeks: defaultWeeks } = useMonthViewState();
2986
- const weeks = gridMonthCtx?.weeks ?? defaultWeeks;
2986
+ const monthState = useContext(MonthViewStateContext);
2987
+ const weeks = gridMonthCtx?.weeks ?? monthState?.weeks ?? [];
2987
2988
  const gridMonth = useMemo(() => gridMonthCtx ? {
2988
2989
  year: gridMonthCtx.year,
2989
2990
  month: gridMonthCtx.month
@@ -3026,7 +3027,7 @@ function DateStringFn(props, ref) {
3026
3027
  const { render, locales, options, ...otherProps } = props;
3027
3028
  const { locale, temporal: T, timeZone } = useCalendarStable();
3028
3029
  const { selected } = useCalendarState();
3029
- const { currentDateTime, rootState } = useMonthViewState();
3030
+ const { currentDateTime, rootState } = useViewState();
3030
3031
  const selectedZdt = selectedToZdt(selected, timeZone, T);
3031
3032
  const displayDate = selectedZdt ? zdtToNativeDate(selectedZdt) : new Date(currentDateTime.year, currentDateTime.month - 1, 1);
3032
3033
  const formatted = displayDate.toLocaleDateString(locales ?? locale, options);
@@ -3065,7 +3066,7 @@ function TimeStringFn(props, ref) {
3065
3066
  const { render, locales, options, ...otherProps } = props;
3066
3067
  const { locale, temporal: T, timeZone } = useCalendarStable();
3067
3068
  const { selected } = useCalendarState();
3068
- const { rootState } = useMonthViewState();
3069
+ const { rootState } = useViewState();
3069
3070
  const selZdt = selectedToZdt(selected, timeZone, T);
3070
3071
  const displayDate = selZdt ? zdtToNativeDate(selZdt) : zdtToNativeDate(T.Now.zonedDateTimeISO(timeZone));
3071
3072
  const mergedOptions = {
@@ -3331,9 +3332,8 @@ function RangeSelectedInnerFn(props, ref) {
3331
3332
  const { orientation } = useContext(GridContext);
3332
3333
  const { temporal: T } = useCalendarStable();
3333
3334
  const { rangeStart, rangeEnd } = useCalendarState();
3334
- const monthStable = useContext(MonthViewStableContext);
3335
- const { rootState } = useMonthViewState();
3336
- const outsideDays = monthStable?.outsideDays ?? "enabled";
3335
+ const { rootState } = useViewState();
3336
+ const { outsideDays } = useViewStable();
3337
3337
  const days = weekData?.days ?? [];
3338
3338
  const gridMonth = weekData?.gridMonth;
3339
3339
  const info = useMemo(() => computeClippedRangeInfo(days, rangeStart, rangeEnd, T, outsideDays, gridMonth), [
@@ -3406,9 +3406,8 @@ function RangePreviewInnerFn(props, ref) {
3406
3406
  const { orientation } = useContext(GridContext);
3407
3407
  const { temporal: T } = useCalendarStable();
3408
3408
  const { previewStart, previewEnd } = useCalendarState();
3409
- const monthStable = useContext(MonthViewStableContext);
3410
- const { rootState } = useMonthViewState();
3411
- const outsideDays = monthStable?.outsideDays ?? "enabled";
3409
+ const { rootState } = useViewState();
3410
+ const { outsideDays } = useViewStable();
3412
3411
  const days = weekData?.days ?? [];
3413
3412
  const gridMonth = weekData?.gridMonth;
3414
3413
  const info = useMemo(() => computeClippedRangeInfo(days, previewStart, previewEnd, T, outsideDays, gridMonth), [
@@ -3470,7 +3469,7 @@ const dragHandleStateAttributesMapping = {
3470
3469
  function useDragHandle(edge, { dragging: draggingProp }) {
3471
3470
  const { temporal: T, setHoveredDate, readOnly, disabled } = useCalendarStable();
3472
3471
  const { rangeStart, rangeEnd } = useCalendarState();
3473
- const { rootState } = useMonthViewState();
3472
+ const { rootState } = useViewState();
3474
3473
  const cellData = useContext(DayCellDataContext);
3475
3474
  const { orientation } = useContext(GridContext);
3476
3475
  const date = cellData?.date;
@@ -3553,7 +3552,7 @@ const weekNumberCellStateAttributesMapping = {
3553
3552
  function WeekNumberCellFn(props, ref) {
3554
3553
  const { render, ...otherProps } = props;
3555
3554
  const weekData = useContext(WeekDataContext);
3556
- const { rootState } = useMonthViewState();
3555
+ const { rootState } = useViewState();
3557
3556
  const { temporal: T } = useCalendarStable();
3558
3557
  const days = weekData?.days ?? [];
3559
3558
  const weekNumber = useMemo(() => {
@@ -3591,7 +3590,7 @@ const WeekNumberCell = forwardRef(WeekNumberCellFn);
3591
3590
  const weekNumberHeaderStateAttributesMapping = { root: () => null };
3592
3591
  function WeekNumberHeaderFn(props, ref) {
3593
3592
  const { render, ...otherProps } = props;
3594
- const { rootState } = useMonthViewState();
3593
+ const { rootState } = useViewState();
3595
3594
  const state = useMemo(() => ({ root: rootState }), [rootState]);
3596
3595
  return useRender({
3597
3596
  defaultTagName: "th",
@@ -3845,14 +3844,13 @@ function useWeeksViewRootState(props) {
3845
3844
  const calStable = useCalendarStable();
3846
3845
  const calState = useCalendarState();
3847
3846
  const T = calStable.temporal;
3848
- const { weekStartDay, isDateDisabled, minValue, maxValue, timeZone } = calStable;
3847
+ const { weekStartDay, isDateDisabled, minValue, maxValue, timeZone, today } = calStable;
3849
3848
  const isControlled = firstWeekProp !== void 0;
3850
3849
  const resolveSpec = useCallback((spec) => resolveFirstWeekSpec(spec, weekStartDay, T), [weekStartDay, T]);
3851
3850
  const [internalFirstWeek, setInternalFirstWeek] = useState(() => {
3852
3851
  if (firstWeekProp !== void 0) return resolveSpec(firstWeekProp);
3853
3852
  if (defaultFirstWeekProp !== void 0) return resolveSpec(defaultFirstWeekProp);
3854
- if (calState.selected) return resolveSpec(toZonedDateTime(calState.selected, timeZone, T).toPlainDate());
3855
- return resolveSpec(T.Now.plainDateISO());
3853
+ return resolveSpec(resolveInitialAnchor(calState.selected, today, timeZone, T));
3856
3854
  });
3857
3855
  const resolvedFirstWeek = isControlled ? resolveSpec(firstWeekProp) : internalFirstWeek;
3858
3856
  const rawWeeks = useMemo(() => computeWeeksInWindow(resolvedFirstWeek, weekCount, weekStartDay, T), [
@@ -3907,10 +3905,10 @@ function useWeeksViewRootState(props) {
3907
3905
  const firstWeek = weeks[0];
3908
3906
  const lastWeek = weeks[weeks.length - 1];
3909
3907
  if (firstWeek === void 0 || lastWeek === void 0) {
3910
- const today = T.Now.plainDateISO();
3908
+ const now = today();
3911
3909
  return {
3912
- windowStart: today,
3913
- windowEnd: today,
3910
+ windowStart: now,
3911
+ windowEnd: now,
3914
3912
  weekCount: 0,
3915
3913
  dayCount: 0,
3916
3914
  enabledWeekCount: 0,
@@ -4188,6 +4186,14 @@ function useWeeksViewRootState(props) {
4188
4186
  tabTargetDate,
4189
4187
  gridHasFocus
4190
4188
  ]),
4189
+ viewStableCtx: useMemo(() => ({
4190
+ gridFocusedRef,
4191
+ outsideDays: "enabled"
4192
+ }), []),
4193
+ viewStateCtx: useMemo(() => ({
4194
+ currentDateTime,
4195
+ rootState
4196
+ }), [currentDateTime, rootState]),
4191
4197
  scrollToWeek
4192
4198
  };
4193
4199
  }
@@ -4195,42 +4201,16 @@ function useWeeksViewRootState(props) {
4195
4201
  //#region src/weeks-view.tsx
4196
4202
  function WeeksViewRootFn(props, ref) {
4197
4203
  const { children } = props;
4198
- const { stableCtx, stateCtx, viewCtx, scrollToWeek } = useWeeksViewRootState(props);
4204
+ const { stableCtx, stateCtx, viewCtx, viewStableCtx, viewStateCtx, scrollToWeek } = useWeeksViewRootState(props);
4199
4205
  useImperativeHandle(ref, () => ({ scrollToWeek }), [scrollToWeek]);
4200
- const gridFocusedRef = useRef(false);
4201
- const monthViewStableShim = useMemo(() => ({
4202
- numberOfMonths: 1,
4203
- fixedWeeks: false,
4204
- outsideDays: "enabled",
4205
- outOfRangeBehavior: "unbounded",
4206
- goNextMonth: () => {},
4207
- goPrevMonth: () => {},
4208
- setGridLabelId: () => {},
4209
- gridFocusedRef
4210
- }), []);
4211
- const monthViewStateShim = useMemo(() => ({
4212
- currentMonth: {
4213
- year: stateCtx.currentDateTime.year,
4214
- month: stateCtx.currentDateTime.month
4215
- },
4216
- weeks: [],
4217
- allMonths: [],
4218
- currentDateTime: stateCtx.currentDateTime,
4219
- gridLabelIds: stateCtx.gridLabelIds,
4220
- rootState: stateCtx.rootState
4221
- }), [
4222
- stateCtx.currentDateTime,
4223
- stateCtx.gridLabelIds,
4224
- stateCtx.rootState
4225
- ]);
4226
- return /* @__PURE__ */ jsx(MonthViewStableContext.Provider, {
4227
- value: monthViewStableShim,
4228
- children: /* @__PURE__ */ jsx(MonthViewStateContext.Provider, {
4229
- value: monthViewStateShim,
4230
- children: /* @__PURE__ */ jsx(WeeksViewStableContext.Provider, {
4231
- value: stableCtx,
4232
- children: /* @__PURE__ */ jsx(WeeksViewStateContext.Provider, {
4233
- value: stateCtx,
4206
+ return /* @__PURE__ */ jsx(WeeksViewStableContext.Provider, {
4207
+ value: stableCtx,
4208
+ children: /* @__PURE__ */ jsx(WeeksViewStateContext.Provider, {
4209
+ value: stateCtx,
4210
+ children: /* @__PURE__ */ jsx(ViewStableContext.Provider, {
4211
+ value: viewStableCtx,
4212
+ children: /* @__PURE__ */ jsx(ViewStateContext.Provider, {
4213
+ value: viewStateCtx,
4234
4214
  children: /* @__PURE__ */ jsx(ViewContext.Provider, {
4235
4215
  value: viewCtx,
4236
4216
  children
@@ -4275,7 +4255,7 @@ function useWeeksNavButton(direction, shiftByProp) {
4275
4255
  const { disabled: globalDisabled, minValue, maxValue, temporal: T, weekStartDay } = useCalendarStable();
4276
4256
  const { weekCount, outOfRangeBehavior, goNext, goPrev } = useWeeksViewStable();
4277
4257
  const { windowInfo } = useWeeksViewState();
4278
- const { rootState } = useMonthViewState();
4258
+ const { rootState } = useViewState();
4279
4259
  const currentFirstWeek = windowInfo.windowStart;
4280
4260
  const isDisabled = useMemo(() => {
4281
4261
  if (globalDisabled) return true;
@@ -4361,7 +4341,7 @@ const NextWeeksButton = forwardRef(NextWeeksButtonFn);
4361
4341
  function WeekCountFn(props, ref) {
4362
4342
  const { render, ...otherProps } = props;
4363
4343
  const { windowInfo } = useWeeksViewState();
4364
- const { rootState } = useMonthViewState();
4344
+ const { rootState } = useViewState();
4365
4345
  const count = windowInfo.weekCount;
4366
4346
  const state = useMemo(() => ({
4367
4347
  root: rootState,
@@ -1505,6 +1505,8 @@ interface CalendarStableContextValue {
1505
1505
  maxValue?: Temporal.PlainDate;
1506
1506
  /** Resolved IANA time zone. */
1507
1507
  timeZone: string;
1508
+ /** Today's date in the resolved {@link timeZone}. Reads the clock on every call. */
1509
+ today: () => Temporal.PlainDate;
1508
1510
  /** Resolved BCP 47 locale. */
1509
1511
  locale: string;
1510
1512
  /** Resolved Temporal namespace. */
@@ -1544,13 +1546,6 @@ interface CalendarStateContextValue {
1544
1546
  baseRootState: BaseRootState;
1545
1547
  }
1546
1548
  //#endregion
1547
- //#region src/calendar-provider.d.ts
1548
- /**
1549
- * Provides shared calendar state (selection, config, range preview) to all
1550
- * descendant view components. Does NOT manage focus, navigation, or grid data.
1551
- */
1552
- declare function CalendarProvider<F extends ValueFormat = "PlainDate">(props: CalendarProviderProps<F>): _$react_jsx_runtime0.JSX.Element;
1553
- //#endregion
1554
1549
  //#region src/out-of-range.d.ts
1555
1550
  /**
1556
1551
  * Controls how a {@link WeeksView} window behaves when navigation would move it
@@ -2105,4 +2100,4 @@ declare function useWeeksViewStable(): WeeksViewStableContextValue;
2105
2100
  /** Returns the WeeksView state context (volatile grid data). */
2106
2101
  declare function useWeeksViewState(): WeeksViewStateContextValue;
2107
2102
  //#endregion
2108
- export { GridBody as $, TimeStringProps as $t, VisibleMonth as A, GridHeaderCellState as At, resolveFirstWeekSpec as B, OutsideDays as Bt, WeekCountState as C, DayCellTemplateProps as Ct, WeeksViewProps as D, GridBodyProps as Dt, WeeksView as E, DragHandleState as Et, WeekDescriptor as F, MonthData as Ft, RangePreview as G, RangePreviewProps as Gt, WeekNumberHeader as H, PrevMonthButtonProps as Ht, computeWeeksInWindow as I, MonthYearStringProps as It, MonthYearString as J, RangeSelectedState as Jt, RangeSelected as K, RangePreviewState as Kt, FirstWeekSpec as L, MonthYearStringState as Lt, WeeksViewStableContextValue as M, GridHeaderState as Mt, WeeksViewStateContextValue as N, GridProps as Nt, WeeksViewRoot as O, GridBodyState as Ot, WindowInfo as P, GridState as Pt, Grid as Q, TemporalNamespace as Qt, ScrollToWeekSnap as R, NavButtonState as Rt, WeekCountProps as S, DayButtonState as St, WeeksNavButtonState as T, DragHandleOwnProps as Tt, RangeEndDragHandle as U, RangeEndDragHandleProps as Ut, WeekNumberCell as V, PlainDateObject as Vt, RangeStartDragHandle as W, RangeMode as Wt, PrevMonthButton as X, RawValueForFormat as Xt, NextMonthButton as Y, RangeStartDragHandleProps as Yt, TimeString as Z, RootState as Zt, NextWeeksButton as _, DateRange as _t, useMonthViewStable as a, WeekNumberCellState as an, MonthView as at, PrevWeeksButtonProps as b, DateValueObject as bt, useCalendarState as c, WeekStartDay as cn, MonthViewRootProps as ct, MonthSeparatorCell as d, DayCellDataContext as dn, MonthOutOfRangeBehavior as dt, TimeStringState as en, WeekTemplate as et, MonthSeparatorMonth as f, GridContext as fn, OutOfRangeBehavior as ft, MonthSeparatorYear as g, CalendarStateContextValue as gt, MonthSeparatorWeekCount as h, CalendarStableContextValue as ht, useViewContext as i, WeekNumberCellProps as in, GridHeaderCell as it, WeeksViewRootProps as j, GridHeaderProps as jt, WeeksViewRootHandle as k, GridHeaderCellProps as kt, computePreviewRange as l, WeekTemplateProps as ln, MonthViewStableContextValue as lt, MonthSeparatorState as m, CalendarProviderProps as mt, useWeeksViewState as n, ValueForFormat as nn, DayCellTemplate as nt, useMonthViewState as o, WeekNumberHeaderProps as on, MonthViewProps as ot, MonthSeparatorRow as p, WeekDataContext as pn, CalendarProvider as pt, DateString as q, RangeSelectedProps as qt, ViewContextValue as r, ValueFormat as rn, GridHeader as rt, useCalendarStable as s, WeekNumberHeaderState as sn, MonthViewRoot as st, useWeeksViewStable as t, ValueChangeMeta as tn, DayButton as tt, MonthSeparator as u, WeekTemplateState as un, MonthViewStateContextValue as ut, NextWeeksButtonProps as v, DateStringProps as vt, WeeksNavButtonOwnProps as w, DayCellTemplateState as wt, WeekCount as x, DayButtonProps as xt, PrevWeeksButton as y, DateStringState as yt, resolveFirstWeek as z, NextMonthButtonProps as zt };
2103
+ export { GridBody as $, TimeStringState as $t, VisibleMonth as A, GridHeaderProps as At, resolveFirstWeekSpec as B, PlainDateObject as Bt, WeekCountState as C, DayCellTemplateState as Ct, WeeksViewProps as D, GridBodyState as Dt, WeeksView as E, GridBodyProps as Et, WeekDescriptor as F, MonthYearStringProps as Ft, RangePreview as G, RangePreviewState as Gt, WeekNumberHeader as H, RangeEndDragHandleProps as Ht, computeWeeksInWindow as I, MonthYearStringState as It, MonthYearString as J, RangeStartDragHandleProps as Jt, RangeSelected as K, RangeSelectedProps as Kt, FirstWeekSpec as L, NavButtonState as Lt, WeeksViewStableContextValue as M, GridProps as Mt, WeeksViewStateContextValue as N, GridState as Nt, WeeksViewRoot as O, GridHeaderCellProps as Ot, WindowInfo as P, MonthData as Pt, Grid as Q, TimeStringProps as Qt, ScrollToWeekSnap as R, NextMonthButtonProps as Rt, WeekCountProps as S, DayCellTemplateProps as St, WeeksNavButtonState as T, DragHandleState as Tt, RangeEndDragHandle as U, RangeMode as Ut, WeekNumberCell as V, PrevMonthButtonProps as Vt, RangeStartDragHandle as W, RangePreviewProps as Wt, PrevMonthButton as X, RootState as Xt, NextMonthButton as Y, RawValueForFormat as Yt, TimeString as Z, TemporalNamespace as Zt, NextWeeksButton as _, DateStringProps as _t, useMonthViewStable as a, WeekNumberHeaderProps as an, MonthView as at, PrevWeeksButtonProps as b, DayButtonProps as bt, useCalendarState as c, WeekTemplateProps as cn, MonthViewRootProps as ct, MonthSeparatorCell as d, GridContext as dn, MonthOutOfRangeBehavior as dt, ValueChangeMeta as en, WeekTemplate as et, MonthSeparatorMonth as f, WeekDataContext as fn, OutOfRangeBehavior as ft, MonthSeparatorYear as g, DateRange as gt, MonthSeparatorWeekCount as h, CalendarStateContextValue as ht, useViewContext as i, WeekNumberCellState as in, GridHeaderCell as it, WeeksViewRootProps as j, GridHeaderState as jt, WeeksViewRootHandle as k, GridHeaderCellState as kt, computePreviewRange as l, WeekTemplateState as ln, MonthViewStableContextValue as lt, MonthSeparatorState as m, CalendarStableContextValue as mt, useWeeksViewState as n, ValueFormat as nn, DayCellTemplate as nt, useMonthViewState as o, WeekNumberHeaderState as on, MonthViewProps as ot, MonthSeparatorRow as p, CalendarProviderProps as pt, DateString as q, RangeSelectedState as qt, ViewContextValue as r, WeekNumberCellProps as rn, GridHeader as rt, useCalendarStable as s, WeekStartDay as sn, MonthViewRoot as st, useWeeksViewStable as t, ValueForFormat as tn, DayButton as tt, MonthSeparator as u, DayCellDataContext as un, MonthViewStateContextValue as ut, NextWeeksButtonProps as v, DateStringState as vt, WeeksNavButtonOwnProps as w, DragHandleOwnProps as wt, WeekCount as x, DayButtonState as xt, PrevWeeksButton as y, DateValueObject as yt, resolveFirstWeek as z, OutsideDays as zt };
@@ -1505,6 +1505,8 @@ interface CalendarStableContextValue {
1505
1505
  maxValue?: Temporal.PlainDate;
1506
1506
  /** Resolved IANA time zone. */
1507
1507
  timeZone: string;
1508
+ /** Today's date in the resolved {@link timeZone}. Reads the clock on every call. */
1509
+ today: () => Temporal.PlainDate;
1508
1510
  /** Resolved BCP 47 locale. */
1509
1511
  locale: string;
1510
1512
  /** Resolved Temporal namespace. */
@@ -1544,13 +1546,6 @@ interface CalendarStateContextValue {
1544
1546
  baseRootState: BaseRootState;
1545
1547
  }
1546
1548
  //#endregion
1547
- //#region src/calendar-provider.d.ts
1548
- /**
1549
- * Provides shared calendar state (selection, config, range preview) to all
1550
- * descendant view components. Does NOT manage focus, navigation, or grid data.
1551
- */
1552
- declare function CalendarProvider<F extends ValueFormat = "PlainDate">(props: CalendarProviderProps<F>): _$react_jsx_runtime0.JSX.Element;
1553
- //#endregion
1554
1549
  //#region src/out-of-range.d.ts
1555
1550
  /**
1556
1551
  * Controls how a {@link WeeksView} window behaves when navigation would move it
@@ -2105,4 +2100,4 @@ declare function useWeeksViewStable(): WeeksViewStableContextValue;
2105
2100
  /** Returns the WeeksView state context (volatile grid data). */
2106
2101
  declare function useWeeksViewState(): WeeksViewStateContextValue;
2107
2102
  //#endregion
2108
- export { GridBody as $, TimeStringProps as $t, VisibleMonth as A, GridHeaderCellState as At, resolveFirstWeekSpec as B, OutsideDays as Bt, WeekCountState as C, DayCellTemplateProps as Ct, WeeksViewProps as D, GridBodyProps as Dt, WeeksView as E, DragHandleState as Et, WeekDescriptor as F, MonthData as Ft, RangePreview as G, RangePreviewProps as Gt, WeekNumberHeader as H, PrevMonthButtonProps as Ht, computeWeeksInWindow as I, MonthYearStringProps as It, MonthYearString as J, RangeSelectedState as Jt, RangeSelected as K, RangePreviewState as Kt, FirstWeekSpec as L, MonthYearStringState as Lt, WeeksViewStableContextValue as M, GridHeaderState as Mt, WeeksViewStateContextValue as N, GridProps as Nt, WeeksViewRoot as O, GridBodyState as Ot, WindowInfo as P, GridState as Pt, Grid as Q, TemporalNamespace as Qt, ScrollToWeekSnap as R, NavButtonState as Rt, WeekCountProps as S, DayButtonState as St, WeeksNavButtonState as T, DragHandleOwnProps as Tt, RangeEndDragHandle as U, RangeEndDragHandleProps as Ut, WeekNumberCell as V, PlainDateObject as Vt, RangeStartDragHandle as W, RangeMode as Wt, PrevMonthButton as X, RawValueForFormat as Xt, NextMonthButton as Y, RangeStartDragHandleProps as Yt, TimeString as Z, RootState as Zt, NextWeeksButton as _, DateRange as _t, useMonthViewStable as a, WeekNumberCellState as an, MonthView as at, PrevWeeksButtonProps as b, DateValueObject as bt, useCalendarState as c, WeekStartDay as cn, MonthViewRootProps as ct, MonthSeparatorCell as d, DayCellDataContext as dn, MonthOutOfRangeBehavior as dt, TimeStringState as en, WeekTemplate as et, MonthSeparatorMonth as f, GridContext as fn, OutOfRangeBehavior as ft, MonthSeparatorYear as g, CalendarStateContextValue as gt, MonthSeparatorWeekCount as h, CalendarStableContextValue as ht, useViewContext as i, WeekNumberCellProps as in, GridHeaderCell as it, WeeksViewRootProps as j, GridHeaderProps as jt, WeeksViewRootHandle as k, GridHeaderCellProps as kt, computePreviewRange as l, WeekTemplateProps as ln, MonthViewStableContextValue as lt, MonthSeparatorState as m, CalendarProviderProps as mt, useWeeksViewState as n, ValueForFormat as nn, DayCellTemplate as nt, useMonthViewState as o, WeekNumberHeaderProps as on, MonthViewProps as ot, MonthSeparatorRow as p, WeekDataContext as pn, CalendarProvider as pt, DateString as q, RangeSelectedProps as qt, ViewContextValue as r, ValueFormat as rn, GridHeader as rt, useCalendarStable as s, WeekNumberHeaderState as sn, MonthViewRoot as st, useWeeksViewStable as t, ValueChangeMeta as tn, DayButton as tt, MonthSeparator as u, WeekTemplateState as un, MonthViewStateContextValue as ut, NextWeeksButtonProps as v, DateStringProps as vt, WeeksNavButtonOwnProps as w, DayCellTemplateState as wt, WeekCount as x, DayButtonProps as xt, PrevWeeksButton as y, DateStringState as yt, resolveFirstWeek as z, NextMonthButtonProps as zt };
2103
+ export { GridBody as $, TimeStringState as $t, VisibleMonth as A, GridHeaderProps as At, resolveFirstWeekSpec as B, PlainDateObject as Bt, WeekCountState as C, DayCellTemplateState as Ct, WeeksViewProps as D, GridBodyState as Dt, WeeksView as E, GridBodyProps as Et, WeekDescriptor as F, MonthYearStringProps as Ft, RangePreview as G, RangePreviewState as Gt, WeekNumberHeader as H, RangeEndDragHandleProps as Ht, computeWeeksInWindow as I, MonthYearStringState as It, MonthYearString as J, RangeStartDragHandleProps as Jt, RangeSelected as K, RangeSelectedProps as Kt, FirstWeekSpec as L, NavButtonState as Lt, WeeksViewStableContextValue as M, GridProps as Mt, WeeksViewStateContextValue as N, GridState as Nt, WeeksViewRoot as O, GridHeaderCellProps as Ot, WindowInfo as P, MonthData as Pt, Grid as Q, TimeStringProps as Qt, ScrollToWeekSnap as R, NextMonthButtonProps as Rt, WeekCountProps as S, DayCellTemplateProps as St, WeeksNavButtonState as T, DragHandleState as Tt, RangeEndDragHandle as U, RangeMode as Ut, WeekNumberCell as V, PrevMonthButtonProps as Vt, RangeStartDragHandle as W, RangePreviewProps as Wt, PrevMonthButton as X, RootState as Xt, NextMonthButton as Y, RawValueForFormat as Yt, TimeString as Z, TemporalNamespace as Zt, NextWeeksButton as _, DateStringProps as _t, useMonthViewStable as a, WeekNumberHeaderProps as an, MonthView as at, PrevWeeksButtonProps as b, DayButtonProps as bt, useCalendarState as c, WeekTemplateProps as cn, MonthViewRootProps as ct, MonthSeparatorCell as d, GridContext as dn, MonthOutOfRangeBehavior as dt, ValueChangeMeta as en, WeekTemplate as et, MonthSeparatorMonth as f, WeekDataContext as fn, OutOfRangeBehavior as ft, MonthSeparatorYear as g, DateRange as gt, MonthSeparatorWeekCount as h, CalendarStateContextValue as ht, useViewContext as i, WeekNumberCellState as in, GridHeaderCell as it, WeeksViewRootProps as j, GridHeaderState as jt, WeeksViewRootHandle as k, GridHeaderCellState as kt, computePreviewRange as l, WeekTemplateState as ln, MonthViewStableContextValue as lt, MonthSeparatorState as m, CalendarStableContextValue as mt, useWeeksViewState as n, ValueFormat as nn, DayCellTemplate as nt, useMonthViewState as o, WeekNumberHeaderState as on, MonthViewProps as ot, MonthSeparatorRow as p, CalendarProviderProps as pt, DateString as q, RangeSelectedState as qt, ViewContextValue as r, WeekNumberCellProps as rn, GridHeader as rt, useCalendarStable as s, WeekStartDay as sn, MonthViewRoot as st, useWeeksViewStable as t, ValueForFormat as tn, DayButton as tt, MonthSeparator as u, DayCellDataContext as un, MonthViewStateContextValue as ut, NextWeeksButtonProps as v, DateStringState as vt, WeeksNavButtonOwnProps as w, DragHandleOwnProps as wt, WeekCount as x, DayButtonState as xt, PrevWeeksButton as y, DateValueObject as yt, resolveFirstWeek as z, OutsideDays as zt };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klinking/colander",
3
- "version": "3.1.0-alpha.2",
3
+ "version": "3.1.0-alpha.4",
4
4
  "homepage": "https://github.com/klink-ing/colander#readme",
5
5
  "bugs": "https://github.com/klink-ing/colander/issues",
6
6
  "license": "MIT",
@@ -55,6 +55,10 @@ function CalendarProvider<F extends ValueFormat = "PlainDate">(
55
55
  const locale = localeProp ?? "en-US";
56
56
  const timeZone = timeZoneProp ?? getSystemTimeZone(T);
57
57
  const weekStartDay = weekStartDayProp ?? 0;
58
+ const today = useCallback(
59
+ () => T.Now.zonedDateTimeISO(timeZone).toPlainDate(),
60
+ [T, timeZone],
61
+ );
58
62
  const resolvedFormat = (formatProp ?? "PlainDate") as F;
59
63
  const selectionMode = selectionModeProp ?? "single";
60
64
  const disabled = disabledProp ?? false;
@@ -604,6 +608,7 @@ function CalendarProvider<F extends ValueFormat = "PlainDate">(
604
608
  ...(minValue !== undefined && { minValue }),
605
609
  ...(maxValue !== undefined && { maxValue }),
606
610
  timeZone,
611
+ today,
607
612
  locale,
608
613
  temporal: T,
609
614
  weekStartDay,
@@ -622,6 +627,7 @@ function CalendarProvider<F extends ValueFormat = "PlainDate">(
622
627
  minValue,
623
628
  maxValue,
624
629
  timeZone,
630
+ today,
625
631
  locale,
626
632
  T,
627
633
  weekStartDay,