@klinking/colander 0.0.0 → 2.0.1

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 (93) hide show
  1. package/dist/formats/date.cjs +51 -48
  2. package/dist/formats/date.d.cts +10 -37
  3. package/dist/formats/date.d.mts +10 -37
  4. package/dist/formats/date.mjs +6 -2
  5. package/dist/formats/object.cjs +51 -48
  6. package/dist/formats/object.d.cts +10 -37
  7. package/dist/formats/object.d.mts +10 -37
  8. package/dist/formats/object.mjs +6 -2
  9. package/dist/formats/plain-date-time.cjs +51 -48
  10. package/dist/formats/plain-date-time.d.cts +10 -37
  11. package/dist/formats/plain-date-time.d.mts +10 -37
  12. package/dist/formats/plain-date-time.mjs +6 -2
  13. package/dist/formats/plain-date.cjs +51 -48
  14. package/dist/formats/plain-date.d.cts +10 -37
  15. package/dist/formats/plain-date.d.mts +10 -37
  16. package/dist/formats/plain-date.mjs +6 -2
  17. package/dist/formats/plain-month-day.cjs +51 -48
  18. package/dist/formats/plain-month-day.d.cts +10 -37
  19. package/dist/formats/plain-month-day.d.mts +10 -37
  20. package/dist/formats/plain-month-day.mjs +6 -2
  21. package/dist/formats/plain-year-month.cjs +51 -48
  22. package/dist/formats/plain-year-month.d.cts +10 -37
  23. package/dist/formats/plain-year-month.d.mts +10 -37
  24. package/dist/formats/plain-year-month.mjs +6 -2
  25. package/dist/formats/zoned-date-time.cjs +51 -48
  26. package/dist/formats/zoned-date-time.d.cts +10 -37
  27. package/dist/formats/zoned-date-time.d.mts +10 -37
  28. package/dist/formats/zoned-date-time.mjs +6 -2
  29. package/dist/index.cjs +47 -48
  30. package/dist/index.d.cts +11 -2
  31. package/dist/index.d.mts +11 -2
  32. package/dist/index.mjs +2 -2
  33. package/dist/{temporal-polyfill-DTx0VIX5.mjs → weeks-navigation-B-Nch3LS.mjs} +357 -562
  34. package/dist/{temporal-polyfill-DU8VfleL.cjs → weeks-navigation-FxcECgCR.cjs} +357 -568
  35. package/dist/{weeks-view-context-BN6qR-83.d.mts → weeks-view-context-BZeWx9N8.d.cts} +275 -258
  36. package/dist/{weeks-view-context-aHGgYkpt.d.cts → weeks-view-context-MVe1b-BS.d.mts} +275 -258
  37. package/package.json +20 -20
  38. package/src/calendar-context.ts +12 -5
  39. package/src/calendar-provider.test.tsx +18 -4
  40. package/src/calendar-provider.tsx +130 -35
  41. package/src/calendar-types.ts +21 -4
  42. package/src/compute-weeks-in-window.test.ts +9 -7
  43. package/src/context.ts +1 -1
  44. package/src/day-cell.test.tsx +109 -0
  45. package/src/day-cell.tsx +132 -49
  46. package/src/drag-handle.tsx +23 -24
  47. package/src/formats/date.ts +120 -56
  48. package/src/formats/formats.test.ts +8 -4
  49. package/src/formats/object.ts +120 -56
  50. package/src/formats/plain-date-time.ts +120 -56
  51. package/src/formats/plain-date.ts +120 -56
  52. package/src/formats/plain-month-day.ts +120 -56
  53. package/src/formats/plain-year-month.ts +120 -56
  54. package/src/formats/zoned-date-time.ts +120 -56
  55. package/src/grid-header.tsx +24 -18
  56. package/src/grid.event-perf.test.tsx +30 -13
  57. package/src/grid.perf.test.tsx +97 -33
  58. package/src/grid.tsx +75 -43
  59. package/src/index.ts +16 -4
  60. package/src/keyboard.test.ts +110 -42
  61. package/src/keyboard.ts +18 -7
  62. package/src/month-separator.test.tsx +3 -1
  63. package/src/month-separator.tsx +30 -9
  64. package/src/month-view-context.ts +8 -3
  65. package/src/month-view-types.ts +14 -10
  66. package/src/month-view.test.tsx +687 -68
  67. package/src/month-view.tsx +176 -71
  68. package/src/navigation.tsx +77 -47
  69. package/src/overflow.test.ts +15 -13
  70. package/src/overflow.ts +10 -2
  71. package/src/range-preview.tsx +37 -12
  72. package/src/resolve-first-week.test.ts +14 -10
  73. package/src/resolve-first-week.ts +6 -2
  74. package/src/root-selection.ts +185 -101
  75. package/src/selected-range.tsx +47 -22
  76. package/src/test-temporal.ts +0 -2
  77. package/src/types.ts +126 -103
  78. package/src/utils.bench.ts +30 -6
  79. package/src/utils.test.ts +203 -55
  80. package/src/utils.ts +156 -54
  81. package/src/view-context.ts +4 -1
  82. package/src/week-number.tsx +5 -8
  83. package/src/weeks-grid.tsx +45 -19
  84. package/src/weeks-keyboard.test.ts +6 -7
  85. package/src/weeks-keyboard.ts +8 -3
  86. package/src/weeks-navigation.tsx +21 -9
  87. package/src/weeks-view-context.ts +8 -3
  88. package/src/weeks-view-state.ts +100 -33
  89. package/src/weeks-view-types.ts +14 -8
  90. package/src/weeks-view.test.tsx +127 -19
  91. package/src/weeks-view.tsx +30 -12
  92. package/src/temporal-polyfill.test.ts +0 -317
  93. package/src/temporal-polyfill.ts +0 -566
