@typescript-calendar-lib/react 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -86,10 +86,12 @@ export function CalendarPanel() {
86
86
  | `year` | `number` | — (required) | Calendar year |
87
87
  | `month` | `number` | — (required) | Month, 1-indexed (`1`–`12`) |
88
88
  | `locale` | `"en" \| "ja" \| "es" \| "de" \| "fr" \| "ko" \| "zh"` | `"en"` | Language |
89
+ | `holidayLocale` | `"en" \| "ja" \| "es" \| "de" \| "fr" \| "ko" \| "zh"` | `"ja"` | Holiday rules; currently only `"ja"` is provided |
89
90
  | `weekStart` | `"sunday" \| "monday"` | `"sunday"` | First day of the week |
90
91
  | `highlight` | `Date` | — | Date to highlight |
91
92
  | `range` | `{ from: Date; to: Date }` | — | Dates to emphasize |
92
93
  | `rangePreview` | `{ from: Date; to: Date }` | — | Candidate range preview (hover preview), rendered with the `is-in-range-preview` class |
94
+ | `isDateDisabled` | `(date: Date) => boolean` | — | Mark dates as non-selectable in interactive mode (`is-disabled` class) |
93
95
  | `today` | `Date` | — | Reference date for "today" styling |
94
96
  | `theme` | `ThemeName \| ReactTheme` | `"default"` | CSS class-based theme |
95
97
  | `colorScheme` | `ColorSchemeName \| ReactColorScheme` | `"default"` | CSS variable-based colors |
@@ -175,7 +177,7 @@ function App() {
175
177
  }
176
178
  ```
177
179
 
178
- `options` also accepts `selectionMode: "single" | "range"` (default `"single"`) and `onMonthChange: (year, month) => void`, called whenever the displayed month changes.
180
+ `options` also accepts `holidayLocale`, `isDateDisabled`, `selectionMode: "single" | "range"` (default `"single"`) and `onMonthChange: (year, month) => void`, called whenever the displayed month changes.
179
181
 
180
182
  ## InteractiveCalendar
181
183
 
@@ -211,7 +213,19 @@ function App() {
211
213
  }
212
214
  ```
213
215
 
214
- It accepts the `useCalendarState` options (`initialYear`, `initialMonth`, `locale`, `weekStart`, `selectionMode`, `highlight`, `range`, `today`, `onMonthChange`) plus the `Calendar` visual props (`theme`, `colorScheme`, `size`, `responsive`, `style`, `cellData`, `renderCell`) and event callbacks (`onDateClick`, `onDateHover`, `onDateLeave`).
216
+ It accepts the `useCalendarState` options (`initialYear`, `initialMonth`, `locale`, `holidayLocale`, `weekStart`, `selectionMode`, `highlight`, `range`, `today`, `isDateDisabled`, `onMonthChange`) plus the `Calendar` visual props (`theme`, `colorScheme`, `size`, `responsive`, `style`, `cellData`, `renderCell`) and event callbacks (`onDateClick`, `onDateHover`, `onDateLeave`).
217
+
218
+ ### Disabled Dates
219
+
220
+ Pass `isDateDisabled` to mark dates as non-selectable. Disabled cells get the `is-disabled` class, cannot receive keyboard focus or be clicked, and `Arrow*` navigation skips over them:
221
+
222
+ ```tsx
223
+ <InteractiveCalendar
224
+ initialYear={2026}
225
+ initialMonth={9}
226
+ isDateDisabled={(date) => date.getDay() === 0} // disable Sundays
227
+ />
228
+ ```
215
229
 
216
230
  ## Range selection
217
231
 
@@ -335,6 +349,7 @@ Available variables:
335
349
  | `--cal-fg` | Foreground |
336
350
  | `--cal-accent` | Accent (highlight) |
337
351
  | `--cal-weekend-fg` | Weekend foreground |
352
+ | `--cal-holiday-fg` | Holiday foreground |
338
353
  | `--cal-border` | Borders |
339
354
  | `--cal-header-bg` | Header background |
340
355
  | `--cal-highlight-bg` | Highlight background |
@@ -343,6 +358,11 @@ Available variables:
343
358
  | `--cal-range-preview-bg` | Range preview background (falls back to `--cal-range-bg`) |
344
359
  | `--cal-today-bg` | Today background |
345
360
  | `--cal-today-fg` | Today foreground |
361
+ | `--cal-selected-bg` | Selected cell background (interactive mode) |
362
+ | `--cal-selected-fg` | Selected cell foreground (interactive mode) |
363
+ | `--cal-disabled-fg` | Disabled cell foreground |
364
+
365
+ `calendar.css` also uses a CSS-only `--cal-hover-bg` (falls back to `--cal-range-bg`) for the interactive hover state; set it with `style` or your own CSS.
346
366
 
347
367
  Pass a custom scheme directly:
348
368
 
@@ -412,18 +432,29 @@ The `style` prop can override any CSS variable or add custom styles:
412
432
  />
413
433
  ```
414
434
 
435
+ ## Accessibility notes
436
+
437
+ - The `<table>` is labelled by the visible `<h2>` heading through `aria-labelledby`, so screen readers announce the same month text you see - exactly once, instead of a duplicated `aria-label`.
438
+ - In interactive mode the heading itself is the live region (`aria-live="polite"` + `aria-atomic="true"`), so navigating to another month is announced (WAI-ARIA APG Date Picker Dialog). The month name is **not** copied into a separate hidden element, which would put it into the accessibility tree twice.
439
+ - In interactive mode the table becomes `role="grid"` with `role="gridcell"` cells; the non-interactive table keeps native table semantics.
440
+ - Padding cells carry the `is-blank` class instead of relying on `td:empty`, so grid lines do not break when a renderer emits stray whitespace or comments inside a cell.
441
+ - Heading `id` values come from React's `useId()`, so several calendars of the same month can coexist on one page without duplicate ids.
442
+ - All colour schemes keep text at 4.5:1 or better against its background; grid borders target 2:1 (decorative), and `prefers-reduced-motion` / `forced-colors` are honoured.
443
+
415
444
  ## Cell Classes
416
445
 
417
- Each day cell gets semantic classes you can target with CSS. The table has an `aria-label`, weekday headers use `scope="col"`, and week-number cells use `th[scope="row"]`. In interactive mode, the grid is exposed as a `role="grid"` table with `role="gridcell"` cells (WAI-ARIA APG calendar pattern): today's cell gets `aria-current="date"`, the selected date gets `aria-selected` on the gridcell and `aria-pressed` on its button, and only the cursor cell is tabbable (`tabIndex=0`, roving tabindex).
446
+ Each day cell gets semantic classes you can target with CSS. The table is labelled by the visible `<h2>` heading via `aria-labelledby`, weekday headers use `scope="col"`, and week-number cells use `th[scope="row"]`. In interactive mode, the grid is exposed as a `role="grid"` table with `role="gridcell"` cells (WAI-ARIA APG calendar pattern): today's cell gets `aria-current="date"`, the selected date gets `aria-selected` on the gridcell and `aria-pressed` on its button, and only the cursor cell is tabbable (`tabIndex=0`, roving tabindex).
418
447
 
419
448
  | Class | When |
420
449
  | :--- | :--- |
421
450
  | `is-weekend` | Saturday or Sunday |
451
+ | `is-holiday` | Holiday per `holidayLocale` (default `"ja"`) |
422
452
  | `is-today` | Matches `today` |
423
453
  | `is-highlight` | Matches `highlight` |
424
454
  | `is-in-range` | Inside `range` |
425
455
  | `is-in-range-preview` | Inside `rangePreview` |
426
456
  | `is-hovered` | Matches `hoveredDate` (interactive mode) |
457
+ | `is-disabled` | Date returned `true` from `isDateDisabled` (interactive mode) |
427
458
 
428
459
  ## Exports
429
460
 
@@ -431,11 +462,16 @@ Each day cell gets semantic classes you can target with CSS. The table has an `a
431
462
  import Calendar, {
432
463
  Calendar,
433
464
  COLOR_SCHEMES,
465
+ getBlankClasses,
466
+ getCellClasses,
467
+ getCellStateClasses,
468
+ getSelectionCellClasses,
469
+ InteractiveCalendar,
470
+ joinCellClassLists,
434
471
  resolveColorScheme,
435
472
  resolveTheme,
436
473
  THEMES,
437
474
  useCalendarState,
438
- InteractiveCalendar,
439
475
  } from "@typescript-calendar-lib/react";
440
476
 
441
477
  import type {
@@ -443,10 +479,12 @@ import type {
443
479
  CalendarProps,
444
480
  CalendarSize,
445
481
  CalendarSizeName,
482
+ CellStateOptions,
446
483
  ColorSchemeName,
447
484
  InteractiveCalendarProps,
448
485
  ReactColorScheme,
449
486
  ReactTheme,
487
+ SelectionCellOptions,
450
488
  ThemeName,
451
489
  UseCalendarStateOptions,
452
490
  UseCalendarStateReturn,
package/dist/calendar.css CHANGED
@@ -2,18 +2,20 @@
2
2
  --cal-bg: #fff;
3
3
  --cal-fg: #1e293b;
4
4
  --cal-accent: #dc2626;
5
- --cal-weekend-fg: #94a3b8;
5
+ --cal-weekend-fg: #586a84;
6
6
  --cal-holiday-fg: #d33;
7
- --cal-border: #e2e8f0;
7
+ --cal-border: #aeb8c6;
8
8
  --cal-header-bg: #f8fafc;
9
9
  --cal-highlight-bg: #dc2626;
10
10
  --cal-highlight-fg: #fff;
11
11
  --cal-range-bg: #fef3c7;
12
+ --cal-range-preview-bg: #fef9c3;
13
+ --cal-hover-bg: #fef9c3;
12
14
  --cal-today-bg: #fff7ed;
13
15
  --cal-today-fg: #c2410c;
14
16
  --cal-selected-bg: #dc2626;
15
17
  --cal-selected-fg: #fff;
16
- --cal-disabled-fg: #cbd5e1;
18
+ --cal-disabled-fg: #5b799d;
17
19
  --cal-cell-w: 2.25rem;
18
20
  --cal-cell-h: 2rem;
19
21
  --cal-font-size: .875rem;
@@ -75,7 +77,6 @@
75
77
 
76
78
  .calendar td.is-disabled {
77
79
  color: var(--cal-disabled-fg, var(--cal-weekend-fg));
78
- opacity: .5;
79
80
  text-decoration: line-through;
80
81
  }
81
82
 
@@ -168,7 +169,7 @@
168
169
  border: 1px solid var(--cal-border);
169
170
  }
170
171
 
171
- .calendar-theme-modern td:empty {
172
+ .calendar-theme-modern td.is-blank {
172
173
  background: none;
173
174
  border-color: #0000;
174
175
  }
@@ -223,11 +224,11 @@
223
224
  border-radius: 999px;
224
225
  }
225
226
 
226
- .calendar-theme-rounded td:empty {
227
+ .calendar-theme-rounded td.is-blank {
227
228
  background: none;
228
229
  }
229
230
 
230
- .calendar-interactive {
231
+ .calendar-interactive:focus:not(:focus-visible) {
231
232
  outline: none;
232
233
  }
233
234
 
@@ -343,8 +344,63 @@
343
344
  @media (width <= 360px) {
344
345
  .calendar-responsive {
345
346
  --cal-cell-w: 1.5rem;
346
- --cal-cell-h: 1.375rem;
347
+ --cal-cell-h: 1.5rem;
347
348
  --cal-font-size: .6875rem;
348
349
  --cal-header-font-size: .875rem;
349
350
  }
350
351
  }
352
+
353
+ .calendar-sr-only {
354
+ clip-path: inset(50%);
355
+ white-space: nowrap;
356
+ border: 0;
357
+ width: 1px;
358
+ height: 1px;
359
+ margin: -1px;
360
+ padding: 0;
361
+ position: absolute;
362
+ overflow: hidden;
363
+ }
364
+
365
+ @media (prefers-reduced-motion: reduce) {
366
+ .calendar-interactive td button.calendar-day-btn {
367
+ transition: none;
368
+ }
369
+
370
+ .calendar-interactive td button.calendar-day-btn:active {
371
+ transform: none;
372
+ }
373
+ }
374
+
375
+ @media (forced-colors: active) {
376
+ .calendar td.is-today, .calendar td.is-highlight, .calendar td.is-in-range, .calendar td.is-in-range-preview {
377
+ color: canvastext;
378
+ forced-color-adjust: none;
379
+ background: canvas;
380
+ }
381
+
382
+ .calendar td.is-in-range, .calendar td.is-in-range-preview {
383
+ border: 1px dashed highlight;
384
+ }
385
+
386
+ .calendar td.is-in-range-preview {
387
+ border-style: dotted;
388
+ }
389
+
390
+ .calendar td.is-selected {
391
+ color: highlighttext;
392
+ forced-color-adjust: none;
393
+ outline-offset: -2px;
394
+ background: highlight;
395
+ outline: 2px solid highlight;
396
+ }
397
+
398
+ .calendar td.is-disabled {
399
+ color: graytext;
400
+ }
401
+
402
+ .calendar td.is-cursor, .calendar-interactive td button.calendar-day-btn:focus-visible {
403
+ outline-offset: -2px;
404
+ outline: 2px solid canvastext;
405
+ }
406
+ }
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
+ import { COLOR_SCHEMES, CalendarCustomSize, CalendarSize, CalendarSizeName, CellStateOptions, ColorSchemeName, SelectionCellOptions, THEMES, ThemeName, WebColorScheme, WebTheme, getBlankClasses, getCellClasses, getCellStateClasses, getSelectionCellClasses, joinCellClassLists, resolveColorScheme, resolveTheme } from "@typescript-calendar-lib/web";
1
2
  import { CalendarCellState, CalendarOptions, DateRange } from "@typescript-calendar-lib/core";
2
- import { COLOR_SCHEMES, CalendarCustomSize, CalendarSize, CalendarSizeName, ColorSchemeName, THEMES, ThemeName, WebColorScheme, WebTheme, resolveColorScheme, resolveTheme } from "@typescript-calendar-lib/web";
3
- import { CalendarState, CalendarStateOptions, Direction, MonthDirection, SelectionMode } from "@typescript-calendar-lib/tui";
4
3
  import { CSSProperties, KeyboardEvent, ReactNode, Ref } from "react";
4
+ import { CalendarState, CalendarStateOptions, Direction, MonthDirection, SelectionMode } from "@typescript-calendar-lib/tui";
5
5
  //#region src/themes.d.ts
6
6
  /** React の見た目定義(web の WebTheme と同一構造) */
7
7
  type ReactTheme = WebTheme;
@@ -135,6 +135,8 @@ interface InteractiveCalendarProps {
135
135
  locale?: CalendarOptions["locale"];
136
136
  holidayLocale?: CalendarOptions["holidayLocale"];
137
137
  weekStart?: CalendarOptions["weekStart"];
138
+ /** 各週の先頭に週番号(ISO/年始基準)を表示する */
139
+ showWeekNumbers?: boolean;
138
140
  /** 選択方式。既定は "single"。範囲選択時はクリックのたびにアンカー→確定→リセットを交互に行う */
139
141
  selectionMode?: SelectionMode;
140
142
  /** ハイライト対象日 */
@@ -178,5 +180,5 @@ interface InteractiveCalendarProps {
178
180
  */
179
181
  export declare function InteractiveCalendar(props: InteractiveCalendarProps): import("react").JSX.Element;
180
182
  //#endregion
181
- export { COLOR_SCHEMES, Calendar as default, type CalendarCustomSize, type CalendarProps, type CalendarSize, type CalendarSizeName, type ColorSchemeName, type InteractiveCalendarProps, type ReactColorScheme, type ReactTheme, THEMES, type ThemeName, type UseCalendarStateOptions, type UseCalendarStateReturn, resolveColorScheme, resolveTheme };
183
+ export { COLOR_SCHEMES, Calendar as default, type CalendarCustomSize, type CalendarProps, type CalendarSize, type CalendarSizeName, type CellStateOptions, type ColorSchemeName, type InteractiveCalendarProps, type ReactColorScheme, type ReactTheme, type SelectionCellOptions, THEMES, type ThemeName, type UseCalendarStateOptions, type UseCalendarStateReturn, getBlankClasses, getCellClasses, getCellStateClasses, getSelectionCellClasses, joinCellClassLists, resolveColorScheme, resolveTheme };
182
184
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,26 +1,8 @@
1
- import { addDays, buildMonthGrid, createDate, getCalendarCellState, getISOWeek, getMonthName, getWeekOfYear, getWeekdayHeaders, isDateInRange, isSameDay, sortRange as buildRangePreview } from "@typescript-calendar-lib/core";
2
- import { COLOR_SCHEMES, THEMES, buildSizeStyle, formatCellLabel, isSizeName, resolveColorScheme, resolveTheme } from "@typescript-calendar-lib/web";
1
+ import { COLOR_SCHEMES, THEMES, buildSizeStyle, formatCellLabel, getBlankClasses, getBlankClasses as getBlankClasses$1, getCellClasses, getCellStateClasses, getCellStateClasses as getCellStateClasses$1, getSelectionCellClasses, getSelectionCellClasses as getSelectionCellClasses$1, isSizeName, joinCellClassLists, joinCellClassLists as joinCellClassLists$1, mergeColorScheme, resolveColorScheme, resolveTheme, uiString } from "@typescript-calendar-lib/web";
2
+ import { addDays, buildMonthGrid, createDate, getCalendarCellState, getISOWeek, getMonthName, getWeekOfYear, getWeekdayHeaders, isSameDay, sortRange as buildRangePreview } from "@typescript-calendar-lib/core";
3
+ import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
3
4
  import { jsx, jsxs } from "react/jsx-runtime";
4
5
  import { clearSelection, createCalendarState, getCursorDate, getSelectedDate, getSelectedRange, goToDate, goToMonth, goToToday, keyToAction, moveCursor, navigateMonth, navigateYear, sameStateOptions, selectDate, selectDateAt, selectRange, setCursorToDate, updateStateOptions } from "@typescript-calendar-lib/tui";
5
- import { useCallback, useEffect, useRef, useState } from "react";
6
- //#region src/cell-classes.ts
7
- /** 日付セルの状態(週末・今日・ハイライト・範囲・選択・カーソル)に応じた CSS クラスを組み立てる */
8
- function getCellClasses(date, options) {
9
- const state = getCalendarCellState(date, options);
10
- const classes = [];
11
- if (state.isWeekend) classes.push("is-weekend");
12
- if (state.isHoliday) classes.push("is-holiday");
13
- if (state.isToday) classes.push("is-today");
14
- if (state.isHighlight) classes.push("is-highlight");
15
- if (state.isInRange) classes.push("is-in-range");
16
- if (options.rangePreview !== void 0 && isDateInRange(date, options.rangePreview)) classes.push("is-in-range-preview");
17
- if (state.isDisabled) classes.push("is-disabled");
18
- if (options.hoveredDate != null && isSameDay(date, options.hoveredDate)) classes.push("is-hovered");
19
- if (options.selected != null && isSameDay(date, options.selected)) classes.push("is-selected");
20
- if (options.cursorDate != null && isSameDay(date, options.cursorDate)) classes.push("is-cursor");
21
- return classes.join(" ");
22
- }
23
- //#endregion
24
6
  //#region src/size.ts
25
7
  /** セルサイズを CSS 変数スタイル(--cal-cell-w / --cal-cell-h)へ変換する */
26
8
  function buildSizeStyle$1(size) {
@@ -30,7 +12,22 @@ function buildSizeStyle$1(size) {
30
12
  //#region src/Calendar.tsx
31
13
  /** 月カレンダーコンポーネント */
32
14
  function Calendar({ year, month, locale = "en", holidayLocale, weekStart = "sunday", showWeekNumbers = false, highlight, range, today, theme = "default", colorScheme = "default", size = "md", responsive = false, style, interactive = false, onDateClick, onDateHover, onDateLeave, onKeyDown, selectedDate = null, cursorDate = null, hoveredDate = null, renderCell, cellData, isDateDisabled, rangePreview, ref }) {
33
- const cellDate = (day) => createDate(year, month - 1, day);
15
+ const grid = useMemo(() => buildMonthGrid(year, month, weekStart), [
16
+ year,
17
+ month,
18
+ weekStart
19
+ ]);
20
+ const handleCellClick = (date, data) => {
21
+ if (interactive && onDateClick) onDateClick(date, data);
22
+ };
23
+ const handleCellHover = (date) => {
24
+ if (interactive && onDateHover) onDateHover(date);
25
+ };
26
+ const handleMouseLeave = () => {
27
+ if (interactive && onDateLeave) onDateLeave();
28
+ };
29
+ const title = `${getMonthName(locale, month)} ${year}`;
30
+ const weekLabel = uiString("weekNumber", locale);
34
31
  const weekOf = (row) => {
35
32
  const firstIdx = row.findIndex((d) => d !== null);
36
33
  if (firstIdx === -1) return null;
@@ -38,93 +35,86 @@ function Calendar({ year, month, locale = "en", holidayLocale, weekStart = "sund
38
35
  const weekStartDate = addDays(firstDate, -firstIdx);
39
36
  return weekStart === "monday" ? getISOWeek(weekStartDate) : getWeekOfYear(weekStartDate);
40
37
  };
41
- const className = (day) => getCellClasses(cellDate(day), {
42
- today,
43
- holidayLocale,
44
- highlight,
45
- range,
46
- rangePreview,
47
- hoveredDate,
48
- selected: selectedDate,
49
- cursorDate,
50
- isDateDisabled
51
- }) || void 0;
52
- const handleCellClick = (day) => {
53
- if (interactive && onDateClick) {
54
- const date = cellDate(day);
55
- onDateClick(date, cellData?.(date));
56
- }
57
- };
58
- const handleCellHover = (day) => {
59
- if (interactive && onDateHover) onDateHover(cellDate(day));
60
- };
61
- const handleMouseLeave = () => {
62
- if (interactive && onDateLeave) onDateLeave();
63
- };
64
- const title = `${getMonthName(locale, month)} ${year}`;
65
38
  const gridRole = interactive ? "grid" : void 0;
66
39
  const cellRole = interactive ? "gridcell" : void 0;
40
+ const headingId = useId();
67
41
  return /* @__PURE__ */ jsxs("div", {
68
42
  ref,
69
43
  className: `calendar ${resolveTheme(theme).className}${isSizeName(size) ? ` calendar-size-${size}` : ""}${interactive ? " calendar-interactive" : ""}${responsive ? " calendar-responsive" : ""}`,
70
44
  onMouseLeave: interactive ? handleMouseLeave : void 0,
71
45
  style: {
72
- ...resolveColorScheme(colorScheme),
46
+ ...mergeColorScheme(colorScheme),
73
47
  ...buildSizeStyle$1(size),
74
48
  ...style
75
49
  },
76
50
  children: [/* @__PURE__ */ jsx("div", {
77
51
  className: "calendar-header",
78
- children: /* @__PURE__ */ jsx("h2", { children: title })
52
+ children: /* @__PURE__ */ jsx("h2", {
53
+ id: headingId,
54
+ "aria-live": gridRole ? "polite" : void 0,
55
+ "aria-atomic": gridRole ? "true" : void 0,
56
+ children: title
57
+ })
79
58
  }), /* @__PURE__ */ jsxs("table", {
80
59
  role: gridRole,
81
- "aria-label": title,
60
+ "aria-labelledby": headingId,
82
61
  onKeyDown,
83
62
  children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [showWeekNumbers && /* @__PURE__ */ jsx("th", {
84
63
  className: "calendar-week",
85
64
  scope: "col",
86
- "aria-label": "Week number"
65
+ "aria-label": uiString("weekNumber", locale)
87
66
  }, "week"), getWeekdayHeaders(locale, weekStart).map((day) => /* @__PURE__ */ jsx("th", {
88
67
  scope: "col",
89
68
  children: day
90
- }, day))] }) }), /* @__PURE__ */ jsx("tbody", { children: buildMonthGrid(year, month, weekStart).map((row, i) => {
69
+ }, day))] }) }), /* @__PURE__ */ jsx("tbody", { children: grid.map((row, i) => {
91
70
  if (row.every((d) => d === null)) return null;
92
71
  const week = weekOf(row);
93
72
  return /* @__PURE__ */ jsxs("tr", { children: [showWeekNumbers && week !== null && /* @__PURE__ */ jsx("th", {
94
73
  className: "calendar-week",
95
74
  scope: "row",
75
+ "aria-label": `${weekLabel} ${week}`,
96
76
  children: week
97
77
  }, "week"), row.map((day, j) => {
98
- if (day === null) return /* @__PURE__ */ jsx("td", { role: cellRole }, j);
99
- const date = cellDate(day);
78
+ if (day === null) return /* @__PURE__ */ jsx("td", {
79
+ role: cellRole,
80
+ className: getBlankClasses$1()
81
+ }, `b-${j}`);
82
+ const date = createDate(year, month - 1, day);
100
83
  const state = getCalendarCellState(date, {
101
84
  today,
85
+ holidayLocale,
102
86
  highlight,
103
87
  range,
104
88
  isDateDisabled
105
89
  });
106
- const data = cellData?.(date);
90
+ const className = joinCellClassLists$1(getCellStateClasses$1(state), getSelectionCellClasses$1(date, {
91
+ rangePreview,
92
+ hoveredDate,
93
+ selected: selectedDate,
94
+ cursorDate
95
+ })) || void 0;
107
96
  const selected = selectedDate !== null && isSameDay(date, selectedDate);
108
97
  const cursor = cursorDate !== null && isSameDay(date, cursorDate);
98
+ const onClick = interactive && !state.isDisabled ? () => handleCellClick(date, cellData?.(date)) : void 0;
99
+ const onEnter = interactive && !state.isDisabled ? () => handleCellHover(date) : void 0;
109
100
  return /* @__PURE__ */ jsx("td", {
110
101
  role: cellRole,
111
- tabIndex: interactive ? -1 : void 0,
112
- className: className(day),
102
+ className,
113
103
  "aria-selected": selected || void 0,
114
104
  "aria-current": state.isToday ? "date" : void 0,
115
105
  "aria-disabled": state.isDisabled || void 0,
116
106
  children: interactive ? /* @__PURE__ */ jsx("button", {
117
107
  type: "button",
118
108
  className: "calendar-day-btn",
119
- onClick: state.isDisabled ? void 0 : () => handleCellClick(day),
120
- onMouseEnter: state.isDisabled ? void 0 : () => handleCellHover(day),
109
+ onClick,
110
+ onMouseEnter: onEnter,
121
111
  tabIndex: cursor ? 0 : -1,
122
112
  "data-cursor": cursor ? "true" : void 0,
123
113
  "aria-label": formatCellLabel(locale, year, month, day),
124
114
  "aria-pressed": selected,
125
115
  disabled: state.isDisabled,
126
- children: renderCell ? renderCell(day, date, state, data) : day
127
- }) : renderCell ? renderCell(day, date, state, data) : day
116
+ children: renderCell ? renderCell(day, date, state, cellData?.(date)) : day
117
+ }) : renderCell ? renderCell(day, date, state, cellData?.(date)) : day
128
118
  }, `d-${day}`);
129
119
  })] }, i);
130
120
  }) })]
@@ -205,7 +195,7 @@ function useCalendarState(options = {}) {
205
195
  * Enter/Space(クリックと同じ日付選択)
206
196
  */
207
197
  function InteractiveCalendar(props) {
208
- const { initialYear, initialMonth, locale, holidayLocale, weekStart, selectionMode, highlight, range, today, isDateDisabled, onMonthChange, theme, colorScheme, size, responsive, style, renderCell, cellData, onDateClick, onDateHover, onDateLeave } = props;
198
+ const { initialYear, initialMonth, locale, holidayLocale, weekStart, showWeekNumbers, selectionMode, highlight, range, today, isDateDisabled, onMonthChange, theme, colorScheme, size, responsive, style, renderCell, cellData, onDateClick, onDateHover, onDateLeave } = props;
209
199
  const hook = useCalendarState({
210
200
  initialYear,
211
201
  initialMonth,
@@ -266,6 +256,7 @@ function InteractiveCalendar(props) {
266
256
  locale: state.options.locale,
267
257
  holidayLocale: state.options.holidayLocale,
268
258
  weekStart: state.options.weekStart,
259
+ showWeekNumbers,
269
260
  highlight: state.options.highlight,
270
261
  range: state.options.range,
271
262
  today: state.options.today,
@@ -289,6 +280,6 @@ function InteractiveCalendar(props) {
289
280
  });
290
281
  }
291
282
  //#endregion
292
- export { COLOR_SCHEMES, Calendar, Calendar as default, InteractiveCalendar, THEMES, resolveColorScheme, resolveTheme, useCalendarState };
283
+ export { COLOR_SCHEMES, Calendar, Calendar as default, InteractiveCalendar, THEMES, getBlankClasses, getCellClasses, getCellStateClasses, getSelectionCellClasses, joinCellClassLists, resolveColorScheme, resolveTheme, useCalendarState };
293
284
 
294
285
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["buildSizeStyle","buildSizeStyleBase","buildSizeStyle"],"sources":["../src/cell-classes.ts","../src/size.ts","../src/Calendar.tsx","../src/hooks.ts","../src/interactive.tsx"],"sourcesContent":["import type { Locale } from \"@typescript-calendar-lib/core\";\nimport {\n getCalendarCellState,\n isDateInRange,\n isSameDay,\n} from \"@typescript-calendar-lib/core\";\n\n// ─── セル状態クラス ───────────────────────────────────────\n\nexport interface CellStateOptions {\n today?: Date;\n /** 祝日の判定に使うロケール。省略時は \"ja\" */\n holidayLocale?: Locale;\n highlight?: Date;\n range?: { from: Date; to: Date };\n /** 範囲プレビュー(ホバー等の候補範囲)。is-in-range-preview クラスになる */\n rangePreview?: { from: Date; to: Date };\n /** ホバー中の日付。is-hovered クラスになる */\n hoveredDate?: Date | null;\n /** 選択済み日付。該当セルに is-selected クラスが付く */\n selected?: Date | null;\n /** カーソル位置の日付。該当セルに is-cursor クラスが付く */\n cursorDate?: Date | null;\n /** 選択不可日付の判定。該当セルに is-disabled クラスが付く */\n isDateDisabled?: (date: Date) => boolean;\n}\n\n// 範囲の from > to は不正入力として RangeError(isDateInRange が検証する)\n\n/** 日付セルの状態(週末・今日・ハイライト・範囲・選択・カーソル)に応じた CSS クラスを組み立てる */\nexport function getCellClasses(date: Date, options: CellStateOptions): string {\n const state = getCalendarCellState(date, options);\n const classes: string[] = [];\n if (state.isWeekend) classes.push(\"is-weekend\");\n if (state.isHoliday) classes.push(\"is-holiday\");\n if (state.isToday) classes.push(\"is-today\");\n if (state.isHighlight) classes.push(\"is-highlight\");\n if (state.isInRange) classes.push(\"is-in-range\");\n if (\n options.rangePreview !== undefined &&\n isDateInRange(date, options.rangePreview)\n )\n classes.push(\"is-in-range-preview\");\n if (state.isDisabled) classes.push(\"is-disabled\");\n if (options.hoveredDate != null && isSameDay(date, options.hoveredDate))\n classes.push(\"is-hovered\");\n if (options.selected != null && isSameDay(date, options.selected))\n classes.push(\"is-selected\");\n if (options.cursorDate != null && isSameDay(date, options.cursorDate))\n classes.push(\"is-cursor\");\n return classes.join(\" \");\n}\n","// ─── セルサイズ ───────────────────────────────────────────\n// サイズ判定・CSS 変数変換は web パッケージに集約済み。\n// ここでは React の style 型(CSSProperties)に適合させる薄いアダプタのみ持つ。\n\nimport type { CalendarSize } from \"@typescript-calendar-lib/web\";\nimport type { CSSProperties } from \"react\";\n\nexport type {\n CalendarCustomSize,\n CalendarSize,\n CalendarSizeName,\n} from \"@typescript-calendar-lib/web\";\nexport { isSizeName } from \"@typescript-calendar-lib/web\";\n\nimport { buildSizeStyle as buildSizeStyleBase } from \"@typescript-calendar-lib/web\";\n\n/** セルサイズを CSS 変数スタイル(--cal-cell-w / --cal-cell-h)へ変換する */\nexport function buildSizeStyle(size: CalendarSize): CSSProperties {\n return buildSizeStyleBase(size) as CSSProperties;\n}\n","import type {\n CalendarCellState,\n CalendarOptions,\n} from \"@typescript-calendar-lib/core\";\nimport {\n addDays,\n buildMonthGrid,\n createDate,\n getCalendarCellState,\n getISOWeek,\n getMonthName,\n getWeekdayHeaders,\n getWeekOfYear,\n isSameDay,\n} from \"@typescript-calendar-lib/core\";\nimport { formatCellLabel } from \"@typescript-calendar-lib/web\";\nimport type {\n CSSProperties,\n KeyboardEvent as ReactKeyboardEvent,\n ReactNode,\n Ref,\n} from \"react\";\nimport { getCellClasses } from \"./cell-classes.ts\";\nimport type { CalendarSize } from \"./size.ts\";\nimport { buildSizeStyle, isSizeName } from \"./size.ts\";\nimport type {\n ColorSchemeName,\n ReactColorScheme,\n ReactTheme,\n ThemeName,\n} from \"./themes.ts\";\nimport { resolveColorScheme, resolveTheme } from \"./themes.ts\";\n\nexport type {\n CalendarCustomSize,\n CalendarSize,\n CalendarSizeName,\n} from \"./size.ts\";\n\nexport interface CalendarProps {\n year: number;\n month: number;\n locale?: CalendarOptions[\"locale\"];\n holidayLocale?: CalendarOptions[\"holidayLocale\"];\n weekStart?: CalendarOptions[\"weekStart\"];\n /** 各週の先頭に週番号(ISO/年始基準)を表示する。既定は false */\n showWeekNumbers?: boolean;\n highlight?: Date;\n /** 範囲強調 */\n range?: { from: Date; to: Date };\n /** 今日の基準日。カラースキームの today 着色に使用 */\n today?: Date;\n /** 範囲プレビュー(ホバー等の候補範囲)。is-in-range-preview クラスで視覚化される */\n rangePreview?: { from: Date; to: Date };\n /** 見た目テーマ。既定は \"default\" */\n theme?: ThemeName | ReactTheme;\n /** カラースキーム。既定は \"default\" */\n colorScheme?: ColorSchemeName | ReactColorScheme;\n /** セルサイズ。既定は \"md\"。{ width, height } で自由に指定できる */\n size?: CalendarSize;\n /** 狭い画面(スマホ等)でセルサイズと余白を自動調整する。既定は false(無効) */\n responsive?: boolean;\n /** root 要素に追加するスタイル。CSS変数(--cal-*)で自由に上書きできる */\n style?: CSSProperties;\n\n // ── インタラクション ──\n\n /** インタラクティブモードを有効にする。セルクリック・ホバー・キーボード選択が可能になる */\n interactive?: boolean;\n /** セルクリック時のコールバック。第2引数に該当日のデータ(cellData の戻り値)が渡る */\n onDateClick?: (date: Date, data?: unknown) => void;\n /** セルホバー時のコールバック */\n onDateHover?: (date: Date) => void;\n /** カレンダーからマウスが離れたときのコールバック */\n onDateLeave?: () => void;\n /** キーボード操作。root 要素で発火(矢印キー等を InteractiveCalendar が処理する) */\n onKeyDown?: (event: ReactKeyboardEvent<HTMLDivElement>) => void;\n\n // ── セル状態 ──\n\n /** 選択済み日付。aria-selected・aria-pressed と表示スタイルに使用 */\n selectedDate?: Date | null;\n /** カーソル位置の日付。このセルだけ tabIndex=0(roving tabindex)になる */\n cursorDate?: Date | null;\n /** ホバー中の日付。is-hovered クラスで視覚化される */\n hoveredDate?: Date | null;\n /** セル内容のカスタムレンダリング。interactive 時は button の子として描画される。第4引数に該当日のデータが渡る */\n renderCell?: (\n day: number,\n date: Date,\n state: CalendarCellState,\n data?: unknown,\n ) => ReactNode;\n /** 各セルに付与するユーザー定義データを解決する関数。実セルのみに呼ばれる */\n cellData?: (date: Date) => unknown;\n /** 選択不可日付の判定。true を返した日付は is-disabled クラスになり、インタラクティブ時は選択・ホバーできなくなる */\n isDateDisabled?: (date: Date) => boolean;\n\n /** root 要素への ref(React 19 の ref-as-prop) */\n ref?: Ref<HTMLDivElement>;\n}\n\n/** 月カレンダーコンポーネント */\nexport function Calendar({\n year,\n month,\n locale = \"en\",\n holidayLocale,\n weekStart = \"sunday\",\n showWeekNumbers = false,\n highlight,\n range,\n today,\n theme = \"default\",\n colorScheme = \"default\",\n size = \"md\",\n responsive = false,\n style,\n interactive = false,\n onDateClick,\n onDateHover,\n onDateLeave,\n onKeyDown,\n selectedDate = null,\n cursorDate = null,\n hoveredDate = null,\n renderCell,\n cellData,\n isDateDisabled,\n rangePreview,\n ref,\n}: CalendarProps) {\n const cellDate = (day: number): Date => createDate(year, month - 1, day);\n const weekOf = (row: (number | null)[]): number | null => {\n const firstIdx = row.findIndex((d) => d !== null);\n if (firstIdx === -1) return null;\n const firstDate = createDate(year, month - 1, row[firstIdx]!);\n const weekStartDate = addDays(firstDate, -firstIdx);\n return weekStart === \"monday\"\n ? getISOWeek(weekStartDate)\n : getWeekOfYear(weekStartDate);\n };\n const className = (day: number): string | undefined =>\n getCellClasses(cellDate(day), {\n today,\n holidayLocale,\n highlight,\n range,\n rangePreview,\n hoveredDate,\n selected: selectedDate,\n cursorDate,\n isDateDisabled,\n }) || undefined;\n\n const handleCellClick = (day: number) => {\n if (interactive && onDateClick) {\n const date = cellDate(day);\n onDateClick(date, cellData?.(date));\n }\n };\n\n const handleCellHover = (day: number) => {\n if (interactive && onDateHover) onDateHover(cellDate(day));\n };\n\n const handleMouseLeave = () => {\n if (interactive && onDateLeave) onDateLeave();\n };\n\n const title = `${getMonthName(locale, month)} ${year}`;\n // インタラクティブ時のみ APG の grid セマンティクスを付与する。\n // 静的表示ではネイティブの table/cell セマンティクスをそのまま使う。\n const gridRole = interactive ? \"grid\" : undefined;\n const cellRole = interactive ? \"gridcell\" : undefined;\n\n return (\n // biome-ignore lint/a11y/noStaticElementInteractions: onMouseLeave はホバー状態クリア用の補助イベント。キーボード操作(role=grid)は独立して対応済み\n <div\n ref={ref}\n className={`calendar ${resolveTheme(theme).className}${isSizeName(size) ? ` calendar-size-${size}` : \"\"}${interactive ? \" calendar-interactive\" : \"\"}${responsive ? \" calendar-responsive\" : \"\"}`}\n onMouseLeave={interactive ? handleMouseLeave : undefined}\n style={{\n ...(resolveColorScheme(colorScheme) as CSSProperties),\n ...buildSizeStyle(size),\n ...style,\n }}\n >\n <div className=\"calendar-header\">\n <h2>{title}</h2>\n </div>\n <table role={gridRole} aria-label={title} onKeyDown={onKeyDown}>\n <thead>\n <tr>\n {showWeekNumbers && (\n <th\n key=\"week\"\n className=\"calendar-week\"\n scope=\"col\"\n aria-label=\"Week number\"\n />\n )}\n {getWeekdayHeaders(locale, weekStart).map((day) => (\n <th key={day} scope=\"col\">\n {day}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {buildMonthGrid(year, month, weekStart).map((row, i) => {\n if (row.every((d) => d === null)) return null;\n const week = weekOf(row);\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: 月グリッドは静的で並び順が変わらない\n <tr key={i}>\n {showWeekNumbers && week !== null && (\n <th key=\"week\" className=\"calendar-week\" scope=\"row\">\n {week}\n </th>\n )}\n {row.map((day, j) => {\n if (day === null)\n // biome-ignore lint/suspicious/noArrayIndexKey: パディングセルは位置が唯一の識別子\n return <td key={j} role={cellRole} />;\n const date = cellDate(day);\n const state = getCalendarCellState(date, {\n today,\n highlight,\n range,\n isDateDisabled,\n });\n const data = cellData?.(date);\n const selected =\n selectedDate !== null && isSameDay(date, selectedDate);\n const cursor =\n cursorDate !== null && isSameDay(date, cursorDate);\n return (\n // biome-ignore lint/a11y/useAriaPropsSupportedByRole: interactive 時は td に role=gridcell が付き aria-selected は有効(role が動的なため静的解析できない)\n <td\n // パディングセル(key=j)との衝突を避けるため日番号に \"d-\" を付与する。日番号は列位置 j と異なり配列の index ではない\n key={`d-${day}`}\n role={cellRole}\n tabIndex={interactive ? -1 : undefined}\n className={className(day)}\n aria-selected={selected || undefined}\n aria-current={state.isToday ? \"date\" : undefined}\n aria-disabled={state.isDisabled || undefined}\n >\n {interactive ? (\n <button\n type=\"button\"\n className=\"calendar-day-btn\"\n onClick={\n state.isDisabled\n ? undefined\n : () => handleCellClick(day)\n }\n onMouseEnter={\n state.isDisabled\n ? undefined\n : () => handleCellHover(day)\n }\n tabIndex={cursor ? 0 : -1}\n data-cursor={cursor ? \"true\" : undefined}\n aria-label={formatCellLabel(locale, year, month, day)}\n aria-pressed={selected}\n disabled={state.isDisabled}\n >\n {renderCell\n ? renderCell(day, date, state, data)\n : day}\n </button>\n ) : renderCell ? (\n renderCell(day, date, state, data)\n ) : (\n day\n )}\n </td>\n );\n })}\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n );\n}\n\nexport default Calendar;\n","import type { DateRange } from \"@typescript-calendar-lib/core\";\nimport type {\n CalendarState,\n CalendarStateOptions,\n Direction,\n MonthDirection,\n} from \"@typescript-calendar-lib/tui\";\nimport {\n clearSelection,\n createCalendarState,\n getCursorDate,\n getSelectedDate,\n getSelectedRange,\n goToDate,\n goToMonth,\n goToToday,\n moveCursor,\n navigateMonth,\n navigateYear,\n sameStateOptions,\n selectDate,\n selectDateAt,\n selectRange,\n setCursorToDate,\n updateStateOptions,\n} from \"@typescript-calendar-lib/tui\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport interface UseCalendarStateOptions\n extends Pick<\n CalendarStateOptions,\n | \"locale\"\n | \"holidayLocale\"\n | \"weekStart\"\n | \"today\"\n | \"highlight\"\n | \"range\"\n | \"isDateDisabled\"\n | \"selectionMode\"\n > {\n initialYear?: number;\n initialMonth?: number;\n /** 表示中の年月が変わったときに呼ばれる */\n onMonthChange?: (year: number, month: number) => void;\n}\n\nexport interface UseCalendarStateReturn {\n /** 現在のカレンダー状態 */\n state: CalendarState;\n /** カーソルを指定方向に移動 (wrap around) */\n moveCursor: (direction: Direction) => void;\n /** 前月/翌月へ移動 */\n goNext: () => void;\n goPrev: () => void;\n /** 前年/翌年へ移動 */\n navigateYear: (direction: MonthDirection) => void;\n /** 指定した年月へジャンプ */\n goToMonth: (year: number, month: number) => void;\n /** 指定した日付の月へジャンプし、カーソルをその日付に置く */\n goToDate: (date: Date) => void;\n /** 今日の月へジャンプ */\n goToday: () => void;\n /** カーソル位置の日付を選択 */\n selectDate: () => void;\n /** 指定した日付へカーソルを移動する(当月に無ければ何もしない) */\n setCursorToDate: (date: Date) => void;\n /** 指定した日付を選択し、カーソルもそこへ移動する(当月に無ければ何もしない) */\n selectDateAt: (date: Date) => void;\n /** 範囲を直接設定して選択する(from/to は自動で整列される) */\n selectRange: (from: Date, to: Date) => void;\n /** 選択を解除 */\n clearSelection: () => void;\n /** カーソル位置の日付(null の場合あり) */\n cursorDate: Date | null;\n /** 選択済み日付(null の場合あり) */\n selectedDate: Date | null;\n /** 確定した選択範囲(range モードで確定した範囲)。未確定なら null */\n selectedRange: DateRange | null;\n /** ホバー中の日付(null の場合あり) */\n hoveredDate: Date | null;\n /** ホバー日付を更新する */\n setHoveredDate: (date: Date | null) => void;\n}\n\n/**\n * tui の不変状態マシンを包む React hook。\n * カレンダーのインタラクティブ操作をシンプルに利用できる。\n *\n * `options` の値(locale / weekStart / today / highlight / range / selectionMode /\n * initialYear / initialMonth)が変わると、カーソル・選択を保ったまま\n * 状態が再構築される。比較は値(Date は getTime)で行うため、インラインで\n * オプションを渡しても値が同じなら再構築されない。\n *\n * `today` を省略した場合、最初に解決された値が状態に固定され、以降も\n * 引き継がれる(毎レンダリング `new Date()` を渡さなくてよい)。\n */\nexport function useCalendarState(\n options: UseCalendarStateOptions = {},\n): UseCalendarStateReturn {\n const [state, setState] = useState<CalendarState>(() =>\n createCalendarState(options),\n );\n\n // ホバー中の日付は React ローカル state で保持する(tui 状態には入れない)。\n const [hoveredDate, setHoveredDate] = useState<Date | null>(null);\n\n // options の「値の変化」を検知して状態を再構築する。\n // 初回は prevOptions が同一なので何もしない。値が同じままの再レンダリング\n // でも何もしないため、インラインリテラルを毎回渡しても無限ループしない。\n const prevOptions = useRef(options);\n useEffect(() => {\n if (sameStateOptions(prevOptions.current, options)) return;\n const previous = prevOptions.current;\n prevOptions.current = options;\n setState((current) => updateStateOptions(current, options, previous));\n }, [options]);\n\n // onMonthChange: ref 経由で安定参照\n const onMonthChangeRef = useRef(options.onMonthChange);\n onMonthChangeRef.current = options.onMonthChange;\n\n // 表示月が変わったら onMonthChange を通知し、古い月を指すホバーをクリアする\n const prevMonthRef = useRef({ year: state.year, month: state.month });\n useEffect(() => {\n const prev = prevMonthRef.current;\n if (prev.year !== state.year || prev.month !== state.month) {\n prevMonthRef.current = { year: state.year, month: state.month };\n onMonthChangeRef.current?.(state.year, state.month);\n setHoveredDate(null);\n }\n }, [state.year, state.month]);\n\n return {\n state,\n moveCursor: useCallback(\n (direction: Direction) => setState((prev) => moveCursor(prev, direction)),\n [],\n ),\n goNext: useCallback(\n () => setState((prev) => navigateMonth(prev, \"next\")),\n [],\n ),\n goPrev: useCallback(\n () => setState((prev) => navigateMonth(prev, \"prev\")),\n [],\n ),\n navigateYear: useCallback(\n (direction: MonthDirection) =>\n setState((prev) => navigateYear(prev, direction)),\n [],\n ),\n goToMonth: useCallback(\n (year: number, month: number) =>\n setState((prev) => goToMonth(prev, year, month)),\n [],\n ),\n goToDate: useCallback(\n (date: Date) => setState((prev) => goToDate(prev, date)),\n [],\n ),\n goToday: useCallback(() => setState((prev) => goToToday(prev)), []),\n selectDate: useCallback(() => setState((prev) => selectDate(prev)), []),\n setCursorToDate: useCallback(\n (date: Date) => setState((prev) => setCursorToDate(prev, date)),\n [],\n ),\n selectDateAt: useCallback(\n (date: Date) => setState((prev) => selectDateAt(prev, date)),\n [],\n ),\n selectRange: useCallback(\n (from: Date, to: Date) => setState((prev) => selectRange(prev, from, to)),\n [],\n ),\n clearSelection: useCallback(\n () => setState((prev) => clearSelection(prev)),\n [],\n ),\n cursorDate: getCursorDate(state),\n selectedDate: getSelectedDate(state),\n selectedRange: getSelectedRange(state),\n hoveredDate,\n setHoveredDate,\n };\n}\n\nexport type { Direction, MonthDirection };\n","import type { CalendarOptions } from \"@typescript-calendar-lib/core\";\nimport type { SelectionMode } from \"@typescript-calendar-lib/tui\";\nimport { keyToAction } from \"@typescript-calendar-lib/tui\";\nimport type { CSSProperties } from \"react\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport { Calendar, type CalendarProps } from \"./Calendar.tsx\";\nimport { useCalendarState } from \"./hooks.ts\";\nimport { buildRangePreview } from \"./range-preview.ts\";\nimport type { CalendarSize } from \"./size.ts\";\nimport type {\n ColorSchemeName,\n ReactColorScheme,\n ReactTheme,\n ThemeName,\n} from \"./themes.ts\";\n\nexport interface InteractiveCalendarProps {\n // ── useCalendarState オプション ──\n\n /** 表示開始年。既定は today の年 */\n initialYear?: number;\n /** 表示開始月 (1-12)。範囲外は正規化される */\n initialMonth?: number;\n locale?: CalendarOptions[\"locale\"];\n holidayLocale?: CalendarOptions[\"holidayLocale\"];\n weekStart?: CalendarOptions[\"weekStart\"];\n /** 選択方式。既定は \"single\"。範囲選択時はクリックのたびにアンカー→確定→リセットを交互に行う */\n selectionMode?: SelectionMode;\n /** ハイライト対象日 */\n highlight?: Date;\n /** 範囲プレビュー(ホバー等の候補範囲)。is-in-range-preview クラスで視覚化される */\n range?: { from: Date; to: Date };\n /** 今日の基準日。省略時は初回レンダリング時刻に解決される */\n today?: Date;\n /** 選択不可日付の判定。true を返した日付は選択・カーソル移動・ホバーの対象外になる */\n isDateDisabled?: (date: Date) => boolean;\n /** 表示中の年月が変わったときに呼ばれる */\n onMonthChange?: (year: number, month: number) => void;\n\n // ── Calendar の見た目 ──\n\n theme?: ThemeName | ReactTheme;\n colorScheme?: ColorSchemeName | ReactColorScheme;\n size?: CalendarSize;\n /** 狭い画面(スマホ等)でセルサイズと余白を自動調整する */\n responsive?: boolean;\n style?: CSSProperties;\n /** セル内容のカスタムレンダリング。第4引数に該当日のデータが渡る */\n renderCell?: CalendarProps[\"renderCell\"];\n /** 各セルに付与するユーザー定義データを解決する関数。実セルのみに呼ばれる */\n cellData?: (date: Date) => unknown;\n\n // ── イベント ──\n\n /** セルクリック時(キーボードの Enter/Space 含む)。クリックした日付は自動的に選択される。第2引数に該当日のデータが渡る */\n onDateClick?: (date: Date, data?: unknown) => void;\n /** セルホバー時 */\n onDateHover?: (date: Date) => void;\n /** カレンダーからマウスが離れたとき */\n onDateLeave?: () => void;\n}\n\n/**\n * `useCalendarState` と `Calendar` を一体化したインタラクティブカレンダー。\n * 内部で状態を管理し、以下の操作に対応する:\n *\n * - マウス: セルクリックで日付を選択(カーソルもそこへ移動) / ホバー追跡 /\n * 選択済み日付とホバー日付の間を範囲プレビュー表示\n * - キーボード: 矢印キー(カーソル移動)・PageUp/PageDown(月移動)・\n * Enter/Space(クリックと同じ日付選択)\n */\nexport function InteractiveCalendar(props: InteractiveCalendarProps) {\n const {\n initialYear,\n initialMonth,\n locale,\n holidayLocale,\n weekStart,\n selectionMode,\n highlight,\n range,\n today,\n isDateDisabled,\n onMonthChange,\n theme,\n colorScheme,\n size,\n responsive,\n style,\n renderCell,\n cellData,\n onDateClick,\n onDateHover,\n onDateLeave,\n } = props;\n\n const hook = useCalendarState({\n initialYear,\n initialMonth,\n locale,\n holidayLocale,\n weekStart,\n selectionMode,\n today,\n highlight,\n range,\n isDateDisabled,\n onMonthChange,\n });\n\n const { state, moveCursor, goPrev, goNext, selectDateAt, setHoveredDate } =\n hook;\n const rootRef = useRef<HTMLDivElement>(null);\n\n // クリック(マウス・Enter/Space 共通)で日付を選択する。\n // 従来の onDateClick コールバックも引き続き発火し、第2引数に該当日のデータが渡る。\n const handleDateClick = useCallback(\n (date: Date, data?: unknown) => {\n selectDateAt(date);\n onDateClick?.(date, data);\n },\n [selectDateAt, onDateClick],\n );\n\n const handleDateHover = useCallback(\n (date: Date) => {\n setHoveredDate(date);\n onDateHover?.(date);\n },\n [setHoveredDate, onDateHover],\n );\n\n const handleDateLeave = useCallback(() => {\n setHoveredDate(null);\n onDateLeave?.();\n }, [setHoveredDate, onDateLeave]);\n\n // 確定済みの選択範囲は、次のピックが始まるまでプレビューとして表示し続ける。\n // 未確定なら選択済み日付とホバー日付の間を範囲プレビューとして表示する。\n const rangePreview =\n hook.selectedRange ??\n buildRangePreview(hook.selectedDate, hook.hoveredDate);\n\n // カーソルが動いたときだけ、そのセルへフォーカスを移す(初回マウントでは動かさない)\n const prevCursorRef = useRef(state.cursor);\n useEffect(() => {\n const prev = prevCursorRef.current;\n prevCursorRef.current = state.cursor;\n if (prev === state.cursor) return;\n const btn = rootRef.current?.querySelector<HTMLButtonElement>(\n '[data-cursor=\"true\"]',\n );\n btn?.focus();\n }, [state.cursor]);\n\n const handleKeyDown = useCallback(\n (e: Parameters<NonNullable<CalendarProps[\"onKeyDown\"]>>[0]) => {\n const action = keyToAction(e.key);\n if (action === undefined) return;\n e.preventDefault();\n switch (action) {\n case \"prev\":\n goPrev();\n break;\n case \"next\":\n goNext();\n break;\n default:\n moveCursor(action);\n }\n },\n [moveCursor, goPrev, goNext],\n );\n\n return (\n <Calendar\n ref={rootRef}\n year={state.year}\n month={state.month}\n locale={state.options.locale}\n holidayLocale={state.options.holidayLocale}\n weekStart={state.options.weekStart}\n highlight={state.options.highlight}\n range={state.options.range}\n today={state.options.today}\n isDateDisabled={isDateDisabled}\n theme={theme}\n colorScheme={colorScheme}\n size={size}\n responsive={responsive}\n style={style}\n interactive\n renderCell={renderCell}\n cellData={cellData}\n selectedDate={hook.selectedDate}\n cursorDate={hook.cursorDate}\n hoveredDate={hook.hoveredDate}\n rangePreview={rangePreview}\n onDateClick={handleDateClick}\n onDateHover={handleDateHover}\n onDateLeave={handleDateLeave}\n onKeyDown={handleKeyDown}\n />\n );\n}\n"],"mappings":";;;;;;;AA8BA,SAAgB,eAAe,MAAY,SAAmC;CAC5E,MAAM,QAAQ,qBAAqB,MAAM,OAAO;CAChD,MAAM,UAAoB,CAAC;CAC3B,IAAI,MAAM,WAAW,QAAQ,KAAK,YAAY;CAC9C,IAAI,MAAM,WAAW,QAAQ,KA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I;EACnB,cAAc;CAChB,GAAG,CAAC,gBAAgB,WAAW,CAAC;CAIhC,MAAM,eACJ,KAAK,iBACL,kBAAkB,KAAK,cAAc,KAAK,WAAW;CAGvD,MAAM,gBAAgB,OAAO,MAAM,MAAM;CACzC,gBAAgB;EACd,MAAM,OAAO,cAAc;EAC3B,cAAc,UAAU,MAAM;EAC9B,IAAI,SAAS,MAAM,QAAQ;EAI3B,CAHY,QAAQ,SAAS,cAC3B,wBACF,EAAA,EACK,MAAM;CACb,GAAG,CAAC,MAAM,MAAM,CAAC;CAEjB,MAAM,gBAAgB,aACnB,MAA8D;EAC7D,MAAM,SAAS,YAAY,EAAE,GAAG;EAChC,IAAI,WAAW,KAAA,GAAW;EAC1B,EAAE,eAAe;EACjB,QAAQ,QAAR;GACE,KAAK;IACH,OAAO;IACP;GACF,KAAK;IACH,OAAO;IACP;GACF,SACE,WAAW,MAAM;EACrB;CACF,GACA;EAAC;EAAY;EAAQ;CAAM,CAC7B;CAEA,OACE,oBAAC,UAAD;EACE,KAAK;EACL,MAAM,MAAM;EACZ,OAAO,MAAM;EACb,QAAQ,MAAM,QAAQ;EACtB,eAAe,MAAM,QAAQ;EAC7B,WAAW,MAAM,QAAQ;EACzB,WAAW,MAAM,QAAQ;EACzB,OAAO,MAAM,QAAQ;EACrB,OAAO,MAAM,QAAQ;EACL;EACT;EACM;EACP;EACM;EACL;EACP,aAAA;EACY;EACF;EACV,cAAc,KAAK;EACnB,YAAY,KAAK;EACjB,aAAa,KAAK;EACJ;EACd,aAAa;EACb,aAAa;EACb,aAAa;EACb,WAAW;CACZ,CAAA;AAEL"}
1
+ {"version":3,"file":"index.js","names":["buildSizeStyle","buildSizeStyleBase","buildSizeStyle","getBlankClasses","joinCellClassLists","getCellStateClasses","getSelectionCellClasses"],"sources":["../src/size.ts","../src/Calendar.tsx","../src/hooks.ts","../src/interactive.tsx"],"sourcesContent":["// ─── セルサイズ ───────────────────────────────────────────\n// サイズ判定・CSS 変数変換は web パッケージに集約済み。\n// ここでは React の style 型(CSSProperties)に適合させる薄いアダプタのみ持つ。\n\nimport type { CalendarSize } from \"@typescript-calendar-lib/web\";\nimport type { CSSProperties } from \"react\";\n\nexport type {\n CalendarCustomSize,\n CalendarSize,\n CalendarSizeName,\n} from \"@typescript-calendar-lib/web\";\nexport { isSizeName } from \"@typescript-calendar-lib/web\";\n\nimport { buildSizeStyle as buildSizeStyleBase } from \"@typescript-calendar-lib/web\";\n\n/** セルサイズを CSS 変数スタイル(--cal-cell-w / --cal-cell-h)へ変換する */\nexport function buildSizeStyle(size: CalendarSize): CSSProperties {\n return buildSizeStyleBase(size) as CSSProperties;\n}\n","import type {\n CalendarCellState,\n CalendarOptions,\n} from \"@typescript-calendar-lib/core\";\nimport {\n addDays,\n buildMonthGrid,\n createDate,\n getCalendarCellState,\n getISOWeek,\n getMonthName,\n getWeekdayHeaders,\n getWeekOfYear,\n isSameDay,\n} from \"@typescript-calendar-lib/core\";\nimport {\n formatCellLabel,\n getBlankClasses,\n getCellStateClasses,\n getSelectionCellClasses,\n joinCellClassLists,\n uiString,\n} from \"@typescript-calendar-lib/web\";\nimport type {\n CSSProperties,\n KeyboardEvent as ReactKeyboardEvent,\n ReactNode,\n Ref,\n} from \"react\";\nimport { useId, useMemo } from \"react\";\nimport type { CalendarSize } from \"./size.ts\";\nimport { buildSizeStyle, isSizeName } from \"./size.ts\";\nimport type {\n ColorSchemeName,\n ReactColorScheme,\n ReactTheme,\n ThemeName,\n} from \"./themes.ts\";\nimport { mergeColorScheme, resolveTheme } from \"./themes.ts\";\n\nexport type {\n CalendarCustomSize,\n CalendarSize,\n CalendarSizeName,\n} from \"./size.ts\";\n\nexport interface CalendarProps {\n year: number;\n month: number;\n locale?: CalendarOptions[\"locale\"];\n holidayLocale?: CalendarOptions[\"holidayLocale\"];\n weekStart?: CalendarOptions[\"weekStart\"];\n /** 各週の先頭に週番号(ISO/年始基準)を表示する。既定は false */\n showWeekNumbers?: boolean;\n highlight?: Date;\n /** 範囲強調 */\n range?: { from: Date; to: Date };\n /** 今日の基準日。カラースキームの today 着色に使用 */\n today?: Date;\n /** 範囲プレビュー(ホバー等の候補範囲)。is-in-range-preview クラスで視覚化される */\n rangePreview?: { from: Date; to: Date };\n /** 見た目テーマ。既定は \"default\" */\n theme?: ThemeName | ReactTheme;\n /** カラースキーム。既定は \"default\" */\n colorScheme?: ColorSchemeName | ReactColorScheme;\n /** セルサイズ。既定は \"md\"。{ width, height } で自由に指定できる */\n size?: CalendarSize;\n /** 狭い画面(スマホ等)でセルサイズと余白を自動調整する。既定は false(無効) */\n responsive?: boolean;\n /** root 要素に追加するスタイル。CSS変数(--cal-*)で自由に上書きできる */\n style?: CSSProperties;\n\n // ── インタラクション ──\n\n /** インタラクティブモードを有効にする。セルクリック・ホバー・キーボード選択が可能になる */\n interactive?: boolean;\n /** セルクリック時のコールバック。第2引数に該当日のデータ(cellData の戻り値)が渡る */\n onDateClick?: (date: Date, data?: unknown) => void;\n /** セルホバー時のコールバック */\n onDateHover?: (date: Date) => void;\n /** カレンダーからマウスが離れたときのコールバック */\n onDateLeave?: () => void;\n /** キーボード操作。root 要素で発火(矢印キー等を InteractiveCalendar が処理する) */\n onKeyDown?: (event: ReactKeyboardEvent<HTMLDivElement>) => void;\n\n // ── セル状態 ──\n\n /** 選択済み日付。aria-selected・aria-pressed と表示スタイルに使用 */\n selectedDate?: Date | null;\n /** カーソル位置の日付。このセルだけ tabIndex=0(roving tabindex)になる */\n cursorDate?: Date | null;\n /** ホバー中の日付。is-hovered クラスで視覚化される */\n hoveredDate?: Date | null;\n /** セル内容のカスタムレンダリング。interactive 時は button の子として描画される。第4引数に該当日のデータが渡る */\n renderCell?: (\n day: number,\n date: Date,\n state: CalendarCellState,\n data?: unknown,\n ) => ReactNode;\n /** 各セルに付与するユーザー定義データを解決する関数。実セルのみに呼ばれる */\n cellData?: (date: Date) => unknown;\n /** 選択不可日付の判定。true を返した日付は is-disabled クラスになり、インタラクティブ時は選択・ホバーできなくなる */\n isDateDisabled?: (date: Date) => boolean;\n\n /** root 要素への ref(React 19 の ref-as-prop) */\n ref?: Ref<HTMLDivElement>;\n}\n\n/** 月カレンダーコンポーネント */\nexport function Calendar({\n year,\n month,\n locale = \"en\",\n holidayLocale,\n weekStart = \"sunday\",\n showWeekNumbers = false,\n highlight,\n range,\n today,\n theme = \"default\",\n colorScheme = \"default\",\n size = \"md\",\n responsive = false,\n style,\n interactive = false,\n onDateClick,\n onDateHover,\n onDateLeave,\n onKeyDown,\n selectedDate = null,\n cursorDate = null,\n hoveredDate = null,\n renderCell,\n cellData,\n isDateDisabled,\n rangePreview,\n ref,\n}: CalendarProps) {\n // グリッドは月単位で不変。ホバー・選択の再描画でも再計算しない\n const grid = useMemo(\n () => buildMonthGrid(year, month, weekStart),\n [year, month, weekStart],\n );\n\n const handleCellClick = (date: Date, data?: unknown) => {\n if (interactive && onDateClick) onDateClick(date, data);\n };\n\n const handleCellHover = (date: Date) => {\n if (interactive && onDateHover) onDateHover(date);\n };\n\n const handleMouseLeave = () => {\n if (interactive && onDateLeave) onDateLeave();\n };\n\n const title = `${getMonthName(locale, month)} ${year}`;\n // 週番号の行ヘッダー(scope=\"row\")用ラベル。行ごとに一意の名前にするため\n // 番号を含める(aria-label が内容の数字を上書きしないように)\n const weekLabel = uiString(\"weekNumber\", locale);\n const weekOf = (row: (number | null)[]): number | null => {\n const firstIdx = row.findIndex((d) => d !== null);\n if (firstIdx === -1) return null;\n const firstDate = createDate(year, month - 1, row[firstIdx]!);\n const weekStartDate = addDays(firstDate, -firstIdx);\n return weekStart === \"monday\"\n ? getISOWeek(weekStartDate)\n : getWeekOfYear(weekStartDate);\n };\n // インタラクティブ時のみ APG の grid セマンティクスを付与する。\n // 静的表示ではネイティブの table/cell セマンティクスをそのまま使う。\n const gridRole = interactive ? \"grid\" : undefined;\n const cellRole = interactive ? \"gridcell\" : undefined;\n // h2 には一意な id を振り、table は aria-labelledby でそれを参照する。\n // useId() を使うのは同じ月のカレンダーが複数同時に置かれた場合に\n // id が衝突し aria-labelledby が別のカレンダーを見指すため。\n // aria-label と h2 の両方に同じ文字列を置くとスクリーンリーダーが二重に読む。\n const headingId = useId();\n\n return (\n // biome-ignore lint/a11y/noStaticElementInteractions: onMouseLeave はホバー状態クリア用の補助イベント。キーボード操作(role=grid)は独立して対応済み\n <div\n ref={ref}\n className={`calendar ${resolveTheme(theme).className}${isSizeName(size) ? ` calendar-size-${size}` : \"\"}${interactive ? \" calendar-interactive\" : \"\"}${responsive ? \" calendar-responsive\" : \"\"}`}\n onMouseLeave={interactive ? handleMouseLeave : undefined}\n style={{\n ...(mergeColorScheme(colorScheme) as CSSProperties),\n ...buildSizeStyle(size),\n ...style,\n }}\n >\n <div className=\"calendar-header\">\n <h2\n id={headingId}\n aria-live={gridRole ? \"polite\" : undefined}\n aria-atomic={gridRole ? \"true\" : undefined}\n >\n {title}\n </h2>\n </div>\n <table role={gridRole} aria-labelledby={headingId} onKeyDown={onKeyDown}>\n <thead>\n <tr>\n {showWeekNumbers && (\n <th\n key=\"week\"\n className=\"calendar-week\"\n scope=\"col\"\n aria-label={uiString(\"weekNumber\", locale)}\n />\n )}\n {getWeekdayHeaders(locale, weekStart).map((day) => (\n <th key={day} scope=\"col\">\n {day}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {grid.map((row, i) => {\n if (row.every((d) => d === null)) return null;\n const week = weekOf(row);\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: 月グリッドは静的で並び順が変わらない\n <tr key={i}>\n {showWeekNumbers && week !== null && (\n <th\n key=\"week\"\n className=\"calendar-week\"\n scope=\"row\"\n aria-label={`${weekLabel} ${week}`}\n >\n {week}\n </th>\n )}\n {row.map((day, j) => {\n if (day === null) {\n // biome-ignore-start lint/suspicious/noArrayIndexKey: パディングセルは日付を持たず列位置 j が唯一の識別子。月グリッドは静的で並び順が入れ替わらないため\n return (\n <td\n key={`b-${j}`}\n role={cellRole}\n className={getBlankClasses()}\n />\n );\n // biome-ignore-end lint/suspicious/noArrayIndexKey: 上記と同じ理由\n }\n // 1セルにつき Date・状態・クラスを1回だけ計算する。\n // Date は year/month 固定で day のみ変わるため createDate で正確に作る\n const date = createDate(year, month - 1, day);\n const state = getCalendarCellState(date, {\n today,\n holidayLocale,\n highlight,\n range,\n isDateDisabled,\n });\n const className =\n joinCellClassLists(\n getCellStateClasses(state),\n getSelectionCellClasses(date, {\n rangePreview,\n hoveredDate,\n selected: selectedDate,\n cursorDate,\n }),\n ) || undefined;\n const selected =\n selectedDate !== null && isSameDay(date, selectedDate);\n const cursor =\n cursorDate !== null && isSameDay(date, cursorDate);\n const onClick =\n interactive && !state.isDisabled\n ? () => handleCellClick(date, cellData?.(date))\n : undefined;\n const onEnter =\n interactive && !state.isDisabled\n ? () => handleCellHover(date)\n : undefined;\n return (\n // biome-ignore lint/a11y/useAriaPropsSupportedByRole: interactive 時は td に role=gridcell が付き aria-selected は有効(role が動的なため静的解析できない)\n <td\n // パディングセル(key=j)との衝突を避けるため日番号に \"d-\" を付与する。日番号は列位置 j と異なり配列の index ではない\n key={`d-${day}`}\n role={cellRole}\n className={className}\n aria-selected={selected || undefined}\n aria-current={state.isToday ? \"date\" : undefined}\n aria-disabled={state.isDisabled || undefined}\n >\n {interactive ? (\n <button\n type=\"button\"\n className=\"calendar-day-btn\"\n onClick={onClick}\n onMouseEnter={onEnter}\n tabIndex={cursor ? 0 : -1}\n data-cursor={cursor ? \"true\" : undefined}\n aria-label={formatCellLabel(locale, year, month, day)}\n aria-pressed={selected}\n disabled={state.isDisabled}\n >\n {renderCell\n ? renderCell(day, date, state, cellData?.(date))\n : day}\n </button>\n ) : renderCell ? (\n renderCell(day, date, state, cellData?.(date))\n ) : (\n day\n )}\n </td>\n );\n })}\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n );\n}\n\nexport default Calendar;\n","import type { DateRange } from \"@typescript-calendar-lib/core\";\nimport type {\n CalendarState,\n CalendarStateOptions,\n Direction,\n MonthDirection,\n} from \"@typescript-calendar-lib/tui\";\nimport {\n clearSelection,\n createCalendarState,\n getCursorDate,\n getSelectedDate,\n getSelectedRange,\n goToDate,\n goToMonth,\n goToToday,\n moveCursor,\n navigateMonth,\n navigateYear,\n sameStateOptions,\n selectDate,\n selectDateAt,\n selectRange,\n setCursorToDate,\n updateStateOptions,\n} from \"@typescript-calendar-lib/tui\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport interface UseCalendarStateOptions\n extends Pick<\n CalendarStateOptions,\n | \"locale\"\n | \"holidayLocale\"\n | \"weekStart\"\n | \"today\"\n | \"highlight\"\n | \"range\"\n | \"isDateDisabled\"\n | \"selectionMode\"\n > {\n initialYear?: number;\n initialMonth?: number;\n /** 表示中の年月が変わったときに呼ばれる */\n onMonthChange?: (year: number, month: number) => void;\n}\n\nexport interface UseCalendarStateReturn {\n /** 現在のカレンダー状態 */\n state: CalendarState;\n /** カーソルを指定方向に移動 (wrap around) */\n moveCursor: (direction: Direction) => void;\n /** 前月/翌月へ移動 */\n goNext: () => void;\n goPrev: () => void;\n /** 前年/翌年へ移動 */\n navigateYear: (direction: MonthDirection) => void;\n /** 指定した年月へジャンプ */\n goToMonth: (year: number, month: number) => void;\n /** 指定した日付の月へジャンプし、カーソルをその日付に置く */\n goToDate: (date: Date) => void;\n /** 今日の月へジャンプ */\n goToday: () => void;\n /** カーソル位置の日付を選択 */\n selectDate: () => void;\n /** 指定した日付へカーソルを移動する(当月に無ければ何もしない) */\n setCursorToDate: (date: Date) => void;\n /** 指定した日付を選択し、カーソルもそこへ移動する(当月に無ければ何もしない) */\n selectDateAt: (date: Date) => void;\n /** 範囲を直接設定して選択する(from/to は自動で整列される) */\n selectRange: (from: Date, to: Date) => void;\n /** 選択を解除 */\n clearSelection: () => void;\n /** カーソル位置の日付(null の場合あり) */\n cursorDate: Date | null;\n /** 選択済み日付(null の場合あり) */\n selectedDate: Date | null;\n /** 確定した選択範囲(range モードで確定した範囲)。未確定なら null */\n selectedRange: DateRange | null;\n /** ホバー中の日付(null の場合あり) */\n hoveredDate: Date | null;\n /** ホバー日付を更新する */\n setHoveredDate: (date: Date | null) => void;\n}\n\n/**\n * tui の不変状態マシンを包む React hook。\n * カレンダーのインタラクティブ操作をシンプルに利用できる。\n *\n * `options` の値(locale / weekStart / today / highlight / range / selectionMode /\n * initialYear / initialMonth)が変わると、カーソル・選択を保ったまま\n * 状態が再構築される。比較は値(Date は getTime)で行うため、インラインで\n * オプションを渡しても値が同じなら再構築されない。\n *\n * `today` を省略した場合、最初に解決された値が状態に固定され、以降も\n * 引き継がれる(毎レンダリング `new Date()` を渡さなくてよい)。\n */\nexport function useCalendarState(\n options: UseCalendarStateOptions = {},\n): UseCalendarStateReturn {\n const [state, setState] = useState<CalendarState>(() =>\n createCalendarState(options),\n );\n\n // ホバー中の日付は React ローカル state で保持する(tui 状態には入れない)。\n const [hoveredDate, setHoveredDate] = useState<Date | null>(null);\n\n // options の「値の変化」を検知して状態を再構築する。\n // 初回は prevOptions が同一なので何もしない。値が同じままの再レンダリング\n // でも何もしないため、インラインリテラルを毎回渡しても無限ループしない。\n const prevOptions = useRef(options);\n useEffect(() => {\n if (sameStateOptions(prevOptions.current, options)) return;\n const previous = prevOptions.current;\n prevOptions.current = options;\n setState((current) => updateStateOptions(current, options, previous));\n }, [options]);\n\n // onMonthChange: ref 経由で安定参照\n const onMonthChangeRef = useRef(options.onMonthChange);\n onMonthChangeRef.current = options.onMonthChange;\n\n // 表示月が変わったら onMonthChange を通知し、古い月を指すホバーをクリアする\n const prevMonthRef = useRef({ year: state.year, month: state.month });\n useEffect(() => {\n const prev = prevMonthRef.current;\n if (prev.year !== state.year || prev.month !== state.month) {\n prevMonthRef.current = { year: state.year, month: state.month };\n onMonthChangeRef.current?.(state.year, state.month);\n setHoveredDate(null);\n }\n }, [state.year, state.month]);\n\n return {\n state,\n moveCursor: useCallback(\n (direction: Direction) => setState((prev) => moveCursor(prev, direction)),\n [],\n ),\n goNext: useCallback(\n () => setState((prev) => navigateMonth(prev, \"next\")),\n [],\n ),\n goPrev: useCallback(\n () => setState((prev) => navigateMonth(prev, \"prev\")),\n [],\n ),\n navigateYear: useCallback(\n (direction: MonthDirection) =>\n setState((prev) => navigateYear(prev, direction)),\n [],\n ),\n goToMonth: useCallback(\n (year: number, month: number) =>\n setState((prev) => goToMonth(prev, year, month)),\n [],\n ),\n goToDate: useCallback(\n (date: Date) => setState((prev) => goToDate(prev, date)),\n [],\n ),\n goToday: useCallback(() => setState((prev) => goToToday(prev)), []),\n selectDate: useCallback(() => setState((prev) => selectDate(prev)), []),\n setCursorToDate: useCallback(\n (date: Date) => setState((prev) => setCursorToDate(prev, date)),\n [],\n ),\n selectDateAt: useCallback(\n (date: Date) => setState((prev) => selectDateAt(prev, date)),\n [],\n ),\n selectRange: useCallback(\n (from: Date, to: Date) => setState((prev) => selectRange(prev, from, to)),\n [],\n ),\n clearSelection: useCallback(\n () => setState((prev) => clearSelection(prev)),\n [],\n ),\n cursorDate: getCursorDate(state),\n selectedDate: getSelectedDate(state),\n selectedRange: getSelectedRange(state),\n hoveredDate,\n setHoveredDate,\n };\n}\n\nexport type { Direction, MonthDirection };\n","import type { CalendarOptions } from \"@typescript-calendar-lib/core\";\nimport type { SelectionMode } from \"@typescript-calendar-lib/tui\";\nimport { keyToAction } from \"@typescript-calendar-lib/tui\";\nimport type { CSSProperties } from \"react\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport { Calendar, type CalendarProps } from \"./Calendar.tsx\";\nimport { useCalendarState } from \"./hooks.ts\";\nimport { buildRangePreview } from \"./range-preview.ts\";\nimport type { CalendarSize } from \"./size.ts\";\nimport type {\n ColorSchemeName,\n ReactColorScheme,\n ReactTheme,\n ThemeName,\n} from \"./themes.ts\";\n\nexport interface InteractiveCalendarProps {\n // ── useCalendarState オプション ──\n\n /** 表示開始年。既定は today の年 */\n initialYear?: number;\n /** 表示開始月 (1-12)。範囲外は正規化される */\n initialMonth?: number;\n locale?: CalendarOptions[\"locale\"];\n holidayLocale?: CalendarOptions[\"holidayLocale\"];\n weekStart?: CalendarOptions[\"weekStart\"];\n /** 各週の先頭に週番号(ISO/年始基準)を表示する */\n showWeekNumbers?: boolean;\n /** 選択方式。既定は \"single\"。範囲選択時はクリックのたびにアンカー→確定→リセットを交互に行う */\n selectionMode?: SelectionMode;\n /** ハイライト対象日 */\n highlight?: Date;\n /** 範囲プレビュー(ホバー等の候補範囲)。is-in-range-preview クラスで視覚化される */\n range?: { from: Date; to: Date };\n /** 今日の基準日。省略時は初回レンダリング時刻に解決される */\n today?: Date;\n /** 選択不可日付の判定。true を返した日付は選択・カーソル移動・ホバーの対象外になる */\n isDateDisabled?: (date: Date) => boolean;\n /** 表示中の年月が変わったときに呼ばれる */\n onMonthChange?: (year: number, month: number) => void;\n\n // ── Calendar の見た目 ──\n\n theme?: ThemeName | ReactTheme;\n colorScheme?: ColorSchemeName | ReactColorScheme;\n size?: CalendarSize;\n /** 狭い画面(スマホ等)でセルサイズと余白を自動調整する */\n responsive?: boolean;\n style?: CSSProperties;\n /** セル内容のカスタムレンダリング。第4引数に該当日のデータが渡る */\n renderCell?: CalendarProps[\"renderCell\"];\n /** 各セルに付与するユーザー定義データを解決する関数。実セルのみに呼ばれる */\n cellData?: (date: Date) => unknown;\n\n // ── イベント ──\n\n /** セルクリック時(キーボードの Enter/Space 含む)。クリックした日付は自動的に選択される。第2引数に該当日のデータが渡る */\n onDateClick?: (date: Date, data?: unknown) => void;\n /** セルホバー時 */\n onDateHover?: (date: Date) => void;\n /** カレンダーからマウスが離れたとき */\n onDateLeave?: () => void;\n}\n\n/**\n * `useCalendarState` と `Calendar` を一体化したインタラクティブカレンダー。\n * 内部で状態を管理し、以下の操作に対応する:\n *\n * - マウス: セルクリックで日付を選択(カーソルもそこへ移動) / ホバー追跡 /\n * 選択済み日付とホバー日付の間を範囲プレビュー表示\n * - キーボード: 矢印キー(カーソル移動)・PageUp/PageDown(月移動)・\n * Enter/Space(クリックと同じ日付選択)\n */\nexport function InteractiveCalendar(props: InteractiveCalendarProps) {\n const {\n initialYear,\n initialMonth,\n locale,\n holidayLocale,\n weekStart,\n showWeekNumbers,\n selectionMode,\n highlight,\n range,\n today,\n isDateDisabled,\n onMonthChange,\n theme,\n colorScheme,\n size,\n responsive,\n style,\n renderCell,\n cellData,\n onDateClick,\n onDateHover,\n onDateLeave,\n } = props;\n\n const hook = useCalendarState({\n initialYear,\n initialMonth,\n locale,\n holidayLocale,\n weekStart,\n selectionMode,\n today,\n highlight,\n range,\n isDateDisabled,\n onMonthChange,\n });\n\n const { state, moveCursor, goPrev, goNext, selectDateAt, setHoveredDate } =\n hook;\n const rootRef = useRef<HTMLDivElement>(null);\n\n // クリック(マウス・Enter/Space 共通)で日付を選択する。\n // 従来の onDateClick コールバックも引き続き発火し、第2引数に該当日のデータが渡る。\n const handleDateClick = useCallback(\n (date: Date, data?: unknown) => {\n selectDateAt(date);\n onDateClick?.(date, data);\n },\n [selectDateAt, onDateClick],\n );\n\n const handleDateHover = useCallback(\n (date: Date) => {\n setHoveredDate(date);\n onDateHover?.(date);\n },\n [setHoveredDate, onDateHover],\n );\n\n const handleDateLeave = useCallback(() => {\n setHoveredDate(null);\n onDateLeave?.();\n }, [setHoveredDate, onDateLeave]);\n\n // 確定済みの選択範囲は、次のピックが始まるまでプレビューとして表示し続ける。\n // 未確定なら選択済み日付とホバー日付の間を範囲プレビューとして表示する。\n const rangePreview =\n hook.selectedRange ??\n buildRangePreview(hook.selectedDate, hook.hoveredDate);\n\n // カーソルが動いたときだけ、そのセルへフォーカスを移す(初回マウントでは動かさない)\n const prevCursorRef = useRef(state.cursor);\n useEffect(() => {\n const prev = prevCursorRef.current;\n prevCursorRef.current = state.cursor;\n if (prev === state.cursor) return;\n const btn = rootRef.current?.querySelector<HTMLButtonElement>(\n '[data-cursor=\"true\"]',\n );\n btn?.focus();\n }, [state.cursor]);\n\n const handleKeyDown = useCallback(\n (e: Parameters<NonNullable<CalendarProps[\"onKeyDown\"]>>[0]) => {\n const action = keyToAction(e.key);\n if (action === undefined) return;\n e.preventDefault();\n switch (action) {\n case \"prev\":\n goPrev();\n break;\n case \"next\":\n goNext();\n break;\n default:\n moveCursor(action);\n }\n },\n [moveCursor, goPrev, goNext],\n );\n\n return (\n <Calendar\n ref={rootRef}\n year={state.year}\n month={state.month}\n locale={state.options.locale}\n holidayLocale={state.options.holidayLocale}\n weekStart={state.options.weekStart}\n showWeekNumbers={showWeekNumbers}\n highlight={state.options.highlight}\n range={state.options.range}\n today={state.options.today}\n isDateDisabled={isDateDisabled}\n theme={theme}\n colorScheme={colorScheme}\n size={size}\n responsive={responsive}\n style={style}\n interactive\n renderCell={renderCell}\n cellData={cellData}\n selectedDate={hook.selectedDate}\n cursorDate={hook.cursorDate}\n hoveredDate={hook.hoveredDate}\n rangePreview={rangePreview}\n onDateClick={handleDateClick}\n onDateHover={handleDateHover}\n onDateLeave={handleDateLeave}\n onKeyDown={handleKeyDown}\n />\n );\n}\n"],"mappings":";;;;;;;AAiBA,SAAgBA,iBAAe,MAAmC;CAChE,OAAOC,eAAmB,IAAI;AAChC;;;;AC2FA,SAAgB,SAAS,EACvB,MACA,OACA,SAAS,MACT,eACA,YAAY,UACZ,kBAAkB,OAClB,WACA,OACA,OACA,QAAQ,WACR,cAAc,WACd,OAAO,MACP,aAAa,OACb,OACA,cAAc,OACd,aACA,aACA,aACA,WACA,eAAe,MACf,aAAa,MACb,cAAc,MACd,YACA,UACA,gBACA,cACA,OACgB;CAEhB,MAAM,OAAO,cACL,eAAe,MAAM,OAAO,SAAS,GAC3C;EAAC;EAAM;EAAO;CAAS,CACzB;CAEA,MAAM,mBAAmB,MAAY,SAAmB;EACtD,IAAI,eAAe,aAAa,YAAY,MAAM,IAAI;CACxD;CAEA,MAAM,mBAAmB,SAAe;EACtC,IAAI,eAAe,aAAa,YAAY,IAAI;CAClD;CAEA,MAAM,yBAAyB;EAC7B,IAAI,eAAe,aAAa,YAAY;CAC9C;CAEA,MAAM,QAAQ,GAAG,aAAa,QAAQ,K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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typescript-calendar-lib/react",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "React 19 calendar components with CSS themes and color schemes",
5
5
  "type": "module",
6
6
  "repository": {
@@ -28,9 +28,9 @@
28
28
  ],
29
29
  "license": "MIT",
30
30
  "dependencies": {
31
- "@typescript-calendar-lib/core": "^0.5.3",
32
- "@typescript-calendar-lib/tui": "^0.5.3",
33
- "@typescript-calendar-lib/web": "^0.5.3"
31
+ "@typescript-calendar-lib/core": "^0.5.4",
32
+ "@typescript-calendar-lib/tui": "^0.5.4",
33
+ "@typescript-calendar-lib/web": "^0.5.4"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@testing-library/react": "^16",