@klinking/colander 3.1.0-alpha.8 → 3.1.0-alpha.9
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-BqzrxYgn.d.cts → index-B5VJ_WF2.d.mts} +2 -8
- package/dist/{index-CkhYFmf4.d.mts → index-BMsxaq1s.d.cts} +2 -8
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{weeks-navigation-CatYJIKb.cjs → weeks-navigation-CUQApLMk.cjs} +438 -290
- package/dist/{weeks-navigation-BWB5OvqW.mjs → weeks-navigation-CWNpF_6M.mjs} +440 -292
- package/package.json +5 -1
- package/src/calendar-provider.tsx +8 -2
- package/src/day-cell-state.ts +0 -70
- package/src/day-cell-store.test.tsx +273 -0
- package/src/day-cell-store.tsx +204 -0
- package/src/day-cell.test.tsx +72 -89
- package/src/day-cell.tsx +93 -78
- package/src/grid.tsx +17 -15
- package/src/month-view.tsx +3 -2
- package/src/store.ts +72 -0
- package/src/view-context.ts +2 -0
- package/src/weeks-grid.tsx +20 -10
- package/src/weeks-view-state.ts +1 -1
- package/src/weeks-view.tsx +2 -1
package/src/weeks-grid.tsx
CHANGED
|
@@ -241,6 +241,22 @@ export function WeeksGrid(props: {
|
|
|
241
241
|
return map;
|
|
242
242
|
}, [monthBoundaries]);
|
|
243
243
|
|
|
244
|
+
// Per-row context values, built once per set of weeks so a focus or
|
|
245
|
+
// selection change leaves the day cells' context untouched.
|
|
246
|
+
const rowValues = useMemo(
|
|
247
|
+
() =>
|
|
248
|
+
weeks.map((week, i) => {
|
|
249
|
+
const days = weekDaysArrays[i] ?? [];
|
|
250
|
+
return {
|
|
251
|
+
// gridRowIndex: 1-based row index in the CSS grid (header is row 1,
|
|
252
|
+
// weeks start at row 2).
|
|
253
|
+
weekData: { days, weekIndex: week.weekIndex, gridRowIndex: i + 2 },
|
|
254
|
+
gridMonth: { weeks: [days], year: week.year, month: week.month },
|
|
255
|
+
};
|
|
256
|
+
}),
|
|
257
|
+
[weeks, weekDaysArrays],
|
|
258
|
+
);
|
|
259
|
+
|
|
244
260
|
const rows: React.ReactNode[] = [];
|
|
245
261
|
|
|
246
262
|
for (const [i, week] of weeks.entries()) {
|
|
@@ -263,20 +279,14 @@ export function WeeksGrid(props: {
|
|
|
263
279
|
}
|
|
264
280
|
|
|
265
281
|
// Provide WeekDataContext so DayCellTemplate and children work.
|
|
266
|
-
|
|
267
|
-
|
|
282
|
+
const rowValue = rowValues[i];
|
|
283
|
+
if (rowValue === undefined) continue;
|
|
268
284
|
rows.push(
|
|
269
285
|
<WeekDataContext.Provider
|
|
270
286
|
key={week.startDate.toString()}
|
|
271
|
-
value={
|
|
287
|
+
value={rowValue.weekData}
|
|
272
288
|
>
|
|
273
|
-
<GridMonthContext.Provider
|
|
274
|
-
value={{
|
|
275
|
-
weeks: [days],
|
|
276
|
-
year: week.year,
|
|
277
|
-
month: week.month,
|
|
278
|
-
}}
|
|
279
|
-
>
|
|
289
|
+
<GridMonthContext.Provider value={rowValue.gridMonth}>
|
|
280
290
|
{weekRowChildren}
|
|
281
291
|
</GridMonthContext.Provider>
|
|
282
292
|
</WeekDataContext.Provider>,
|
package/src/weeks-view-state.ts
CHANGED
|
@@ -441,7 +441,7 @@ export function useWeeksViewRootState(props: WeeksViewRootProps) {
|
|
|
441
441
|
);
|
|
442
442
|
|
|
443
443
|
const viewStableCtx = useMemo<ViewStableContextValue>(
|
|
444
|
-
() => ({ gridFocusedRef, outsideDays: "enabled" }),
|
|
444
|
+
() => ({ gridFocusedRef, outsideDays: "enabled", setFocusedDate }),
|
|
445
445
|
[],
|
|
446
446
|
);
|
|
447
447
|
|
package/src/weeks-view.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef, useImperativeHandle } from "react";
|
|
2
2
|
import { CalendarProvider } from "./calendar-provider";
|
|
3
3
|
import type { CalendarProviderProps } from "./calendar-types";
|
|
4
|
+
import { DayCellStoreProvider } from "./day-cell-store";
|
|
4
5
|
import type { FirstWeekSpec, ScrollToWeekSnap } from "./resolve-first-week";
|
|
5
6
|
import type { ValueFormat } from "./types";
|
|
6
7
|
import {
|
|
@@ -49,7 +50,7 @@ function WeeksViewRootFn(
|
|
|
49
50
|
<ViewStableContext.Provider value={viewStableCtx}>
|
|
50
51
|
<ViewStateContext.Provider value={viewStateCtx}>
|
|
51
52
|
<ViewContext.Provider value={viewCtx}>
|
|
52
|
-
{children}
|
|
53
|
+
<DayCellStoreProvider>{children}</DayCellStoreProvider>
|
|
53
54
|
</ViewContext.Provider>
|
|
54
55
|
</ViewStateContext.Provider>
|
|
55
56
|
</ViewStableContext.Provider>
|