@klinking/colander 3.1.0-alpha.1 → 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.mjs +1 -1
- package/dist/formats/object.cjs +1 -1
- package/dist/formats/object.mjs +1 -1
- package/dist/formats/plain-date-time.cjs +1 -1
- package/dist/formats/plain-date-time.mjs +1 -1
- package/dist/formats/plain-date.cjs +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.mjs +1 -1
- package/dist/formats/plain-year-month.cjs +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.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{weeks-navigation-Bg0nZLgh.mjs → weeks-navigation-DEaASUAh.mjs} +125 -120
- package/dist/{weeks-navigation-CJzhxbgj.cjs → weeks-navigation-DvryOSWF.cjs} +125 -120
- package/package.json +1 -1
- package/src/calendar-provider.test.tsx +87 -0
- package/src/calendar-provider.tsx +65 -16
- 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
package/dist/formats/date.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_weeks_navigation = require("../weeks-navigation-
|
|
2
|
+
const require_weeks_navigation = require("../weeks-navigation-DvryOSWF.cjs");
|
|
3
3
|
//#region src/formats/date.ts
|
|
4
4
|
const CalendarProvider = require_weeks_navigation.CalendarProvider;
|
|
5
5
|
const MonthView = require_weeks_navigation.MonthView;
|
package/dist/formats/date.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as MonthSeparatorRow, B as useViewContext, C as DayButton, D as MonthSeparator, E as useWeeksViewState, F as DayCellDataContext, G as useCalendarStable, H as useMonthViewState, I as GridContext, K as useCalendarState, L as WeekDataContext, M as MonthSeparatorYear, N as GridHeader, O as MonthSeparatorCell, P as GridHeaderCell, R as MonthView$1, S as WeekTemplate, T as useWeeksViewStable, U as CalendarProvider$1, V as useMonthViewStable, W as computePreviewRange, _ as NextMonthButton, a as WeeksViewRoot, b as Grid, c as computeWeeksInWindow, d as RangeEndDragHandle, f as RangeStartDragHandle, g as MonthYearString, h as DateString, i as WeeksView, j as MonthSeparatorWeekCount, k as MonthSeparatorMonth, l as WeekNumberCell, m as RangeSelected, n as PrevWeeksButton, o as resolveFirstWeek, p as RangePreview, r as WeekCount, s as resolveFirstWeekSpec, t as NextWeeksButton, u as WeekNumberHeader, v as PrevMonthButton, w as DayCellTemplate, x as GridBody, y as TimeString, z as MonthViewRoot } from "../weeks-navigation-
|
|
1
|
+
import { A as MonthSeparatorRow, B as useViewContext, C as DayButton, D as MonthSeparator, E as useWeeksViewState, F as DayCellDataContext, G as useCalendarStable, H as useMonthViewState, I as GridContext, K as useCalendarState, L as WeekDataContext, M as MonthSeparatorYear, N as GridHeader, O as MonthSeparatorCell, P as GridHeaderCell, R as MonthView$1, S as WeekTemplate, T as useWeeksViewStable, U as CalendarProvider$1, V as useMonthViewStable, W as computePreviewRange, _ as NextMonthButton, a as WeeksViewRoot, b as Grid, c as computeWeeksInWindow, d as RangeEndDragHandle, f as RangeStartDragHandle, g as MonthYearString, h as DateString, i as WeeksView, j as MonthSeparatorWeekCount, k as MonthSeparatorMonth, l as WeekNumberCell, m as RangeSelected, n as PrevWeeksButton, o as resolveFirstWeek, p as RangePreview, r as WeekCount, s as resolveFirstWeekSpec, t as NextWeeksButton, u as WeekNumberHeader, v as PrevMonthButton, w as DayCellTemplate, x as GridBody, y as TimeString, z as MonthViewRoot } from "../weeks-navigation-DEaASUAh.mjs";
|
|
2
2
|
//#region src/formats/date.ts
|
|
3
3
|
const CalendarProvider = CalendarProvider$1;
|
|
4
4
|
const MonthView = MonthView$1;
|
package/dist/formats/object.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_weeks_navigation = require("../weeks-navigation-
|
|
2
|
+
const require_weeks_navigation = require("../weeks-navigation-DvryOSWF.cjs");
|
|
3
3
|
//#region src/formats/object.ts
|
|
4
4
|
const CalendarProvider = require_weeks_navigation.CalendarProvider;
|
|
5
5
|
const MonthView = require_weeks_navigation.MonthView;
|
package/dist/formats/object.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as MonthSeparatorRow, B as useViewContext, C as DayButton, D as MonthSeparator, E as useWeeksViewState, F as DayCellDataContext, G as useCalendarStable, H as useMonthViewState, I as GridContext, K as useCalendarState, L as WeekDataContext, M as MonthSeparatorYear, N as GridHeader, O as MonthSeparatorCell, P as GridHeaderCell, R as MonthView$1, S as WeekTemplate, T as useWeeksViewStable, U as CalendarProvider$1, V as useMonthViewStable, W as computePreviewRange, _ as NextMonthButton, a as WeeksViewRoot, b as Grid, c as computeWeeksInWindow, d as RangeEndDragHandle, f as RangeStartDragHandle, g as MonthYearString, h as DateString, i as WeeksView, j as MonthSeparatorWeekCount, k as MonthSeparatorMonth, l as WeekNumberCell, m as RangeSelected, n as PrevWeeksButton, o as resolveFirstWeek, p as RangePreview, r as WeekCount, s as resolveFirstWeekSpec, t as NextWeeksButton, u as WeekNumberHeader, v as PrevMonthButton, w as DayCellTemplate, x as GridBody, y as TimeString, z as MonthViewRoot } from "../weeks-navigation-
|
|
1
|
+
import { A as MonthSeparatorRow, B as useViewContext, C as DayButton, D as MonthSeparator, E as useWeeksViewState, F as DayCellDataContext, G as useCalendarStable, H as useMonthViewState, I as GridContext, K as useCalendarState, L as WeekDataContext, M as MonthSeparatorYear, N as GridHeader, O as MonthSeparatorCell, P as GridHeaderCell, R as MonthView$1, S as WeekTemplate, T as useWeeksViewStable, U as CalendarProvider$1, V as useMonthViewStable, W as computePreviewRange, _ as NextMonthButton, a as WeeksViewRoot, b as Grid, c as computeWeeksInWindow, d as RangeEndDragHandle, f as RangeStartDragHandle, g as MonthYearString, h as DateString, i as WeeksView, j as MonthSeparatorWeekCount, k as MonthSeparatorMonth, l as WeekNumberCell, m as RangeSelected, n as PrevWeeksButton, o as resolveFirstWeek, p as RangePreview, r as WeekCount, s as resolveFirstWeekSpec, t as NextWeeksButton, u as WeekNumberHeader, v as PrevMonthButton, w as DayCellTemplate, x as GridBody, y as TimeString, z as MonthViewRoot } from "../weeks-navigation-DEaASUAh.mjs";
|
|
2
2
|
//#region src/formats/object.ts
|
|
3
3
|
const CalendarProvider = CalendarProvider$1;
|
|
4
4
|
const MonthView = MonthView$1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_weeks_navigation = require("../weeks-navigation-
|
|
2
|
+
const require_weeks_navigation = require("../weeks-navigation-DvryOSWF.cjs");
|
|
3
3
|
//#region src/formats/plain-date-time.ts
|
|
4
4
|
const CalendarProvider = require_weeks_navigation.CalendarProvider;
|
|
5
5
|
const MonthView = require_weeks_navigation.MonthView;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as MonthSeparatorRow, B as useViewContext, C as DayButton, D as MonthSeparator, E as useWeeksViewState, F as DayCellDataContext, G as useCalendarStable, H as useMonthViewState, I as GridContext, K as useCalendarState, L as WeekDataContext, M as MonthSeparatorYear, N as GridHeader, O as MonthSeparatorCell, P as GridHeaderCell, R as MonthView$1, S as WeekTemplate, T as useWeeksViewStable, U as CalendarProvider$1, V as useMonthViewStable, W as computePreviewRange, _ as NextMonthButton, a as WeeksViewRoot, b as Grid, c as computeWeeksInWindow, d as RangeEndDragHandle, f as RangeStartDragHandle, g as MonthYearString, h as DateString, i as WeeksView, j as MonthSeparatorWeekCount, k as MonthSeparatorMonth, l as WeekNumberCell, m as RangeSelected, n as PrevWeeksButton, o as resolveFirstWeek, p as RangePreview, r as WeekCount, s as resolveFirstWeekSpec, t as NextWeeksButton, u as WeekNumberHeader, v as PrevMonthButton, w as DayCellTemplate, x as GridBody, y as TimeString, z as MonthViewRoot } from "../weeks-navigation-
|
|
1
|
+
import { A as MonthSeparatorRow, B as useViewContext, C as DayButton, D as MonthSeparator, E as useWeeksViewState, F as DayCellDataContext, G as useCalendarStable, H as useMonthViewState, I as GridContext, K as useCalendarState, L as WeekDataContext, M as MonthSeparatorYear, N as GridHeader, O as MonthSeparatorCell, P as GridHeaderCell, R as MonthView$1, S as WeekTemplate, T as useWeeksViewStable, U as CalendarProvider$1, V as useMonthViewStable, W as computePreviewRange, _ as NextMonthButton, a as WeeksViewRoot, b as Grid, c as computeWeeksInWindow, d as RangeEndDragHandle, f as RangeStartDragHandle, g as MonthYearString, h as DateString, i as WeeksView, j as MonthSeparatorWeekCount, k as MonthSeparatorMonth, l as WeekNumberCell, m as RangeSelected, n as PrevWeeksButton, o as resolveFirstWeek, p as RangePreview, r as WeekCount, s as resolveFirstWeekSpec, t as NextWeeksButton, u as WeekNumberHeader, v as PrevMonthButton, w as DayCellTemplate, x as GridBody, y as TimeString, z as MonthViewRoot } from "../weeks-navigation-DEaASUAh.mjs";
|
|
2
2
|
//#region src/formats/plain-date-time.ts
|
|
3
3
|
const CalendarProvider = CalendarProvider$1;
|
|
4
4
|
const MonthView = MonthView$1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_weeks_navigation = require("../weeks-navigation-
|
|
2
|
+
const require_weeks_navigation = require("../weeks-navigation-DvryOSWF.cjs");
|
|
3
3
|
//#region src/formats/plain-date.ts
|
|
4
4
|
const CalendarProvider = require_weeks_navigation.CalendarProvider;
|
|
5
5
|
const MonthView = require_weeks_navigation.MonthView;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as MonthSeparatorRow, B as useViewContext, C as DayButton, D as MonthSeparator, E as useWeeksViewState, F as DayCellDataContext, G as useCalendarStable, H as useMonthViewState, I as GridContext, K as useCalendarState, L as WeekDataContext, M as MonthSeparatorYear, N as GridHeader, O as MonthSeparatorCell, P as GridHeaderCell, R as MonthView$1, S as WeekTemplate, T as useWeeksViewStable, U as CalendarProvider$1, V as useMonthViewStable, W as computePreviewRange, _ as NextMonthButton, a as WeeksViewRoot, b as Grid, c as computeWeeksInWindow, d as RangeEndDragHandle, f as RangeStartDragHandle, g as MonthYearString, h as DateString, i as WeeksView, j as MonthSeparatorWeekCount, k as MonthSeparatorMonth, l as WeekNumberCell, m as RangeSelected, n as PrevWeeksButton, o as resolveFirstWeek, p as RangePreview, r as WeekCount, s as resolveFirstWeekSpec, t as NextWeeksButton, u as WeekNumberHeader, v as PrevMonthButton, w as DayCellTemplate, x as GridBody, y as TimeString, z as MonthViewRoot } from "../weeks-navigation-
|
|
1
|
+
import { A as MonthSeparatorRow, B as useViewContext, C as DayButton, D as MonthSeparator, E as useWeeksViewState, F as DayCellDataContext, G as useCalendarStable, H as useMonthViewState, I as GridContext, K as useCalendarState, L as WeekDataContext, M as MonthSeparatorYear, N as GridHeader, O as MonthSeparatorCell, P as GridHeaderCell, R as MonthView$1, S as WeekTemplate, T as useWeeksViewStable, U as CalendarProvider$1, V as useMonthViewStable, W as computePreviewRange, _ as NextMonthButton, a as WeeksViewRoot, b as Grid, c as computeWeeksInWindow, d as RangeEndDragHandle, f as RangeStartDragHandle, g as MonthYearString, h as DateString, i as WeeksView, j as MonthSeparatorWeekCount, k as MonthSeparatorMonth, l as WeekNumberCell, m as RangeSelected, n as PrevWeeksButton, o as resolveFirstWeek, p as RangePreview, r as WeekCount, s as resolveFirstWeekSpec, t as NextWeeksButton, u as WeekNumberHeader, v as PrevMonthButton, w as DayCellTemplate, x as GridBody, y as TimeString, z as MonthViewRoot } from "../weeks-navigation-DEaASUAh.mjs";
|
|
2
2
|
//#region src/formats/plain-date.ts
|
|
3
3
|
const CalendarProvider = CalendarProvider$1;
|
|
4
4
|
const MonthView = MonthView$1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_weeks_navigation = require("../weeks-navigation-
|
|
2
|
+
const require_weeks_navigation = require("../weeks-navigation-DvryOSWF.cjs");
|
|
3
3
|
//#region src/formats/plain-month-day.ts
|
|
4
4
|
const CalendarProvider = require_weeks_navigation.CalendarProvider;
|
|
5
5
|
const MonthView = require_weeks_navigation.MonthView;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as MonthSeparatorRow, B as useViewContext, C as DayButton, D as MonthSeparator, E as useWeeksViewState, F as DayCellDataContext, G as useCalendarStable, H as useMonthViewState, I as GridContext, K as useCalendarState, L as WeekDataContext, M as MonthSeparatorYear, N as GridHeader, O as MonthSeparatorCell, P as GridHeaderCell, R as MonthView$1, S as WeekTemplate, T as useWeeksViewStable, U as CalendarProvider$1, V as useMonthViewStable, W as computePreviewRange, _ as NextMonthButton, a as WeeksViewRoot, b as Grid, c as computeWeeksInWindow, d as RangeEndDragHandle, f as RangeStartDragHandle, g as MonthYearString, h as DateString, i as WeeksView, j as MonthSeparatorWeekCount, k as MonthSeparatorMonth, l as WeekNumberCell, m as RangeSelected, n as PrevWeeksButton, o as resolveFirstWeek, p as RangePreview, r as WeekCount, s as resolveFirstWeekSpec, t as NextWeeksButton, u as WeekNumberHeader, v as PrevMonthButton, w as DayCellTemplate, x as GridBody, y as TimeString, z as MonthViewRoot } from "../weeks-navigation-
|
|
1
|
+
import { A as MonthSeparatorRow, B as useViewContext, C as DayButton, D as MonthSeparator, E as useWeeksViewState, F as DayCellDataContext, G as useCalendarStable, H as useMonthViewState, I as GridContext, K as useCalendarState, L as WeekDataContext, M as MonthSeparatorYear, N as GridHeader, O as MonthSeparatorCell, P as GridHeaderCell, R as MonthView$1, S as WeekTemplate, T as useWeeksViewStable, U as CalendarProvider$1, V as useMonthViewStable, W as computePreviewRange, _ as NextMonthButton, a as WeeksViewRoot, b as Grid, c as computeWeeksInWindow, d as RangeEndDragHandle, f as RangeStartDragHandle, g as MonthYearString, h as DateString, i as WeeksView, j as MonthSeparatorWeekCount, k as MonthSeparatorMonth, l as WeekNumberCell, m as RangeSelected, n as PrevWeeksButton, o as resolveFirstWeek, p as RangePreview, r as WeekCount, s as resolveFirstWeekSpec, t as NextWeeksButton, u as WeekNumberHeader, v as PrevMonthButton, w as DayCellTemplate, x as GridBody, y as TimeString, z as MonthViewRoot } from "../weeks-navigation-DEaASUAh.mjs";
|
|
2
2
|
//#region src/formats/plain-month-day.ts
|
|
3
3
|
const CalendarProvider = CalendarProvider$1;
|
|
4
4
|
const MonthView = MonthView$1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_weeks_navigation = require("../weeks-navigation-
|
|
2
|
+
const require_weeks_navigation = require("../weeks-navigation-DvryOSWF.cjs");
|
|
3
3
|
//#region src/formats/plain-year-month.ts
|
|
4
4
|
const CalendarProvider = require_weeks_navigation.CalendarProvider;
|
|
5
5
|
const MonthView = require_weeks_navigation.MonthView;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as MonthSeparatorRow, B as useViewContext, C as DayButton, D as MonthSeparator, E as useWeeksViewState, F as DayCellDataContext, G as useCalendarStable, H as useMonthViewState, I as GridContext, K as useCalendarState, L as WeekDataContext, M as MonthSeparatorYear, N as GridHeader, O as MonthSeparatorCell, P as GridHeaderCell, R as MonthView$1, S as WeekTemplate, T as useWeeksViewStable, U as CalendarProvider$1, V as useMonthViewStable, W as computePreviewRange, _ as NextMonthButton, a as WeeksViewRoot, b as Grid, c as computeWeeksInWindow, d as RangeEndDragHandle, f as RangeStartDragHandle, g as MonthYearString, h as DateString, i as WeeksView, j as MonthSeparatorWeekCount, k as MonthSeparatorMonth, l as WeekNumberCell, m as RangeSelected, n as PrevWeeksButton, o as resolveFirstWeek, p as RangePreview, r as WeekCount, s as resolveFirstWeekSpec, t as NextWeeksButton, u as WeekNumberHeader, v as PrevMonthButton, w as DayCellTemplate, x as GridBody, y as TimeString, z as MonthViewRoot } from "../weeks-navigation-
|
|
1
|
+
import { A as MonthSeparatorRow, B as useViewContext, C as DayButton, D as MonthSeparator, E as useWeeksViewState, F as DayCellDataContext, G as useCalendarStable, H as useMonthViewState, I as GridContext, K as useCalendarState, L as WeekDataContext, M as MonthSeparatorYear, N as GridHeader, O as MonthSeparatorCell, P as GridHeaderCell, R as MonthView$1, S as WeekTemplate, T as useWeeksViewStable, U as CalendarProvider$1, V as useMonthViewStable, W as computePreviewRange, _ as NextMonthButton, a as WeeksViewRoot, b as Grid, c as computeWeeksInWindow, d as RangeEndDragHandle, f as RangeStartDragHandle, g as MonthYearString, h as DateString, i as WeeksView, j as MonthSeparatorWeekCount, k as MonthSeparatorMonth, l as WeekNumberCell, m as RangeSelected, n as PrevWeeksButton, o as resolveFirstWeek, p as RangePreview, r as WeekCount, s as resolveFirstWeekSpec, t as NextWeeksButton, u as WeekNumberHeader, v as PrevMonthButton, w as DayCellTemplate, x as GridBody, y as TimeString, z as MonthViewRoot } from "../weeks-navigation-DEaASUAh.mjs";
|
|
2
2
|
//#region src/formats/plain-year-month.ts
|
|
3
3
|
const CalendarProvider = CalendarProvider$1;
|
|
4
4
|
const MonthView = MonthView$1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_weeks_navigation = require("../weeks-navigation-
|
|
2
|
+
const require_weeks_navigation = require("../weeks-navigation-DvryOSWF.cjs");
|
|
3
3
|
//#region src/formats/zoned-date-time.ts
|
|
4
4
|
const CalendarProvider = require_weeks_navigation.CalendarProvider;
|
|
5
5
|
const MonthView = require_weeks_navigation.MonthView;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as MonthSeparatorRow, B as useViewContext, C as DayButton, D as MonthSeparator, E as useWeeksViewState, F as DayCellDataContext, G as useCalendarStable, H as useMonthViewState, I as GridContext, K as useCalendarState, L as WeekDataContext, M as MonthSeparatorYear, N as GridHeader, O as MonthSeparatorCell, P as GridHeaderCell, R as MonthView$1, S as WeekTemplate, T as useWeeksViewStable, U as CalendarProvider$1, V as useMonthViewStable, W as computePreviewRange, _ as NextMonthButton, a as WeeksViewRoot, b as Grid, c as computeWeeksInWindow, d as RangeEndDragHandle, f as RangeStartDragHandle, g as MonthYearString, h as DateString, i as WeeksView, j as MonthSeparatorWeekCount, k as MonthSeparatorMonth, l as WeekNumberCell, m as RangeSelected, n as PrevWeeksButton, o as resolveFirstWeek, p as RangePreview, r as WeekCount, s as resolveFirstWeekSpec, t as NextWeeksButton, u as WeekNumberHeader, v as PrevMonthButton, w as DayCellTemplate, x as GridBody, y as TimeString, z as MonthViewRoot } from "../weeks-navigation-
|
|
1
|
+
import { A as MonthSeparatorRow, B as useViewContext, C as DayButton, D as MonthSeparator, E as useWeeksViewState, F as DayCellDataContext, G as useCalendarStable, H as useMonthViewState, I as GridContext, K as useCalendarState, L as WeekDataContext, M as MonthSeparatorYear, N as GridHeader, O as MonthSeparatorCell, P as GridHeaderCell, R as MonthView$1, S as WeekTemplate, T as useWeeksViewStable, U as CalendarProvider$1, V as useMonthViewStable, W as computePreviewRange, _ as NextMonthButton, a as WeeksViewRoot, b as Grid, c as computeWeeksInWindow, d as RangeEndDragHandle, f as RangeStartDragHandle, g as MonthYearString, h as DateString, i as WeeksView, j as MonthSeparatorWeekCount, k as MonthSeparatorMonth, l as WeekNumberCell, m as RangeSelected, n as PrevWeeksButton, o as resolveFirstWeek, p as RangePreview, r as WeekCount, s as resolveFirstWeekSpec, t as NextWeeksButton, u as WeekNumberHeader, v as PrevMonthButton, w as DayCellTemplate, x as GridBody, y as TimeString, z as MonthViewRoot } from "../weeks-navigation-DEaASUAh.mjs";
|
|
2
2
|
//#region src/formats/zoned-date-time.ts
|
|
3
3
|
const CalendarProvider = CalendarProvider$1;
|
|
4
4
|
const MonthView = MonthView$1;
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_weeks_navigation = require("./weeks-navigation-
|
|
2
|
+
const require_weeks_navigation = require("./weeks-navigation-DvryOSWF.cjs");
|
|
3
3
|
exports.CalendarProvider = require_weeks_navigation.CalendarProvider;
|
|
4
4
|
exports.DateString = require_weeks_navigation.DateString;
|
|
5
5
|
exports.DayButton = require_weeks_navigation.DayButton;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as MonthSeparatorRow, B as useViewContext, C as DayButton, D as MonthSeparator, E as useWeeksViewState, F as DayCellDataContext, G as useCalendarStable, H as useMonthViewState, I as GridContext, K as useCalendarState, L as WeekDataContext, M as MonthSeparatorYear, N as GridHeader, O as MonthSeparatorCell, P as GridHeaderCell, R as MonthView, S as WeekTemplate, T as useWeeksViewStable, U as CalendarProvider, V as useMonthViewStable, W as computePreviewRange, _ as NextMonthButton, a as WeeksViewRoot, b as Grid, c as computeWeeksInWindow, d as RangeEndDragHandle, f as RangeStartDragHandle, g as MonthYearString, h as DateString, i as WeeksView, j as MonthSeparatorWeekCount, k as MonthSeparatorMonth, l as WeekNumberCell, m as RangeSelected, n as PrevWeeksButton, o as resolveFirstWeek, p as RangePreview, r as WeekCount, s as resolveFirstWeekSpec, t as NextWeeksButton, u as WeekNumberHeader, v as PrevMonthButton, w as DayCellTemplate, x as GridBody, y as TimeString, z as MonthViewRoot } from "./weeks-navigation-
|
|
1
|
+
import { A as MonthSeparatorRow, B as useViewContext, C as DayButton, D as MonthSeparator, E as useWeeksViewState, F as DayCellDataContext, G as useCalendarStable, H as useMonthViewState, I as GridContext, K as useCalendarState, L as WeekDataContext, M as MonthSeparatorYear, N as GridHeader, O as MonthSeparatorCell, P as GridHeaderCell, R as MonthView, S as WeekTemplate, T as useWeeksViewStable, U as CalendarProvider, V as useMonthViewStable, W as computePreviewRange, _ as NextMonthButton, a as WeeksViewRoot, b as Grid, c as computeWeeksInWindow, d as RangeEndDragHandle, f as RangeStartDragHandle, g as MonthYearString, h as DateString, i as WeeksView, j as MonthSeparatorWeekCount, k as MonthSeparatorMonth, l as WeekNumberCell, m as RangeSelected, n as PrevWeeksButton, o as resolveFirstWeek, p as RangePreview, r as WeekCount, s as resolveFirstWeekSpec, t as NextWeeksButton, u as WeekNumberHeader, v as PrevMonthButton, w as DayCellTemplate, x as GridBody, y as TimeString, z as MonthViewRoot } from "./weeks-navigation-DEaASUAh.mjs";
|
|
2
2
|
export { CalendarProvider, DateString, DayButton, DayCellDataContext, DayCellTemplate, Grid, GridBody, GridContext, GridHeader, GridHeaderCell, MonthSeparator, MonthSeparatorCell, MonthSeparatorMonth, MonthSeparatorRow, MonthSeparatorWeekCount, MonthSeparatorYear, MonthView, MonthViewRoot, MonthYearString, NextMonthButton, NextWeeksButton, PrevMonthButton, PrevWeeksButton, RangeEndDragHandle, RangePreview, RangeSelected, RangeStartDragHandle, TimeString, WeekCount, WeekDataContext, WeekNumberCell, WeekNumberHeader, WeekTemplate, WeeksView, WeeksViewRoot, computePreviewRange, computeWeeksInWindow, resolveFirstWeek, resolveFirstWeekSpec, useCalendarStable, useCalendarState, useMonthViewStable, useMonthViewState, useViewContext, useWeeksViewStable, useWeeksViewState };
|
|
@@ -900,6 +900,21 @@ function CalendarProvider(props) {
|
|
|
900
900
|
rawToPlain,
|
|
901
901
|
sortDates
|
|
902
902
|
]);
|
|
903
|
+
const warnedMalformedRef = useRef(false);
|
|
904
|
+
useEffect(() => {
|
|
905
|
+
if (!(valueProp != null && (isRange && !isDateRange(valueProp) || isMultiple && !Array.isArray(valueProp)))) {
|
|
906
|
+
warnedMalformedRef.current = false;
|
|
907
|
+
return;
|
|
908
|
+
}
|
|
909
|
+
if (warnedMalformedRef.current) return;
|
|
910
|
+
warnedMalformedRef.current = true;
|
|
911
|
+
if (isRange) console.warn(`[DatePicker] selectionMode="range" expects \`value\` to be a { start, end } DateRange or null, but received ${Array.isArray(valueProp) ? "an array" : typeof valueProp}. Ignoring it and falling back to uncontrolled.`);
|
|
912
|
+
else console.warn(`[DatePicker] selectionMode="multiple" expects \`value\` to be an array or null, but received ${typeof valueProp}. Ignoring it and falling back to uncontrolled.`);
|
|
913
|
+
}, [
|
|
914
|
+
valueProp,
|
|
915
|
+
isRange,
|
|
916
|
+
isMultiple
|
|
917
|
+
]);
|
|
903
918
|
const [internalDates, setInternalDates] = useState(useMemo(() => {
|
|
904
919
|
if (isMultiple) {
|
|
905
920
|
if (multipleDefault) return sortDates(multipleDefault.map(rawToPlain));
|
|
@@ -1069,22 +1084,35 @@ function CalendarProvider(props) {
|
|
|
1069
1084
|
plainToFormatValue,
|
|
1070
1085
|
isControlled
|
|
1071
1086
|
]);
|
|
1087
|
+
const warnedOutOfBoundsRef = useRef(false);
|
|
1072
1088
|
useEffect(() => {
|
|
1073
1089
|
if (isRange || isMultiple) return;
|
|
1074
1090
|
const start = committedStart;
|
|
1075
|
-
if (!start)
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1091
|
+
if (!start) {
|
|
1092
|
+
warnedOutOfBoundsRef.current = false;
|
|
1093
|
+
return;
|
|
1094
|
+
}
|
|
1095
|
+
if (!(minValue && T.PlainDate.compare(start, minValue) < 0 || maxValue && T.PlainDate.compare(start, maxValue) > 0)) {
|
|
1096
|
+
warnedOutOfBoundsRef.current = false;
|
|
1097
|
+
return;
|
|
1098
|
+
}
|
|
1099
|
+
if (isControlled) {
|
|
1100
|
+
if (!warnedOutOfBoundsRef.current) {
|
|
1101
|
+
warnedOutOfBoundsRef.current = true;
|
|
1102
|
+
console.warn(`[DatePicker] The controlled \`value\` is outside the min/max range. It stays selected (rendered disabled) until you update \`value\`; the component will not clear it for you.`);
|
|
1103
|
+
}
|
|
1104
|
+
return;
|
|
1087
1105
|
}
|
|
1106
|
+
const prev = currentSingleFormatted();
|
|
1107
|
+
commitSelection({
|
|
1108
|
+
newDates: [],
|
|
1109
|
+
fireCallback: (onValueChange) => {
|
|
1110
|
+
onValueChange?.(null, {
|
|
1111
|
+
date: void 0,
|
|
1112
|
+
previous: prev
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
});
|
|
1088
1116
|
}, [
|
|
1089
1117
|
minValue,
|
|
1090
1118
|
maxValue,
|
|
@@ -1093,7 +1121,8 @@ function CalendarProvider(props) {
|
|
|
1093
1121
|
currentSingleFormatted,
|
|
1094
1122
|
T,
|
|
1095
1123
|
isRange,
|
|
1096
|
-
isMultiple
|
|
1124
|
+
isMultiple,
|
|
1125
|
+
isControlled
|
|
1097
1126
|
]);
|
|
1098
1127
|
const onSelect = useCallback((date) => {
|
|
1099
1128
|
const result = computeSelectionUpdate({
|
|
@@ -1273,6 +1302,22 @@ function useViewContext() {
|
|
|
1273
1302
|
if (!ctx) throw new Error("useViewContext must be used within MonthView or WeeksView");
|
|
1274
1303
|
return ctx;
|
|
1275
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
|
+
}
|
|
1276
1321
|
//#endregion
|
|
1277
1322
|
//#region src/month-view.tsx
|
|
1278
1323
|
function MonthViewRoot(props) {
|
|
@@ -1594,13 +1639,27 @@ function MonthViewRoot(props) {
|
|
|
1594
1639
|
tabTargetDate,
|
|
1595
1640
|
gridHasFocus
|
|
1596
1641
|
]);
|
|
1642
|
+
const viewStableCtx = useMemo(() => ({
|
|
1643
|
+
gridFocusedRef,
|
|
1644
|
+
outsideDays
|
|
1645
|
+
}), [outsideDays]);
|
|
1646
|
+
const viewStateCtx = useMemo(() => ({
|
|
1647
|
+
currentDateTime,
|
|
1648
|
+
rootState
|
|
1649
|
+
}), [currentDateTime, rootState]);
|
|
1597
1650
|
return /* @__PURE__ */ jsx(MonthViewStableContext.Provider, {
|
|
1598
1651
|
value: stableCtx,
|
|
1599
1652
|
children: /* @__PURE__ */ jsx(MonthViewStateContext.Provider, {
|
|
1600
1653
|
value: stateCtx,
|
|
1601
|
-
children: /* @__PURE__ */ jsx(
|
|
1602
|
-
value:
|
|
1603
|
-
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
|
+
})
|
|
1604
1663
|
})
|
|
1605
1664
|
})
|
|
1606
1665
|
});
|
|
@@ -1636,7 +1695,7 @@ const GridMonthContext = createContext(null);
|
|
|
1636
1695
|
//#region src/grid-header.tsx
|
|
1637
1696
|
function useGridHeaderCellState(index) {
|
|
1638
1697
|
const { locale, temporal: T, weekStartDay } = useCalendarStable();
|
|
1639
|
-
const { rootState } =
|
|
1698
|
+
const { rootState } = useViewState();
|
|
1640
1699
|
const weekdayNames = useMemo(() => getWeekdayNames(locale, T, weekStartDay), [
|
|
1641
1700
|
locale,
|
|
1642
1701
|
T,
|
|
@@ -1712,7 +1771,7 @@ function GridHeaderCellFn(props, ref) {
|
|
|
1712
1771
|
const GridHeaderCell = forwardRef(GridHeaderCellFn);
|
|
1713
1772
|
function GridHeaderFn(props, ref) {
|
|
1714
1773
|
const { render, children, ...otherProps } = props;
|
|
1715
|
-
const { rootState } =
|
|
1774
|
+
const { rootState } = useViewState();
|
|
1716
1775
|
const state = useMemo(() => ({ root: rootState }), [rootState]);
|
|
1717
1776
|
return useRender({
|
|
1718
1777
|
defaultTagName: "thead",
|
|
@@ -2422,9 +2481,9 @@ function DayCellTemplate(props) {
|
|
|
2422
2481
|
const { selectedDates, rangeStart, rangeEnd, previewStart, previewEnd } = useCalendarState();
|
|
2423
2482
|
const viewCtx = useViewContext();
|
|
2424
2483
|
const { focusedDate, tabTargetDate } = viewCtx;
|
|
2425
|
-
const
|
|
2426
|
-
const {
|
|
2427
|
-
const
|
|
2484
|
+
const { rootState, currentDateTime } = useViewState();
|
|
2485
|
+
const { outsideDays } = useViewStable();
|
|
2486
|
+
const monthState = useContext(MonthViewStateContext);
|
|
2428
2487
|
const isWeeksView = viewCtx.viewType === "weeks";
|
|
2429
2488
|
const cellMonth = isWeeksView ? null : weekData?.gridMonth ?? currentDateTime;
|
|
2430
2489
|
const { orientation } = useContext(GridContext);
|
|
@@ -2440,7 +2499,7 @@ function DayCellTemplate(props) {
|
|
|
2440
2499
|
_derivedState: derived
|
|
2441
2500
|
});
|
|
2442
2501
|
}
|
|
2443
|
-
const days = weekData ? weekData.days : weeks.flat();
|
|
2502
|
+
const days = weekData ? weekData.days : monthState?.weeks.flat() ?? [];
|
|
2444
2503
|
const perWeek = weekData != null;
|
|
2445
2504
|
return /* @__PURE__ */ jsx(Fragment, { children: days.map((day, i) => {
|
|
2446
2505
|
const daysInWeek = day.daysInWeek;
|
|
@@ -2460,7 +2519,7 @@ function DayButtonInnerFn(props, ref) {
|
|
|
2460
2519
|
const { render, date, _derivedState, ...otherProps } = props;
|
|
2461
2520
|
const { onSelect, locale, readOnly, setHoveredDate } = useCalendarStable();
|
|
2462
2521
|
const { setFocusedDate } = useViewContext();
|
|
2463
|
-
const gridFocusedRef =
|
|
2522
|
+
const { gridFocusedRef } = useViewStable();
|
|
2464
2523
|
const internalRef = useRef(null);
|
|
2465
2524
|
const isHidden = _derivedState?.hidden ?? false;
|
|
2466
2525
|
const isFocused = _derivedState?.focused ?? false;
|
|
@@ -2544,9 +2603,8 @@ function DayButtonFallbackFn(props, ref) {
|
|
|
2544
2603
|
const { selectedDates, rangeStart, rangeEnd, previewStart, previewEnd } = useCalendarState();
|
|
2545
2604
|
const viewCtx = useViewContext();
|
|
2546
2605
|
const { focusedDate, tabTargetDate } = viewCtx;
|
|
2547
|
-
const
|
|
2548
|
-
const {
|
|
2549
|
-
const outsideDays = monthStable?.outsideDays ?? "enabled";
|
|
2606
|
+
const { rootState, currentDateTime } = useViewState();
|
|
2607
|
+
const { outsideDays } = useViewStable();
|
|
2550
2608
|
const cellMonth = viewCtx.viewType === "weeks" ? {
|
|
2551
2609
|
year: date.year,
|
|
2552
2610
|
month: date.month
|
|
@@ -2662,17 +2720,15 @@ const gridStateAttributesMapping = {
|
|
|
2662
2720
|
* delegates to the appropriate internal renderer.
|
|
2663
2721
|
*/
|
|
2664
2722
|
function GridFn(props, ref) {
|
|
2665
|
-
const
|
|
2666
|
-
|
|
2667
|
-
|
|
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, {
|
|
2668
2726
|
ref,
|
|
2669
2727
|
...props
|
|
2670
|
-
})
|
|
2671
|
-
if (weeksState) return /* @__PURE__ */ jsx(WeeksViewGrid, {
|
|
2728
|
+
}) : /* @__PURE__ */ jsx(MonthGrid, {
|
|
2672
2729
|
ref,
|
|
2673
2730
|
...props
|
|
2674
2731
|
});
|
|
2675
|
-
throw new Error("Grid must be used inside MonthView.Root or WeeksView.Root.");
|
|
2676
2732
|
}
|
|
2677
2733
|
const Grid = forwardRef(GridFn);
|
|
2678
2734
|
function MonthGridFn(props, ref) {
|
|
@@ -2779,7 +2835,7 @@ function WeeksViewGridFn(props, ref) {
|
|
|
2779
2835
|
const weeksStable = useWeeksViewStable();
|
|
2780
2836
|
const weeksState = useWeeksViewState();
|
|
2781
2837
|
const { gridFocusedRef } = weeksStable;
|
|
2782
|
-
const { gridLabelIds, weeks
|
|
2838
|
+
const { gridLabelIds, weeks } = weeksState;
|
|
2783
2839
|
const handleKeyDown = useWeeksGridKeyboard();
|
|
2784
2840
|
const gridRef = useRef(null);
|
|
2785
2841
|
useEffect(() => {
|
|
@@ -2850,47 +2906,16 @@ function WeeksViewGridFn(props, ref) {
|
|
|
2850
2906
|
props: mergeProps(defaultProps, otherProps)
|
|
2851
2907
|
});
|
|
2852
2908
|
const orientationCtx = useMemo(() => ({ orientation: resolvedOrientation }), [resolvedOrientation]);
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
outsideDays: "enabled",
|
|
2857
|
-
outOfRangeBehavior: "unbounded",
|
|
2858
|
-
goNextMonth: () => {},
|
|
2859
|
-
goPrevMonth: () => {},
|
|
2860
|
-
setGridLabelId: () => {},
|
|
2861
|
-
gridFocusedRef
|
|
2862
|
-
}), [gridFocusedRef]);
|
|
2863
|
-
const monthViewStateShim = useMemo(() => ({
|
|
2864
|
-
currentMonth: {
|
|
2865
|
-
year: currentDateTime.year,
|
|
2866
|
-
month: currentDateTime.month
|
|
2867
|
-
},
|
|
2868
|
-
weeks: [],
|
|
2869
|
-
allMonths: [],
|
|
2870
|
-
currentDateTime,
|
|
2871
|
-
gridLabelIds,
|
|
2872
|
-
rootState: weeksState.rootState
|
|
2873
|
-
}), [
|
|
2874
|
-
currentDateTime,
|
|
2875
|
-
gridLabelIds,
|
|
2876
|
-
weeksState.rootState
|
|
2877
|
-
]);
|
|
2878
|
-
return /* @__PURE__ */ jsx(MonthViewStableContext.Provider, {
|
|
2879
|
-
value: monthViewStableShim,
|
|
2880
|
-
children: /* @__PURE__ */ jsx(MonthViewStateContext.Provider, {
|
|
2881
|
-
value: monthViewStateShim,
|
|
2882
|
-
children: /* @__PURE__ */ jsx(GridContext.Provider, {
|
|
2883
|
-
value: orientationCtx,
|
|
2884
|
-
children: el
|
|
2885
|
-
})
|
|
2886
|
-
})
|
|
2909
|
+
return /* @__PURE__ */ jsx(GridContext.Provider, {
|
|
2910
|
+
value: orientationCtx,
|
|
2911
|
+
children: el
|
|
2887
2912
|
});
|
|
2888
2913
|
}
|
|
2889
2914
|
const WeeksViewGrid = forwardRef(WeeksViewGridFn);
|
|
2890
2915
|
const gridBodyStateAttributesMapping = { root: () => null };
|
|
2891
2916
|
/** Table body wrapping the week rows. Renders a `<tbody>` by default. */
|
|
2892
2917
|
function GridBodyFn(props, ref) {
|
|
2893
|
-
if (useContext(
|
|
2918
|
+
if (useContext(ViewContext)?.viewType === "weeks") {
|
|
2894
2919
|
const { children, className, style } = props;
|
|
2895
2920
|
return /* @__PURE__ */ jsx(WeeksGrid, {
|
|
2896
2921
|
className,
|
|
@@ -2906,7 +2931,7 @@ function GridBodyFn(props, ref) {
|
|
|
2906
2931
|
const GridBody = forwardRef(GridBodyFn);
|
|
2907
2932
|
function MonthGridBodyFn(props, ref) {
|
|
2908
2933
|
const { render, ...otherProps } = props;
|
|
2909
|
-
const { rootState } =
|
|
2934
|
+
const { rootState } = useViewState();
|
|
2910
2935
|
const state = useMemo(() => ({ root: rootState }), [rootState]);
|
|
2911
2936
|
const defaultProps = { children: props.children ?? /* @__PURE__ */ jsx(WeekTemplate, { children: /* @__PURE__ */ jsx(DayCellTemplate, { children: /* @__PURE__ */ jsx(DayButton, {}) }) }) };
|
|
2912
2937
|
const { children: _children, ...restOtherProps } = otherProps;
|
|
@@ -2928,7 +2953,7 @@ const weekInstanceStateAttributesMapping = {
|
|
|
2928
2953
|
function WeekInstance(props) {
|
|
2929
2954
|
const { render, ...otherProps } = props;
|
|
2930
2955
|
const weekData = useContext(WeekDataContext);
|
|
2931
|
-
const { rootState } =
|
|
2956
|
+
const { rootState } = useViewState();
|
|
2932
2957
|
return useRender({
|
|
2933
2958
|
defaultTagName: "tr",
|
|
2934
2959
|
render,
|
|
@@ -2953,8 +2978,8 @@ function WeekInstance(props) {
|
|
|
2953
2978
|
function WeekTemplate(props) {
|
|
2954
2979
|
const outerWeekData = useContext(WeekDataContext);
|
|
2955
2980
|
const gridMonthCtx = useContext(GridMonthContext);
|
|
2956
|
-
const
|
|
2957
|
-
const weeks = gridMonthCtx?.weeks ??
|
|
2981
|
+
const monthState = useContext(MonthViewStateContext);
|
|
2982
|
+
const weeks = gridMonthCtx?.weeks ?? monthState?.weeks ?? [];
|
|
2958
2983
|
const gridMonth = useMemo(() => gridMonthCtx ? {
|
|
2959
2984
|
year: gridMonthCtx.year,
|
|
2960
2985
|
month: gridMonthCtx.month
|
|
@@ -2997,7 +3022,7 @@ function DateStringFn(props, ref) {
|
|
|
2997
3022
|
const { render, locales, options, ...otherProps } = props;
|
|
2998
3023
|
const { locale, temporal: T, timeZone } = useCalendarStable();
|
|
2999
3024
|
const { selected } = useCalendarState();
|
|
3000
|
-
const { currentDateTime, rootState } =
|
|
3025
|
+
const { currentDateTime, rootState } = useViewState();
|
|
3001
3026
|
const selectedZdt = selectedToZdt(selected, timeZone, T);
|
|
3002
3027
|
const displayDate = selectedZdt ? zdtToNativeDate(selectedZdt) : new Date(currentDateTime.year, currentDateTime.month - 1, 1);
|
|
3003
3028
|
const formatted = displayDate.toLocaleDateString(locales ?? locale, options);
|
|
@@ -3036,7 +3061,7 @@ function TimeStringFn(props, ref) {
|
|
|
3036
3061
|
const { render, locales, options, ...otherProps } = props;
|
|
3037
3062
|
const { locale, temporal: T, timeZone } = useCalendarStable();
|
|
3038
3063
|
const { selected } = useCalendarState();
|
|
3039
|
-
const { rootState } =
|
|
3064
|
+
const { rootState } = useViewState();
|
|
3040
3065
|
const selZdt = selectedToZdt(selected, timeZone, T);
|
|
3041
3066
|
const displayDate = selZdt ? zdtToNativeDate(selZdt) : zdtToNativeDate(T.Now.zonedDateTimeISO(timeZone));
|
|
3042
3067
|
const mergedOptions = {
|
|
@@ -3302,9 +3327,8 @@ function RangeSelectedInnerFn(props, ref) {
|
|
|
3302
3327
|
const { orientation } = useContext(GridContext);
|
|
3303
3328
|
const { temporal: T } = useCalendarStable();
|
|
3304
3329
|
const { rangeStart, rangeEnd } = useCalendarState();
|
|
3305
|
-
const
|
|
3306
|
-
const {
|
|
3307
|
-
const outsideDays = monthStable?.outsideDays ?? "enabled";
|
|
3330
|
+
const { rootState } = useViewState();
|
|
3331
|
+
const { outsideDays } = useViewStable();
|
|
3308
3332
|
const days = weekData?.days ?? [];
|
|
3309
3333
|
const gridMonth = weekData?.gridMonth;
|
|
3310
3334
|
const info = useMemo(() => computeClippedRangeInfo(days, rangeStart, rangeEnd, T, outsideDays, gridMonth), [
|
|
@@ -3377,9 +3401,8 @@ function RangePreviewInnerFn(props, ref) {
|
|
|
3377
3401
|
const { orientation } = useContext(GridContext);
|
|
3378
3402
|
const { temporal: T } = useCalendarStable();
|
|
3379
3403
|
const { previewStart, previewEnd } = useCalendarState();
|
|
3380
|
-
const
|
|
3381
|
-
const {
|
|
3382
|
-
const outsideDays = monthStable?.outsideDays ?? "enabled";
|
|
3404
|
+
const { rootState } = useViewState();
|
|
3405
|
+
const { outsideDays } = useViewStable();
|
|
3383
3406
|
const days = weekData?.days ?? [];
|
|
3384
3407
|
const gridMonth = weekData?.gridMonth;
|
|
3385
3408
|
const info = useMemo(() => computeClippedRangeInfo(days, previewStart, previewEnd, T, outsideDays, gridMonth), [
|
|
@@ -3441,7 +3464,7 @@ const dragHandleStateAttributesMapping = {
|
|
|
3441
3464
|
function useDragHandle(edge, { dragging: draggingProp }) {
|
|
3442
3465
|
const { temporal: T, setHoveredDate, readOnly, disabled } = useCalendarStable();
|
|
3443
3466
|
const { rangeStart, rangeEnd } = useCalendarState();
|
|
3444
|
-
const { rootState } =
|
|
3467
|
+
const { rootState } = useViewState();
|
|
3445
3468
|
const cellData = useContext(DayCellDataContext);
|
|
3446
3469
|
const { orientation } = useContext(GridContext);
|
|
3447
3470
|
const date = cellData?.date;
|
|
@@ -3524,7 +3547,7 @@ const weekNumberCellStateAttributesMapping = {
|
|
|
3524
3547
|
function WeekNumberCellFn(props, ref) {
|
|
3525
3548
|
const { render, ...otherProps } = props;
|
|
3526
3549
|
const weekData = useContext(WeekDataContext);
|
|
3527
|
-
const { rootState } =
|
|
3550
|
+
const { rootState } = useViewState();
|
|
3528
3551
|
const { temporal: T } = useCalendarStable();
|
|
3529
3552
|
const days = weekData?.days ?? [];
|
|
3530
3553
|
const weekNumber = useMemo(() => {
|
|
@@ -3562,7 +3585,7 @@ const WeekNumberCell = forwardRef(WeekNumberCellFn);
|
|
|
3562
3585
|
const weekNumberHeaderStateAttributesMapping = { root: () => null };
|
|
3563
3586
|
function WeekNumberHeaderFn(props, ref) {
|
|
3564
3587
|
const { render, ...otherProps } = props;
|
|
3565
|
-
const { rootState } =
|
|
3588
|
+
const { rootState } = useViewState();
|
|
3566
3589
|
const state = useMemo(() => ({ root: rootState }), [rootState]);
|
|
3567
3590
|
return useRender({
|
|
3568
3591
|
defaultTagName: "th",
|
|
@@ -4159,6 +4182,14 @@ function useWeeksViewRootState(props) {
|
|
|
4159
4182
|
tabTargetDate,
|
|
4160
4183
|
gridHasFocus
|
|
4161
4184
|
]),
|
|
4185
|
+
viewStableCtx: useMemo(() => ({
|
|
4186
|
+
gridFocusedRef,
|
|
4187
|
+
outsideDays: "enabled"
|
|
4188
|
+
}), []),
|
|
4189
|
+
viewStateCtx: useMemo(() => ({
|
|
4190
|
+
currentDateTime,
|
|
4191
|
+
rootState
|
|
4192
|
+
}), [currentDateTime, rootState]),
|
|
4162
4193
|
scrollToWeek
|
|
4163
4194
|
};
|
|
4164
4195
|
}
|
|
@@ -4166,42 +4197,16 @@ function useWeeksViewRootState(props) {
|
|
|
4166
4197
|
//#region src/weeks-view.tsx
|
|
4167
4198
|
function WeeksViewRootFn(props, ref) {
|
|
4168
4199
|
const { children } = props;
|
|
4169
|
-
const { stableCtx, stateCtx, viewCtx, scrollToWeek } = useWeeksViewRootState(props);
|
|
4200
|
+
const { stableCtx, stateCtx, viewCtx, viewStableCtx, viewStateCtx, scrollToWeek } = useWeeksViewRootState(props);
|
|
4170
4201
|
useImperativeHandle(ref, () => ({ scrollToWeek }), [scrollToWeek]);
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
setGridLabelId: () => {},
|
|
4180
|
-
gridFocusedRef
|
|
4181
|
-
}), []);
|
|
4182
|
-
const monthViewStateShim = useMemo(() => ({
|
|
4183
|
-
currentMonth: {
|
|
4184
|
-
year: stateCtx.currentDateTime.year,
|
|
4185
|
-
month: stateCtx.currentDateTime.month
|
|
4186
|
-
},
|
|
4187
|
-
weeks: [],
|
|
4188
|
-
allMonths: [],
|
|
4189
|
-
currentDateTime: stateCtx.currentDateTime,
|
|
4190
|
-
gridLabelIds: stateCtx.gridLabelIds,
|
|
4191
|
-
rootState: stateCtx.rootState
|
|
4192
|
-
}), [
|
|
4193
|
-
stateCtx.currentDateTime,
|
|
4194
|
-
stateCtx.gridLabelIds,
|
|
4195
|
-
stateCtx.rootState
|
|
4196
|
-
]);
|
|
4197
|
-
return /* @__PURE__ */ jsx(MonthViewStableContext.Provider, {
|
|
4198
|
-
value: monthViewStableShim,
|
|
4199
|
-
children: /* @__PURE__ */ jsx(MonthViewStateContext.Provider, {
|
|
4200
|
-
value: monthViewStateShim,
|
|
4201
|
-
children: /* @__PURE__ */ jsx(WeeksViewStableContext.Provider, {
|
|
4202
|
-
value: stableCtx,
|
|
4203
|
-
children: /* @__PURE__ */ jsx(WeeksViewStateContext.Provider, {
|
|
4204
|
-
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,
|
|
4205
4210
|
children: /* @__PURE__ */ jsx(ViewContext.Provider, {
|
|
4206
4211
|
value: viewCtx,
|
|
4207
4212
|
children
|
|
@@ -4246,7 +4251,7 @@ function useWeeksNavButton(direction, shiftByProp) {
|
|
|
4246
4251
|
const { disabled: globalDisabled, minValue, maxValue, temporal: T, weekStartDay } = useCalendarStable();
|
|
4247
4252
|
const { weekCount, outOfRangeBehavior, goNext, goPrev } = useWeeksViewStable();
|
|
4248
4253
|
const { windowInfo } = useWeeksViewState();
|
|
4249
|
-
const { rootState } =
|
|
4254
|
+
const { rootState } = useViewState();
|
|
4250
4255
|
const currentFirstWeek = windowInfo.windowStart;
|
|
4251
4256
|
const isDisabled = useMemo(() => {
|
|
4252
4257
|
if (globalDisabled) return true;
|
|
@@ -4332,7 +4337,7 @@ const NextWeeksButton = forwardRef(NextWeeksButtonFn);
|
|
|
4332
4337
|
function WeekCountFn(props, ref) {
|
|
4333
4338
|
const { render, ...otherProps } = props;
|
|
4334
4339
|
const { windowInfo } = useWeeksViewState();
|
|
4335
|
-
const { rootState } =
|
|
4340
|
+
const { rootState } = useViewState();
|
|
4336
4341
|
const count = windowInfo.weekCount;
|
|
4337
4342
|
const state = useMemo(() => ({
|
|
4338
4343
|
root: rootState,
|