@@ -6,7 +6,9 @@ import { temporalVariants } from "./test-temporal";
6
6
  describe.each(temporalVariants)("computeNextFocusDate ($name)", ({ T }) => {
7
7
  const d = (iso: string) => T.PlainDate.from(iso);
8
8
 
9
- function nav(overrides: Partial<KeyboardNavInput> & { key: string }): KeyboardNavInput {
9
+ function nav(
10
+ overrides: Partial<KeyboardNavInput> & { key: string },
11
+ ): KeyboardNavInput {
10
12
  return {
11
13
  shiftKey: false,
12
14
  focusedDate: d("2026-03-15"),
@@ -114,9 +116,15 @@ describe.each(temporalVariants)("computeNextFocusDate ($name)", ({ T }) => {
114
116
  ["2026-03-15", "2027-03-15"],
115
117
  ["2024-02-29", "2025-02-28"],
116
118
  ["2026-12-31", "2027-12-31"],
117
- ] as const)("from %s → %s (day constrained for leap year)", (focused, expected) => {
118
- expectMove(nav({ key: "PageDown", shiftKey: true, focusedDate: d(focused) }), expected);
119
- });
119
+ ] as const)(
120
+ "from %s → %s (day constrained for leap year)",
121
+ (focused, expected) => {
122
+ expectMove(
123
+ nav({ key: "PageDown", shiftKey: true, focusedDate: d(focused) }),
124
+ expected,
125
+ );
126
+ },
127
+ );
120
128
  });
121
129
 
122
130
  describe("Shift+PageUp — previous year", () => {
@@ -124,9 +132,15 @@ describe.each(temporalVariants)("computeNextFocusDate ($name)", ({ T }) => {
124
132
  ["2026-03-15", "2025-03-15"],
125
133
  ["2024-02-29", "2023-02-28"],
126
134
  ["2027-01-01", "2026-01-01"],
127
- ] as const)("from %s → %s (day constrained for leap year)", (focused, expected) => {
128
- expectMove(nav({ key: "PageUp", shiftKey: true, focusedDate: d(focused) }), expected);
129
- });
135
+ ] as const)(
136
+ "from %s → %s (day constrained for leap year)",
137
+ (focused, expected) => {
138
+ expectMove(
139
+ nav({ key: "PageUp", shiftKey: true, focusedDate: d(focused) }),
140
+ expected,
141
+ );
142
+ },
143
+ );
130
144
  });
131
145
 
