@klinking/colander 3.1.0-alpha.2 → 3.1.0-alpha.3
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/formats/date.cjs +1 -1
- package/dist/formats/date.d.cts +1 -1
- package/dist/formats/date.d.mts +1 -1
- package/dist/formats/date.mjs +1 -1
- package/dist/formats/object.cjs +1 -1
- package/dist/formats/object.d.cts +1 -1
- package/dist/formats/object.d.mts +1 -1
- package/dist/formats/object.mjs +1 -1
- package/dist/formats/plain-date-time.cjs +1 -1
- package/dist/formats/plain-date-time.d.cts +1 -1
- package/dist/formats/plain-date-time.d.mts +1 -1
- package/dist/formats/plain-date-time.mjs +1 -1
- package/dist/formats/plain-date.cjs +1 -1
- package/dist/formats/plain-date.d.cts +1 -1
- package/dist/formats/plain-date.d.mts +1 -1
- package/dist/formats/plain-date.mjs +1 -1
- package/dist/formats/plain-month-day.cjs +1 -1
- package/dist/formats/plain-month-day.d.cts +1 -1
- package/dist/formats/plain-month-day.d.mts +1 -1
- package/dist/formats/plain-month-day.mjs +1 -1
- package/dist/formats/plain-year-month.cjs +1 -1
- package/dist/formats/plain-year-month.d.cts +1 -1
- package/dist/formats/plain-year-month.d.mts +1 -1
- package/dist/formats/plain-year-month.mjs +1 -1
- package/dist/formats/zoned-date-time.cjs +1 -1
- package/dist/formats/zoned-date-time.d.cts +1 -1
- package/dist/formats/zoned-date-time.d.mts +1 -1
- package/dist/formats/zoned-date-time.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +11 -2
- package/dist/index.d.mts +11 -2
- package/dist/index.mjs +1 -1
- package/dist/{weeks-navigation-CXRaVP02.mjs → weeks-navigation-DEaASUAh.mjs} +83 -107
- package/dist/{weeks-navigation-BRxzsy0z.cjs → weeks-navigation-DvryOSWF.cjs} +83 -107
- package/dist/{index-CJgr0MEp.d.cts → weeks-view-context-CNAq2Hiu.d.cts} +1 -8
- package/dist/{index-DB6V_Y6x.d.mts → weeks-view-context-CsP3PBiu.d.mts} +1 -8
- package/package.json +1 -1
- package/src/day-cell.tsx +9 -15
- package/src/drag-handle.tsx +2 -2
- package/src/grid-header.tsx +3 -3
- package/src/grid.tsx +20 -61
- package/src/month-view.tsx +25 -2
- package/src/navigation.tsx +3 -2
- package/src/range-preview.tsx +3 -5
- package/src/selected-range.tsx +3 -5
- package/src/view-context.test.tsx +126 -0
- package/src/view-context.ts +43 -0
- package/src/week-number.tsx +3 -3
- package/src/weeks-navigation.tsx +3 -3
- package/src/weeks-view-state.ts +23 -2
- package/src/weeks-view.test.tsx +115 -13
- package/src/weeks-view.tsx +22 -51
|
@@ -1302,6 +1302,22 @@ function useViewContext() {
|
|
|
1302
1302
|
if (!ctx) throw new Error("useViewContext must be used within MonthView or WeeksView");
|
|
1303
1303
|
return ctx;
|
|
1304
1304
|
}
|
|
1305
|
+
/** @internal Context for {@link ViewStableContextValue}. */
|
|
1306
|
+
const ViewStableContext = createContext(null);
|
|
1307
|
+
/** @internal Context for {@link ViewStateContextValue}. */
|
|
1308
|
+
const ViewStateContext = createContext(null);
|
|
1309
|
+
/** Returns the nearest view's stable values. */
|
|
1310
|
+
function useViewStable() {
|
|
1311
|
+
const ctx = useContext(ViewStableContext);
|
|
1312
|
+
if (!ctx) throw new Error("useViewStable must be used within MonthView or WeeksView");
|
|
1313
|
+
return ctx;
|
|
1314
|
+
}
|
|
1315
|
+
/** Returns the nearest view's volatile state. */
|
|
1316
|
+
function useViewState() {
|
|
1317
|
+
const ctx = useContext(ViewStateContext);
|
|
1318
|
+
if (!ctx) throw new Error("useViewState must be used within MonthView or WeeksView");
|
|
1319
|
+
return ctx;
|
|
1320
|
+
}
|
|
1305
1321
|
//#endregion
|
|
1306
1322
|
//#region src/month-view.tsx
|
|
1307
1323
|
function MonthViewRoot(props) {
|
|
@@ -1623,13 +1639,27 @@ function MonthViewRoot(props) {
|
|
|
1623
1639
|
tabTargetDate,
|
|
1624
1640
|
gridHasFocus
|
|
1625
1641
|
]);
|
|
1642
|
+
const viewStableCtx = useMemo(() => ({
|
|
1643
|
+
gridFocusedRef,
|
|
1644
|
+
outsideDays
|
|
1645
|
+
}), [outsideDays]);
|
|
1646
|
+
const viewStateCtx = useMemo(() => ({
|
|
1647
|
+
currentDateTime,
|
|
1648
|
+
rootState
|
|
1649
|
+
}), [currentDateTime, rootState]);
|
|
1626
1650
|
return /* @__PURE__ */ jsx(MonthViewStableContext.Provider, {
|
|
1627
1651
|
value: stableCtx,
|
|
1628
1652
|
children: /* @__PURE__ */ jsx(MonthViewStateContext.Provider, {
|
|
1629
1653
|
value: stateCtx,
|
|
1630
|
-
children: /* @__PURE__ */ jsx(
|
|
1631
|
-
value:
|
|
1632
|
-
children
|
|
1654
|
+
children: /* @__PURE__ */ jsx(ViewStableContext.Provider, {
|
|
1655
|
+
value: viewStableCtx,
|
|
1656
|
+
children: /* @__PURE__ */ jsx(ViewStateContext.Provider, {
|
|
1657
|
+
value: viewStateCtx,
|
|
1658
|
+
children: /* @__PURE__ */ jsx(ViewContext.Provider, {
|
|
1659
|
+
value: viewCtx,
|
|
1660
|
+
children
|
|
1661
|
+
})
|
|
1662
|
+
})
|
|
1633
1663
|
})
|
|
1634
1664
|
})
|
|
1635
1665
|
});
|
|
@@ -1665,7 +1695,7 @@ const GridMonthContext = createContext(null);
|
|
|
1665
1695
|
//#region src/grid-header.tsx
|
|
1666
1696
|
function useGridHeaderCellState(index) {
|
|
1667
1697
|
const { locale, temporal: T, weekStartDay } = useCalendarStable();
|
|
1668
|
-
const { rootState } =
|
|
1698
|
+
const { rootState } = useViewState();
|
|
1669
1699
|
const weekdayNames = useMemo(() => getWeekdayNames(locale, T, weekStartDay), [
|
|
1670
1700
|
locale,
|
|
1671
1701
|
T,
|
|
@@ -1741,7 +1771,7 @@ function GridHeaderCellFn(props, ref) {
|
|
|
1741
1771
|
const GridHeaderCell = forwardRef(GridHeaderCellFn);
|
|
1742
1772
|
function GridHeaderFn(props, ref) {
|
|
1743
1773
|
const { render, children, ...otherProps } = props;
|
|
1744
|
-
const { rootState } =
|
|
1774
|
+
const { rootState } = useViewState();
|
|
1745
1775
|
const state = useMemo(() => ({ root: rootState }), [rootState]);
|
|
1746
1776
|
return useRender({
|
|
1747
1777
|
defaultTagName: "thead",
|
|
@@ -2451,9 +2481,9 @@ function DayCellTemplate(props) {
|
|
|
2451
2481
|
const { selectedDates, rangeStart, rangeEnd, previewStart, previewEnd } = useCalendarState();
|
|
2452
2482
|
const viewCtx = useViewContext();
|
|
2453
2483
|
const { focusedDate, tabTargetDate } = viewCtx;
|
|
2454
|
-
const
|
|
2455
|
-
const {
|
|
2456
|
-
const
|
|
2484
|
+
const { rootState, currentDateTime } = useViewState();
|
|
2485
|
+
const { outsideDays } = useViewStable();
|
|
2486
|
+
const monthState = useContext(MonthViewStateContext);
|
|
2457
2487
|
const isWeeksView = viewCtx.viewType === "weeks";
|
|
2458
2488
|
const cellMonth = isWeeksView ? null : weekData?.gridMonth ?? currentDateTime;
|
|
2459
2489
|
const { orientation } = useContext(GridContext);
|
|
@@ -2469,7 +2499,7 @@ function DayCellTemplate(props) {
|
|
|
2469
2499
|
_derivedState: derived
|
|
2470
2500
|
});
|
|
2471
2501
|
}
|
|
2472
|
-
const days = weekData ? weekData.days : weeks.flat();
|
|
2502
|
+
const days = weekData ? weekData.days : monthState?.weeks.flat() ?? [];
|
|
2473
2503
|
const perWeek = weekData != null;
|
|
2474
2504
|
return /* @__PURE__ */ jsx(Fragment, { children: days.map((day, i) => {
|
|
2475
2505
|
const daysInWeek = day.daysInWeek;
|
|
@@ -2489,7 +2519,7 @@ function DayButtonInnerFn(props, ref) {
|
|
|
2489
2519
|
const { render, date, _derivedState, ...otherProps } = props;
|
|
2490
2520
|
const { onSelect, locale, readOnly, setHoveredDate } = useCalendarStable();
|
|
2491
2521
|
const { setFocusedDate } = useViewContext();
|
|
2492
|
-
const gridFocusedRef =
|
|
2522
|
+
const { gridFocusedRef } = useViewStable();
|
|
2493
2523
|
const internalRef = useRef(null);
|
|
2494
2524
|
const isHidden = _derivedState?.hidden ?? false;
|
|
2495
2525
|
const isFocused = _derivedState?.focused ?? false;
|
|
@@ -2573,9 +2603,8 @@ function DayButtonFallbackFn(props, ref) {
|
|
|
2573
2603
|
const { selectedDates, rangeStart, rangeEnd, previewStart, previewEnd } = useCalendarState();
|
|
2574
2604
|
const viewCtx = useViewContext();
|
|
2575
2605
|
const { focusedDate, tabTargetDate } = viewCtx;
|
|
2576
|
-
const
|
|
2577
|
-
const {
|
|
2578
|
-
const outsideDays = monthStable?.outsideDays ?? "enabled";
|
|
2606
|
+
const { rootState, currentDateTime } = useViewState();
|
|
2607
|
+
const { outsideDays } = useViewStable();
|
|
2579
2608
|
const cellMonth = viewCtx.viewType === "weeks" ? {
|
|
2580
2609
|
year: date.year,
|
|
2581
2610
|
month: date.month
|
|
@@ -2691,17 +2720,15 @@ const gridStateAttributesMapping = {
|
|
|
2691
2720
|
* delegates to the appropriate internal renderer.
|
|
2692
2721
|
*/
|
|
2693
2722
|
function GridFn(props, ref) {
|
|
2694
|
-
const
|
|
2695
|
-
|
|
2696
|
-
|
|
2723
|
+
const view = useContext(ViewContext);
|
|
2724
|
+
if (!view) throw new Error("Grid must be used inside MonthView.Root or WeeksView.Root.");
|
|
2725
|
+
return view.viewType === "weeks" ? /* @__PURE__ */ jsx(WeeksViewGrid, {
|
|
2697
2726
|
ref,
|
|
2698
2727
|
...props
|
|
2699
|
-
})
|
|
2700
|
-
if (weeksState) return /* @__PURE__ */ jsx(WeeksViewGrid, {
|
|
2728
|
+
}) : /* @__PURE__ */ jsx(MonthGrid, {
|
|
2701
2729
|
ref,
|
|
2702
2730
|
...props
|
|
2703
2731
|
});
|
|
2704
|
-
throw new Error("Grid must be used inside MonthView.Root or WeeksView.Root.");
|
|
2705
2732
|
}
|
|
2706
2733
|
const Grid = forwardRef(GridFn);
|
|
2707
2734
|
function MonthGridFn(props, ref) {
|
|
@@ -2808,7 +2835,7 @@ function WeeksViewGridFn(props, ref) {
|
|
|
2808
2835
|
const weeksStable = useWeeksViewStable();
|
|
2809
2836
|
const weeksState = useWeeksViewState();
|
|
2810
2837
|
const { gridFocusedRef } = weeksStable;
|
|
2811
|
-
const { gridLabelIds, weeks
|
|
2838
|
+
const { gridLabelIds, weeks } = weeksState;
|
|
2812
2839
|
const handleKeyDown = useWeeksGridKeyboard();
|
|
2813
2840
|
const gridRef = useRef(null);
|
|
2814
2841
|
useEffect(() => {
|
|
@@ -2879,47 +2906,16 @@ function WeeksViewGridFn(props, ref) {
|
|
|
2879
2906
|
props: mergeProps(defaultProps, otherProps)
|
|
2880
2907
|
});
|
|
2881
2908
|
const orientationCtx = useMemo(() => ({ orientation: resolvedOrientation }), [resolvedOrientation]);
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
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
|
-
})
|
|
2909
|
+
return /* @__PURE__ */ jsx(GridContext.Provider, {
|
|
2910
|
+
value: orientationCtx,
|
|
2911
|
+
children: el
|
|
2916
2912
|
});
|
|
2917
2913
|
}
|
|
2918
2914
|
const WeeksViewGrid = forwardRef(WeeksViewGridFn);
|
|
2919
2915
|
const gridBodyStateAttributesMapping = { root: () => null };
|
|
2920
2916
|
/** Table body wrapping the week rows. Renders a `<tbody>` by default. */
|
|
2921
2917
|
function GridBodyFn(props, ref) {
|
|
2922
|
-
if (useContext(
|
|
2918
|
+
if (useContext(ViewContext)?.viewType === "weeks") {
|
|
2923
2919
|
const { children, className, style } = props;
|
|
2924
2920
|
return /* @__PURE__ */ jsx(WeeksGrid, {
|
|
2925
2921
|
className,
|
|
@@ -2935,7 +2931,7 @@ function GridBodyFn(props, ref) {
|
|
|
2935
2931
|
const GridBody = forwardRef(GridBodyFn);
|
|
2936
2932
|
function MonthGridBodyFn(props, ref) {
|
|
2937
2933
|
const { render, ...otherProps } = props;
|
|
2938
|
-
const { rootState } =
|
|
2934
|
+
const { rootState } = useViewState();
|
|
2939
2935
|
const state = useMemo(() => ({ root: rootState }), [rootState]);
|
|
2940
2936
|
const defaultProps = { children: props.children ?? /* @__PURE__ */ jsx(WeekTemplate, { children: /* @__PURE__ */ jsx(DayCellTemplate, { children: /* @__PURE__ */ jsx(DayButton, {}) }) }) };
|
|
2941
2937
|
const { children: _children, ...restOtherProps } = otherProps;
|
|
@@ -2957,7 +2953,7 @@ const weekInstanceStateAttributesMapping = {
|
|
|
2957
2953
|
function WeekInstance(props) {
|
|
2958
2954
|
const { render, ...otherProps } = props;
|
|
2959
2955
|
const weekData = useContext(WeekDataContext);
|
|
2960
|
-
const { rootState } =
|
|
2956
|
+
const { rootState } = useViewState();
|
|
2961
2957
|
return useRender({
|
|
2962
2958
|
defaultTagName: "tr",
|
|
2963
2959
|
render,
|
|
@@ -2982,8 +2978,8 @@ function WeekInstance(props) {
|
|
|
2982
2978
|
function WeekTemplate(props) {
|
|
2983
2979
|
const outerWeekData = useContext(WeekDataContext);
|
|
2984
2980
|
const gridMonthCtx = useContext(GridMonthContext);
|
|
2985
|
-
const
|
|
2986
|
-
const weeks = gridMonthCtx?.weeks ??
|
|
2981
|
+
const monthState = useContext(MonthViewStateContext);
|
|
2982
|
+
const weeks = gridMonthCtx?.weeks ?? monthState?.weeks ?? [];
|
|
2987
2983
|
const gridMonth = useMemo(() => gridMonthCtx ? {
|
|
2988
2984
|
year: gridMonthCtx.year,
|
|
2989
2985
|
month: gridMonthCtx.month
|
|
@@ -3026,7 +3022,7 @@ function DateStringFn(props, ref) {
|
|
|
3026
3022
|
const { render, locales, options, ...otherProps } = props;
|
|
3027
3023
|
const { locale, temporal: T, timeZone } = useCalendarStable();
|
|
3028
3024
|
const { selected } = useCalendarState();
|
|
3029
|
-
const { currentDateTime, rootState } =
|
|
3025
|
+
const { currentDateTime, rootState } = useViewState();
|
|
3030
3026
|
const selectedZdt = selectedToZdt(selected, timeZone, T);
|
|
3031
3027
|
const displayDate = selectedZdt ? zdtToNativeDate(selectedZdt) : new Date(currentDateTime.year, currentDateTime.month - 1, 1);
|
|
3032
3028
|
const formatted = displayDate.toLocaleDateString(locales ?? locale, options);
|
|
@@ -3065,7 +3061,7 @@ function TimeStringFn(props, ref) {
|
|
|
3065
3061
|
const { render, locales, options, ...otherProps } = props;
|
|
3066
3062
|
const { locale, temporal: T, timeZone } = useCalendarStable();
|
|
3067
3063
|
const { selected } = useCalendarState();
|
|
3068
|
-
const { rootState } =
|
|
3064
|
+
const { rootState } = useViewState();
|
|
3069
3065
|
const selZdt = selectedToZdt(selected, timeZone, T);
|
|
3070
3066
|
const displayDate = selZdt ? zdtToNativeDate(selZdt) : zdtToNativeDate(T.Now.zonedDateTimeISO(timeZone));
|
|
3071
3067
|
const mergedOptions = {
|
|
@@ -3331,9 +3327,8 @@ function RangeSelectedInnerFn(props, ref) {
|
|
|
3331
3327
|
const { orientation } = useContext(GridContext);
|
|
3332
3328
|
const { temporal: T } = useCalendarStable();
|
|
3333
3329
|
const { rangeStart, rangeEnd } = useCalendarState();
|
|
3334
|
-
const
|
|
3335
|
-
const {
|
|
3336
|
-
const outsideDays = monthStable?.outsideDays ?? "enabled";
|
|
3330
|
+
const { rootState } = useViewState();
|
|
3331
|
+
const { outsideDays } = useViewStable();
|
|
3337
3332
|
const days = weekData?.days ?? [];
|
|
3338
3333
|
const gridMonth = weekData?.gridMonth;
|
|
3339
3334
|
const info = useMemo(() => computeClippedRangeInfo(days, rangeStart, rangeEnd, T, outsideDays, gridMonth), [
|
|
@@ -3406,9 +3401,8 @@ function RangePreviewInnerFn(props, ref) {
|
|
|
3406
3401
|
const { orientation } = useContext(GridContext);
|
|
3407
3402
|
const { temporal: T } = useCalendarStable();
|
|
3408
3403
|
const { previewStart, previewEnd } = useCalendarState();
|
|
3409
|
-
const
|
|
3410
|
-
const {
|
|
3411
|
-
const outsideDays = monthStable?.outsideDays ?? "enabled";
|
|
3404
|
+
const { rootState } = useViewState();
|
|
3405
|
+
const { outsideDays } = useViewStable();
|
|
3412
3406
|
const days = weekData?.days ?? [];
|
|
3413
3407
|
const gridMonth = weekData?.gridMonth;
|
|
3414
3408
|
const info = useMemo(() => computeClippedRangeInfo(days, previewStart, previewEnd, T, outsideDays, gridMonth), [
|
|
@@ -3470,7 +3464,7 @@ const dragHandleStateAttributesMapping = {
|
|
|
3470
3464
|
function useDragHandle(edge, { dragging: draggingProp }) {
|
|
3471
3465
|
const { temporal: T, setHoveredDate, readOnly, disabled } = useCalendarStable();
|
|
3472
3466
|
const { rangeStart, rangeEnd } = useCalendarState();
|
|
3473
|
-
const { rootState } =
|
|
3467
|
+
const { rootState } = useViewState();
|
|
3474
3468
|
const cellData = useContext(DayCellDataContext);
|
|
3475
3469
|
const { orientation } = useContext(GridContext);
|
|
3476
3470
|
const date = cellData?.date;
|
|
@@ -3553,7 +3547,7 @@ const weekNumberCellStateAttributesMapping = {
|
|
|
3553
3547
|
function WeekNumberCellFn(props, ref) {
|
|
3554
3548
|
const { render, ...otherProps } = props;
|
|
3555
3549
|
const weekData = useContext(WeekDataContext);
|
|
3556
|
-
const { rootState } =
|
|
3550
|
+
const { rootState } = useViewState();
|
|
3557
3551
|
const { temporal: T } = useCalendarStable();
|
|
3558
3552
|
const days = weekData?.days ?? [];
|
|
3559
3553
|
const weekNumber = useMemo(() => {
|
|
@@ -3591,7 +3585,7 @@ const WeekNumberCell = forwardRef(WeekNumberCellFn);
|
|
|
3591
3585
|
const weekNumberHeaderStateAttributesMapping = { root: () => null };
|
|
3592
3586
|
function WeekNumberHeaderFn(props, ref) {
|
|
3593
3587
|
const { render, ...otherProps } = props;
|
|
3594
|
-
const { rootState } =
|
|
3588
|
+
const { rootState } = useViewState();
|
|
3595
3589
|
const state = useMemo(() => ({ root: rootState }), [rootState]);
|
|
3596
3590
|
return useRender({
|
|
3597
3591
|
defaultTagName: "th",
|
|
@@ -4188,6 +4182,14 @@ function useWeeksViewRootState(props) {
|
|
|
4188
4182
|
tabTargetDate,
|
|
4189
4183
|
gridHasFocus
|
|
4190
4184
|
]),
|
|
4185
|
+
viewStableCtx: useMemo(() => ({
|
|
4186
|
+
gridFocusedRef,
|
|
4187
|
+
outsideDays: "enabled"
|
|
4188
|
+
}), []),
|
|
4189
|
+
viewStateCtx: useMemo(() => ({
|
|
4190
|
+
currentDateTime,
|
|
4191
|
+
rootState
|
|
4192
|
+
}), [currentDateTime, rootState]),
|
|
4191
4193
|
scrollToWeek
|
|
4192
4194
|
};
|
|
4193
4195
|
}
|
|
@@ -4195,42 +4197,16 @@ function useWeeksViewRootState(props) {
|
|
|
4195
4197
|
//#region src/weeks-view.tsx
|
|
4196
4198
|
function WeeksViewRootFn(props, ref) {
|
|
4197
4199
|
const { children } = props;
|
|
4198
|
-
const { stableCtx, stateCtx, viewCtx, scrollToWeek } = useWeeksViewRootState(props);
|
|
4200
|
+
const { stableCtx, stateCtx, viewCtx, viewStableCtx, viewStateCtx, scrollToWeek } = useWeeksViewRootState(props);
|
|
4199
4201
|
useImperativeHandle(ref, () => ({ scrollToWeek }), [scrollToWeek]);
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
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,
|
|
4202
|
+
return /* @__PURE__ */ jsx(WeeksViewStableContext.Provider, {
|
|
4203
|
+
value: stableCtx,
|
|
4204
|
+
children: /* @__PURE__ */ jsx(WeeksViewStateContext.Provider, {
|
|
4205
|
+
value: stateCtx,
|
|
4206
|
+
children: /* @__PURE__ */ jsx(ViewStableContext.Provider, {
|
|
4207
|
+
value: viewStableCtx,
|
|
4208
|
+
children: /* @__PURE__ */ jsx(ViewStateContext.Provider, {
|
|
4209
|
+
value: viewStateCtx,
|
|
4234
4210
|
children: /* @__PURE__ */ jsx(ViewContext.Provider, {
|
|
4235
4211
|
value: viewCtx,
|
|
4236
4212
|
children
|
|
@@ -4275,7 +4251,7 @@ function useWeeksNavButton(direction, shiftByProp) {
|
|
|
4275
4251
|
const { disabled: globalDisabled, minValue, maxValue, temporal: T, weekStartDay } = useCalendarStable();
|
|
4276
4252
|
const { weekCount, outOfRangeBehavior, goNext, goPrev } = useWeeksViewStable();
|
|
4277
4253
|
const { windowInfo } = useWeeksViewState();
|
|
4278
|
-
const { rootState } =
|
|
4254
|
+
const { rootState } = useViewState();
|
|
4279
4255
|
const currentFirstWeek = windowInfo.windowStart;
|
|
4280
4256
|
const isDisabled = useMemo(() => {
|
|
4281
4257
|
if (globalDisabled) return true;
|
|
@@ -4361,7 +4337,7 @@ const NextWeeksButton = forwardRef(NextWeeksButtonFn);
|
|
|
4361
4337
|
function WeekCountFn(props, ref) {
|
|
4362
4338
|
const { render, ...otherProps } = props;
|
|
4363
4339
|
const { windowInfo } = useWeeksViewState();
|
|
4364
|
-
const { rootState } =
|
|
4340
|
+
const { rootState } = useViewState();
|
|
4365
4341
|
const count = windowInfo.weekCount;
|
|
4366
4342
|
const state = useMemo(() => ({
|
|
4367
4343
|
root: rootState,
|