132
146
  describe("Enter and Space — select", () => {
@@ -161,9 +175,12 @@ describe.each(temporalVariants)("computeNextFocusDate ($name)", ({ T }) => {
161
175
  });
162
176
 
163
177
  describe("unrecognized keys return none", () => {
164
- it.each(["Tab", "Escape", "a", "Delete", "F1"] as const)("%s returns none", (key) => {
165
- expectNone(nav({ key }));
166
- });
178
+ it.each(["Tab", "Escape", "a", "Delete", "F1"] as const)(
179
+ "%s returns none",
180
+ (key) => {
181
+ expectNone(nav({ key }));
182
+ },
183
+ );
167
184
  });
168
185
 
169
186
  describe("min bound clamping", () => {
@@ -173,16 +190,25 @@ describe.each(temporalVariants)("computeNextFocusDate ($name)", ({ T }) => {
173
190
  ["ArrowLeft", "2026-03-10"],
174
191
  ["ArrowUp", "2026-03-10"],
175
192
  ["Home", "2026-03-10"],
176
- ] as const)("%s from %s is none (already at min boundary)", (key, focused) => {
177
- expectNone(nav({ key, focusedDate: d(focused), minValue: min }));
178
- });
193
+ ] as const)(
194
+ "%s from %s is none (already at min boundary)",
195
+ (key, focused) => {
196
+ expectNone(nav({ key, focusedDate: d(focused), minValue: min }));
197
+ },
198
+ );
179
199
 
180
200
  it.each([
181
201
  ["ArrowLeft", "2026-03-11", "2026-03-10"],
182
202
  ["ArrowRight", "2026-03-10", "2026-03-11"],
183
- ] as const)("%s from %s → %s (at or above min)", (key, focused, expected) => {
184
- expectMove(nav({ key, focusedDate: d(focused), minValue: min }), expected);
185
- });
203
+ ] as const)(
204
+ "%s from %s → %s (at or above min)",
205
+ (key, focused, expected) => {
206
+ expectMove(
207
+ nav({ key, focusedDate: d(focused), minValue: min }),
208
+ expected,
209
+ );
210
+ },
211
+ );
186
212
 
187
213
  it("ArrowUp clamps to min when target is below min", () => {
188
214
  expectMove(
@@ -192,7 +218,10 @@ describe.each(temporalVariants)("computeNextFocusDate ($name)", ({ T }) => {
192
218
  });
193
219
 
194
220
  it("Home clamps to min when start-of-week is below min", () => {
195
- expectMove(nav({ key: "Home", focusedDate: d("2026-03-12"), minValue: min }), "2026-03-10");
221
+ expectMove(
222
+ nav({ key: "Home", focusedDate: d("2026-03-12"), minValue: min }),
223
+ "2026-03-10",
224
+ );
196
225
  });
197
226
 
198
227
  it("PageUp clamps to min when target month is before min", () => {
@@ -236,16 +265,25 @@ describe.each(temporalVariants)("computeNextFocusDate ($name)", ({ T }) => {
236
265
  ["ArrowRight", "2026-03-20"],
237
266
  ["ArrowDown", "2026-03-20"],
238
267
  ["End", "2026-03-20"],
239
- ] as const)("%s from %s is none (already at max boundary)", (key, focused) => {
240
- expectNone(nav({ key, focusedDate: d(focused), maxValue: max }));
241
- });
268
+ ] as const)(
269
+ "%s from %s is none (already at max boundary)",
270
+ (key, focused) => {
271
+ expectNone(nav({ key, focusedDate: d(focused), maxValue: max }));
272
+ },
273
+ );
242
274
 
243
275
  it.each([
244
276
  ["ArrowRight", "2026-03-19", "2026-03-20"],
245
277
  ["ArrowLeft", "2026-03-20", "2026-03-19"],
246
- ] as const)("%s from %s → %s (at or below max)", (key, focused, expected) => {
247
- expectMove(nav({ key, focusedDate: d(focused), maxValue: max }), expected);
248
- });
278
+ ] as const)(
279
+ "%s from %s → %s (at or below max)",
280
+ (key, focused, expected) => {
281
+ expectMove(
282
+ nav({ key, focusedDate: d(focused), maxValue: max }),
283
+ expected,
284
+ );
285
+ },
286
+ );
249
287
 
250
288
  it("ArrowDown clamps to max when target exceeds max", () => {
251
289
  expectMove(
@@ -259,7 +297,10 @@ describe.each(temporalVariants)("computeNextFocusDate ($name)", ({ T }) => {
259
297
  });
260
298
 
261
299
  it("End clamps to max when end-of-week exceeds max", () => {
262
- expectMove(nav({ key: "End", focusedDate: d("2026-03-16"), maxValue: max }), "2026-03-20");
300
+ expectMove(
301
+ nav({ key: "End", focusedDate: d("2026-03-16"), maxValue: max }),
302
+ "2026-03-20",
303
+ );
263
304
  });
264
305
 
265
306
  it("PageDown clamps to max when target month exceeds max", () => {
@@ -396,18 +437,25 @@ describe.each(temporalVariants)("computeNextFocusDate ($name)", ({ T }) => {
396
437
  });
397
438
 
398
439
  describe("readOnly suppresses select but allows move", () => {
399
- it.each(["Enter", " "] as const)("%s returns none when readOnly", (key) => {
400
- expectNone(nav({ key, readOnly: true }));
401
- });
402
-
403
- it.each(["ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown", "PageUp", "PageDown"] as const)(
404
- "%s still works when readOnly",
440
+ it.each(["Enter", " "] as const)(
441
+ "%s returns none when readOnly",
405
442
  (key) => {
406
- const result = computeNextFocusDate(nav({ key, readOnly: true }));
407
- expect(result.action).toBe("move");
443
+ expectNone(nav({ key, readOnly: true }));
408
444
  },
409
445
  );
410
446
 
447
+ it.each([
448
+ "ArrowRight",
449
+ "ArrowLeft",
450
+ "ArrowUp",
451
+ "ArrowDown",
452
+ "PageUp",
453
+ "PageDown",
454
+ ] as const)("%s still works when readOnly", (key) => {
455
+ const result = computeNextFocusDate(nav({ key, readOnly: true }));
456
+ expect(result.action).toBe("move");
457
+ });
458
+
411
459
  it("Home still works when readOnly (from mid-week)", () => {
412
460
  const result = computeNextFocusDate(
413
461
  nav({ key: "Home", readOnly: true, focusedDate: d("2026-03-18") }),
@@ -429,24 +477,40 @@ describe.each(temporalVariants)("computeNextFocusDate ($name)", ({ T }) => {
429
477
  ["2026-03-18", "2026-03-16"],
430
478
  ["2026-03-21", "2026-03-16"],
431
479
  ["2026-03-22", "2026-03-16"],
432
- ] as const)("Home from %s → %s (Monday start of week)", (focused, expected) => {
433
- expectMove(nav({ key: "Home", focusedDate: d(focused), weekStartDay: 1 }), expected);
434
- });
480
+ ] as const)(
481
+ "Home from %s → %s (Monday start of week)",
482
+ (focused, expected) => {
483
+ expectMove(
484
+ nav({ key: "Home", focusedDate: d(focused), weekStartDay: 1 }),
485
+ expected,
486
+ );
487
+ },
488
+ );
435
489
 
436
490
  it("Home from Monday (already at start) → none", () => {
437
- expectNone(nav({ key: "Home", focusedDate: d("2026-03-16"), weekStartDay: 1 }));
491
+ expectNone(
492
+ nav({ key: "Home", focusedDate: d("2026-03-16"), weekStartDay: 1 }),
493
+ );
438
494
  });
439
495
 
440
496
  it.each([
441
497
  ["2026-03-16", "2026-03-22"],
442
498
  ["2026-03-17", "2026-03-22"],
443
499
  ["2026-03-21", "2026-03-22"],
444
- ] as const)("End from %s → %s (Sunday end of week)", (focused, expected) => {
445
- expectMove(nav({ key: "End", focusedDate: d(focused), weekStartDay: 1 }), expected);
446
- });
500
+ ] as const)(
501
+ "End from %s → %s (Sunday end of week)",
502
+ (focused, expected) => {
503
+ expectMove(
504
+ nav({ key: "End", focusedDate: d(focused), weekStartDay: 1 }),
505
+ expected,
506
+ );
507
+ },
508
+ );
447
509
 
448
510
  it("End from Sunday (already at end) → none", () => {
449
- expectNone(nav({ key: "End", focusedDate: d("2026-03-22"), weekStartDay: 1 }));
511
+ expectNone(
512
+ nav({ key: "End", focusedDate: d("2026-03-22"), weekStartDay: 1 }),
513
+ );
450
514
  });
451
515
  });
452
516
 
@@ -459,7 +523,9 @@ describe.each(temporalVariants)("computeNextFocusDate ($name)", ({ T }) => {
459
523
  });
460
524
 
461
525
  it("Home from Saturday (already at start) → none", () => {
462
- expectNone(nav({ key: "Home", focusedDate: d("2026-03-14"), weekStartDay: 6 }));
526
+ expectNone(
527
+ nav({ key: "Home", focusedDate: d("2026-03-14"), weekStartDay: 6 }),
528
+ );
463
529
  });
464
530
 
465
531
  it("End from Saturday (2026-03-14) → Friday (2026-03-20)", () => {
@@ -470,7 +536,9 @@ describe.each(temporalVariants)("computeNextFocusDate ($name)", ({ T }) => {
470
536
  });
471
537
 
472
538
  it("End from Friday (already at end) → none", () => {
473
- expectNone(nav({ key: "End", focusedDate: d("2026-03-20"), weekStartDay: 6 }));
539
+ expectNone(
540
+ nav({ key: "End", focusedDate: d("2026-03-20"), weekStartDay: 6 }),
541
+ );
474
542
  });
475
543
  });
476
544
 
package/src/keyboard.ts CHANGED
@@ -58,9 +58,12 @@ function clampToBounds(
58
58
  T: TemporalNamespace,
59
59
  ): KeyboardNavResult {
60
60
  let clamped = target;
61
- if (minValue && T.PlainDate.compare(clamped, minValue) < 0) clamped = minValue;
62
- if (maxValue && T.PlainDate.compare(clamped, maxValue) > 0) clamped = maxValue;
63
- if (T.PlainDate.compare(clamped, focusedDate) === 0) return { action: "none" };
61
+ if (minValue && T.PlainDate.compare(clamped, minValue) < 0)
62
+ clamped = minValue;
63
+ if (maxValue && T.PlainDate.compare(clamped, maxValue) > 0)
64
+ clamped = maxValue;
65
+ if (T.PlainDate.compare(clamped, focusedDate) === 0)
66
+ return { action: "none" };
64
67
  return { action: "move", date: clamped };
65
68
  }
66
69
 
@@ -71,7 +74,9 @@ function clampToBounds(
71
74
  * PageUp/PageDown (±1 month, ±1 year with Shift), and Enter/Space (select).
72
75
  * Results are clamped to `minValue`/`maxValue` bounds.
73
76
  */
74
- export function computeNextFocusDate(input: KeyboardNavInput): KeyboardNavResult {
77
+ export function computeNextFocusDate(
78
+ input: KeyboardNavInput,
79
+ ): KeyboardNavResult {
75
80
  const {
76
81
  key,
77
82
  shiftKey,
@@ -105,18 +110,24 @@ export function computeNextFocusDate(input: KeyboardNavInput): KeyboardNavResult
105
110
  break;
106
111
  case "Home": {
107
112
  const adjustedDow =
108
- ((focusedDate.dayOfWeek % daysInWeek) - weekStartDay + daysInWeek) % daysInWeek;
113
+ ((focusedDate.dayOfWeek % daysInWeek) - weekStartDay + daysInWeek) %
114
+ daysInWeek;
109
115
  nextDate = focusedDate.subtract({ days: adjustedDow });
110
116
  break;
111
117
  }
112
118
  case "End": {
113
119
  const adjustedDow =
114
- ((focusedDate.dayOfWeek % daysInWeek) - weekStartDay + daysInWeek) % daysInWeek;
120
+ ((focusedDate.dayOfWeek % daysInWeek) - weekStartDay + daysInWeek) %
121
+ daysInWeek;
115
122
  nextDate = focusedDate.add({ days: daysInWeek - 1 - adjustedDow });
116
123
  break;
117
124
  }
118
125
  case "PageUp": {
119
- const target = computeMonthJumpTarget(focusedDate, shiftKey ? -12 : -1, T);
126
+ const target = computeMonthJumpTarget(
127
+ focusedDate,
128
+ shiftKey ? -12 : -1,
129
+ T,
130
+ );
120
131
  return clampToBounds(target, focusedDate, minValue, maxValue, T);
121
132
  }
122
133
  case "PageDown": {
@@ -29,7 +29,9 @@ function renderInTable(ui: React.ReactElement, data = mockData) {
29
29
  return render(
30
30
  <table>
31
31
  <tbody>
32
- <MonthSeparatorDataContext.Provider value={data}>{ui}</MonthSeparatorDataContext.Provider>
32
+ <MonthSeparatorDataContext.Provider value={data}>
33
+ {ui}
34
+ </MonthSeparatorDataContext.Provider>
33
35
  </tbody>
34
36
  </table>,
35
37
  );
@@ -37,7 +37,8 @@ export type MonthSeparatorState = {
37
37
  };
38
38
 
39
39
  /** Context providing MonthSeparator data to child components. */
40
- export const MonthSeparatorDataContext = createContext<MonthSeparatorState | null>(null);
40
+ export const MonthSeparatorDataContext =
41
+ createContext<MonthSeparatorState | null>(null);
41
42
 
42
43
  function useMonthSeparatorData(): MonthSeparatorState {
43
44
  const ctx = useContext(MonthSeparatorDataContext);
@@ -58,7 +59,8 @@ const stateAttributesMapping = {
58
59
  weeksVisibleAfter: () => null,
59
60
  firstDayColumn: (v: number) => ({ "data-first-day-column": String(v) }),
60
61
  totalColumns: (v: number) => ({ "data-total-columns": String(v) }),
61
- firstDayVisible: (v: boolean) => (v ? { "data-first-day-visible": "" } : null),
62
+ firstDayVisible: (v: boolean) =>
63
+ v ? { "data-first-day-visible": "" } : null,
62
64
  fullWeeksVisibleAfter: (v: number) => ({
63
65
  "data-full-weeks-visible-after": String(v),
64
66
  }),
@@ -74,7 +76,10 @@ type MonthChildProps = useRender.ComponentProps<"span", MonthSeparatorState> & {
74
76
  format?: "long" | "short" | "narrow";
75
77
  };
76
78
 
77
- function MonthSeparatorMonthFn(props: MonthChildProps, ref: React.ForwardedRef<HTMLSpanElement>) {
79
+ function MonthSeparatorMonthFn(
80
+ props: MonthChildProps,
81
+ ref: React.ForwardedRef<HTMLSpanElement>,
82
+ ) {
78
83
  const { render, locale = "en-US", format = "long", ...otherProps } = props;
79
84
  const data = useMonthSeparatorData();
80
85
 
@@ -99,7 +104,10 @@ const MonthSeparatorMonth = forwardRef(MonthSeparatorMonthFn);
99
104
 
100
105
  type YearChildProps = useRender.ComponentProps<"span", MonthSeparatorState>;
101
106
 
102
- function MonthSeparatorYearFn(props: YearChildProps, ref: React.ForwardedRef<HTMLSpanElement>) {
107
+ function MonthSeparatorYearFn(
108
+ props: YearChildProps,
109
+ ref: React.ForwardedRef<HTMLSpanElement>,
110
+ ) {
103
111
  const { render, ...otherProps } = props;
104
112
  const data = useMonthSeparatorData();
105
113
 
@@ -117,7 +125,10 @@ const MonthSeparatorYear = forwardRef(MonthSeparatorYearFn);
117
125
 
118
126
  // ─── Child: WeekCount ────────────────────────────────────────────────
119
127
 
120
- type WeekCountChildProps = useRender.ComponentProps<"span", MonthSeparatorState>;
128
+ type WeekCountChildProps = useRender.ComponentProps<
129
+ "span",
130
+ MonthSeparatorState
131
+ >;
121
132
 
122
133
  function MonthSeparatorWeekCountFn(
123
134
  props: WeekCountChildProps,
@@ -140,7 +151,10 @@ const MonthSeparatorWeekCount = forwardRef(MonthSeparatorWeekCountFn);
140
151
 
141
152
  // ─── MonthSeparatorRow ──────────────────────────────────────────────
142
153
 
143
- type MonthSeparatorRowProps = useRender.ComponentProps<"tr", MonthSeparatorState>;
154
+ type MonthSeparatorRowProps = useRender.ComponentProps<
155
+ "tr",
156
+ MonthSeparatorState
157
+ >;
144
158
 
145
159
  function MonthSeparatorRowFn(
146
160
  props: MonthSeparatorRowProps,
@@ -159,7 +173,9 @@ function MonthSeparatorRowFn(
159
173
  });
160
174
 
161
175
  return (
162
- <MonthSeparatorDataContext.Provider value={data}>{rendered}</MonthSeparatorDataContext.Provider>
176
+ <MonthSeparatorDataContext.Provider value={data}>
177
+ {rendered}
178
+ </MonthSeparatorDataContext.Provider>
163
179
  );
164
180
  }
165
181
 
@@ -168,7 +184,10 @@ export const MonthSeparatorRow = forwardRef(MonthSeparatorRowFn);
168
184
 
169
185
  // ─── MonthSeparatorCell ─────────────────────────────────────────────
170
186
 
171
- type MonthSeparatorCellProps = useRender.ComponentProps<"td", MonthSeparatorState>;
187
+ type MonthSeparatorCellProps = useRender.ComponentProps<
188
+ "td",
189
+ MonthSeparatorState
190
+ >;
172
191
 
173
192
  function MonthSeparatorCellFn(
174
193
  props: MonthSeparatorCellProps,
@@ -224,7 +243,9 @@ function MonthSeparatorFn(
224
243
  });
225
244
 
226
245
  return (
227
- <MonthSeparatorDataContext.Provider value={data}>{rendered}</MonthSeparatorDataContext.Provider>
246
+ <MonthSeparatorDataContext.Provider value={data}>
247
+ {rendered}
248
+ </MonthSeparatorDataContext.Provider>
228
249
  );
229
250
  }
230
251
 
@@ -1,11 +1,16 @@
1
1
  import { createContext, useContext } from "react";
2
- import type { MonthViewStableContextValue, MonthViewStateContextValue } from "./month-view-types";
2
+ import type {
3
+ MonthViewStableContextValue,
4
+ MonthViewStateContextValue,
5
+ } from "./month-view-types";
3
6
 
4
7
  /** @internal React context for MonthView stable values (config + callbacks). */
5
- export const MonthViewStableContext = createContext<MonthViewStableContextValue | null>(null);
8
+ export const MonthViewStableContext =
9
+ createContext<MonthViewStableContextValue | null>(null);
6
10
 
7
11
  /** @internal React context for MonthView volatile state. */
8
- export const MonthViewStateContext = createContext<MonthViewStateContextValue | null>(null);
12
+ export const MonthViewStateContext =
13
+ createContext<MonthViewStateContextValue | null>(null);
9
14
 
10
15
  /** Returns the MonthView stable context (config + callbacks). */
11
16
  export function useMonthViewStable(): MonthViewStableContextValue {
@@ -12,40 +12,44 @@ export interface MonthViewRootProps {
12
12
  * Number of months to display simultaneously (1–12).
13
13
  * @default 1
14
14
  */
15
- numberOfMonths?: number;
15
+ numberOfMonths?: number | undefined;
16
16
  /**
17
17
  * When `true`, always render 6 week rows per month grid.
18
18
  * Prevents layout shifts when navigating between months.
19
19
  * @default false
20
20
  */
21
- fixedWeeks?: boolean;
21
+ fixedWeeks?: boolean | undefined;
22
22
  /**
23
23
  * Controls how days from adjacent months are displayed.
24
24
  * @default "enabled"
25
25
  */
26
- outsideDays?: OutsideDays;
26
+ outsideDays?: OutsideDays | undefined;
27
27
  /**
28
28
  * How month navigation behaves at `min`/`max` bounds.
29
29
  * - `"unbounded"` — navigation is always allowed.
30
30
  * - `"stop"` — navigation buttons disable at the boundary.
31
31
  * @default "unbounded"
32
32
  */
33
- overflowBehavior?: MonthOverflowBehavior;
33
+ overflowBehavior?: MonthOverflowBehavior | undefined;
34
34
  /**
35
35
  * The controlled visible month. When provided, the component is controlled.
36
+ *
37
+ * Interpreted in the ISO calendar (the year/month are read as ISO values).
38
+ * The `locale` only affects how the month is displayed, so this value
39
+ * round-trips directly with {@link onMonthChange}.
36
40
  */
37
- month?: Temporal.PlainYearMonth;
41
+ month?: Temporal.PlainYearMonth | undefined;
38
42
  /**
39
- * The initial visible month (uncontrolled).
43
+ * The initial visible month (uncontrolled). Interpreted in the ISO calendar.
40
44
  */
41
- defaultMonth?: Temporal.PlainYearMonth;
45
+ defaultMonth?: Temporal.PlainYearMonth | undefined;
42
46
  /**
43
47
  * Called when the visible month changes via navigation or focus movement.
44
- * Not called on initial mount.
48
+ * Not called on initial mount. The argument is an ISO `PlainYearMonth`.
45
49
  */
46
- onMonthChange?: (month: Temporal.PlainYearMonth) => void;
50
+ onMonthChange?: ((month: Temporal.PlainYearMonth) => void) | undefined;
47
51
  /** React children. */
48
- children?: React.ReactNode;
52
+ children?: React.ReactNode | undefined;
49
53
  }
50
54
 
51
55
  // ---------------------------------------------------------------------------