react-yearly-calendar-grid 0.4.0 → 0.5.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.
package/README.ja.md ADDED
@@ -0,0 +1,229 @@
1
+ # react-yearly-calendar-grid
2
+
3
+ 年間カレンダーを表示するReactコンポーネント。ドラッグ&ドロップでイベントの移動・リサイズが可能。
4
+
5
+ [English](./README.md)
6
+
7
+ ## インストール
8
+
9
+ ```bash
10
+ npm install react-yearly-calendar-grid
11
+ ```
12
+
13
+ ## 基本的な使い方
14
+
15
+ ```tsx
16
+ import { YearlyCalendar, CalendarEvent } from 'react-yearly-calendar-grid';
17
+
18
+ const events: CalendarEvent[] = [
19
+ {
20
+ id: '1',
21
+ date: new Date(2026, 0, 15),
22
+ title: '会議',
23
+ category: 'work',
24
+ },
25
+ {
26
+ id: '2',
27
+ date: new Date(2026, 1, 10),
28
+ endDate: new Date(2026, 1, 14),
29
+ title: '出張',
30
+ category: 'travel',
31
+ },
32
+ ];
33
+
34
+ const categoryColors = {
35
+ work: '#2563eb',
36
+ travel: '#16a34a',
37
+ };
38
+
39
+ function App() {
40
+ return (
41
+ <div style={{ height: '100vh' }}>
42
+ <YearlyCalendar
43
+ year={2026}
44
+ events={events}
45
+ categoryColors={categoryColors}
46
+ onEventClick={(event) => console.log('Clicked:', event)}
47
+ onDateClick={(date, events) => console.log('Date:', date, events)}
48
+ onEventMove={(event, newStart, newEnd) => {
49
+ console.log('Moved:', event.title, 'to', newStart);
50
+ }}
51
+ />
52
+ </div>
53
+ );
54
+ }
55
+ ```
56
+
57
+ ## Props
58
+
59
+ | Prop | 型 | 必須 | 説明 |
60
+ |------|-----|------|------|
61
+ | `year` | `number` | ○ | 表示する年 |
62
+ | `events` | `CalendarEvent[]` | - | イベント配列 |
63
+ | `holidays` | `Holiday[]` | - | 祝日配列 |
64
+ | `categoryColors` | `Record<string, string>` | - | カテゴリごとの色 |
65
+ | `theme` | `ThemeColors` | - | テーマカラー設定 |
66
+ | `highlightRange` | `{ start: Date; end: Date } \| null` | - | ハイライトする日付範囲 |
67
+ | `onDateClick` | `(date: Date, events: CalendarEvent[]) => void` | - | 日付クリック時 |
68
+ | `onDateDoubleClick` | `(date: Date, events: CalendarEvent[]) => void` | - | 日付ダブルクリック時 |
69
+ | `onDateRangeSelect` | `(startDate: Date, endDate: Date) => void` | - | 日付範囲選択時 |
70
+ | `onEventClick` | `(event: CalendarEvent) => void` | - | イベントクリック時 |
71
+ | `onEventMove` | `(event, newStartDate, newEndDate) => void` | - | イベント移動/リサイズ時 |
72
+
73
+ ## CalendarEvent
74
+
75
+ ```ts
76
+ interface CalendarEvent {
77
+ id: string; // 一意のID
78
+ date: Date; // 開始日
79
+ endDate?: Date; // 終了日(複数日イベントの場合)
80
+ title: string; // タイトル
81
+ color?: string; // 個別の色(categoryColorsより優先)
82
+ category?: string; // カテゴリ(categoryColorsで色を指定)
83
+ }
84
+ ```
85
+
86
+ ## Holiday
87
+
88
+ ```ts
89
+ interface Holiday {
90
+ date: Date; // 祝日の日付
91
+ name: string; // 祝日名
92
+ }
93
+ ```
94
+
95
+ ### 祝日の使用例
96
+
97
+ ```tsx
98
+ import { YearlyCalendar, Holiday } from 'react-yearly-calendar-grid';
99
+
100
+ const holidays: Holiday[] = [
101
+ { date: new Date(2026, 0, 1), name: '元日' },
102
+ { date: new Date(2026, 0, 12), name: '成人の日' },
103
+ { date: new Date(2026, 1, 11), name: '建国記念の日' },
104
+ { date: new Date(2026, 1, 23), name: '天皇誕生日' },
105
+ { date: new Date(2026, 2, 20), name: '春分の日' },
106
+ { date: new Date(2026, 3, 29), name: '昭和の日' },
107
+ { date: new Date(2026, 4, 3), name: '憲法記念日' },
108
+ { date: new Date(2026, 4, 4), name: 'みどりの日' },
109
+ { date: new Date(2026, 4, 5), name: 'こどもの日' },
110
+ { date: new Date(2026, 6, 20), name: '海の日' },
111
+ { date: new Date(2026, 7, 11), name: '山の日' },
112
+ { date: new Date(2026, 8, 21), name: '敬老の日' },
113
+ { date: new Date(2026, 8, 23), name: '秋分の日' },
114
+ { date: new Date(2026, 9, 12), name: 'スポーツの日' },
115
+ { date: new Date(2026, 10, 3), name: '文化の日' },
116
+ { date: new Date(2026, 10, 23), name: '勤労感謝の日' },
117
+ ];
118
+
119
+ function App() {
120
+ return (
121
+ <YearlyCalendar
122
+ year={2026}
123
+ holidays={holidays}
124
+ theme={{
125
+ bgHoliday: '#fef2f2', // 祝日の背景色
126
+ }}
127
+ />
128
+ );
129
+ }
130
+ ```
131
+
132
+ ## 機能
133
+
134
+ ### ドラッグ&ドロップ
135
+ イベントをドラッグして別の日に移動できます。複数日イベントは期間を維持したまま移動します。
136
+
137
+ ### リサイズ
138
+ 複数日イベントの上端/下端をドラッグして期間を伸縮できます。
139
+
140
+ ### 月またぎ表示
141
+ 複数月にまたがるイベントは各月に連続して表示されます。
142
+
143
+ ### 日付範囲選択
144
+ 日付をドラッグして範囲を選択できます。
145
+
146
+ ## テーマカスタマイズ
147
+
148
+ 全てのテーマプロパティはオプションです。変更したいプロパティのみ指定すれば、それ以外はデフォルト値が使用されます。
149
+
150
+ ```tsx
151
+ <YearlyCalendar
152
+ year={2026}
153
+ events={events}
154
+ theme={{
155
+ bgSunday: '#ffe4e6', // 日曜日の背景色
156
+ bgSaturday: '#e0f2fe', // 土曜日の背景色
157
+ bgHoliday: '#fef2f2', // 祝日の背景色
158
+ buttonPrimary: '#059669', // ボタン色
159
+ tooltipBg: '#1f2937', // ツールチップ背景
160
+ }}
161
+ />
162
+ ```
163
+
164
+ ### ThemeColors
165
+
166
+ | プロパティ | 説明 | デフォルト |
167
+ |-----------|------|-----------|
168
+ | `bgWhite` | 通常セル背景 | `#ffffff` |
169
+ | `bgGray50` | ホバー時背景 | `#f9fafb` |
170
+ | `bgGray100` | ヘッダー背景 | `#f3f4f6` |
171
+ | `bgSunday` | 日曜日背景 | `#fef2f2` |
172
+ | `bgSaturday` | 土曜日背景 | `#eff6ff` |
173
+ | `bgHoliday` | 祝日背景 | `#fef2f2` |
174
+ | `bgDropHighlight` | ドロップ先ハイライト | `rgba(191, 219, 254, 0.5)` |
175
+ | `borderDefault` | ボーダー色 | `#d1d5db` |
176
+ | `borderDropHighlight` | ドロップ先ボーダー | `#3b82f6` |
177
+ | `textPrimary` | メインテキスト | `#111827` |
178
+ | `textSecondary` | サブテキスト | `#4b5563` |
179
+ | `textMuted` | 薄いテキスト | `#6b7280` |
180
+ | `tooltipBg` | ツールチップ背景 | `#111827` |
181
+ | `tooltipText` | ツールチップ文字 | `#ffffff` |
182
+ | `buttonPrimary` | ボタン背景 | `#2563eb` |
183
+ | `buttonPrimaryHover` | ボタンホバー | `#1d4ed8` |
184
+ | `floatingDateBg` | ドラッグ中日付表示 | `#2563eb` |
185
+ | `resizeFloatingBg` | リサイズ中日付表示 | `#9333ea` |
186
+
187
+ ## イベント移動の実装例
188
+
189
+ ```tsx
190
+ import { useState, useCallback } from 'react';
191
+ import { YearlyCalendar, CalendarEvent } from 'react-yearly-calendar-grid';
192
+
193
+ function App() {
194
+ const [events, setEvents] = useState<CalendarEvent[]>([
195
+ { id: '1', date: new Date(2026, 0, 15), title: '予定1' },
196
+ ]);
197
+
198
+ const handleEventMove = useCallback(
199
+ (event: CalendarEvent, newStartDate: Date, newEndDate: Date | undefined) => {
200
+ setEvents((prev) =>
201
+ prev.map((e) =>
202
+ e.id === event.id
203
+ ? { ...e, date: newStartDate, endDate: newEndDate }
204
+ : e
205
+ )
206
+ );
207
+ },
208
+ []
209
+ );
210
+
211
+ return (
212
+ <YearlyCalendar
213
+ year={2026}
214
+ events={events}
215
+ onEventMove={handleEventMove}
216
+ />
217
+ );
218
+ }
219
+ ```
220
+
221
+ ## 注意点
222
+
223
+ - コンテナに高さを指定してください(`height: 100vh` など)
224
+ - カレンダーは親要素いっぱいに広がります
225
+ - 依存ライブラリなし(React/ReactDOM のみ peerDependency)
226
+
227
+ ## License
228
+
229
+ MIT
package/README.md CHANGED
@@ -1,14 +1,16 @@
1
1
  # react-yearly-calendar-grid
2
2
 
3
- 年間カレンダーを表示するReactコンポーネント。ドラッグ&ドロップでイベントの移動・リサイズが可能。
3
+ A React component that displays a yearly calendar grid. Supports drag & drop for moving and resizing events.
4
4
 
5
- ## インストール
5
+ [Japanese / 日本語](./README.ja.md)
6
+
7
+ ## Installation
6
8
 
7
9
  ```bash
8
10
  npm install react-yearly-calendar-grid
9
11
  ```
10
12
 
11
- ## 基本的な使い方
13
+ ## Basic Usage
12
14
 
13
15
  ```tsx
14
16
  import { YearlyCalendar, CalendarEvent } from 'react-yearly-calendar-grid';
@@ -17,14 +19,14 @@ const events: CalendarEvent[] = [
17
19
  {
18
20
  id: '1',
19
21
  date: new Date(2026, 0, 15),
20
- title: '会議',
22
+ title: 'Meeting',
21
23
  category: 'work',
22
24
  },
23
25
  {
24
26
  id: '2',
25
27
  date: new Date(2026, 1, 10),
26
28
  endDate: new Date(2026, 1, 14),
27
- title: '出張',
29
+ title: 'Business Trip',
28
30
  category: 'travel',
29
31
  },
30
32
  ];
@@ -54,78 +56,121 @@ function App() {
54
56
 
55
57
  ## Props
56
58
 
57
- | Prop | | 必須 | 説明 |
58
- |------|-----|------|------|
59
- | `year` | `number` | | 表示する年 |
60
- | `events` | `CalendarEvent[]` | - | イベント配列 |
61
- | `categoryColors` | `Record<string, string>` | - | カテゴリごとの色 |
62
- | `theme` | `ThemeColors` | - | テーマカラー設定 |
63
- | `onDateClick` | `(date: Date, events: CalendarEvent[]) => void` | - | 日付クリック時 |
64
- | `onEventClick` | `(event: CalendarEvent) => void` | - | イベントクリック時 |
65
- | `onEventMove` | `(event, newStartDate, newEndDate) => void` | - | イベント移動/リサイズ時 |
59
+ | Prop | Type | Required | Description |
60
+ |------|------|----------|-------------|
61
+ | `year` | `number` | Yes | The year to display |
62
+ | `events` | `CalendarEvent[]` | No | Array of events |
63
+ | `holidays` | `Holiday[]` | No | Array of holidays |
64
+ | `categoryColors` | `Record<string, string>` | No | Colors for each category |
65
+ | `theme` | `ThemeColors` | No | Theme color settings |
66
+ | `highlightRange` | `{ start: Date; end: Date } \| null` | No | Date range to highlight |
67
+ | `onDateClick` | `(date: Date, events: CalendarEvent[]) => void` | No | Called when a date is clicked |
68
+ | `onDateDoubleClick` | `(date: Date, events: CalendarEvent[]) => void` | No | Called when a date is double-clicked |
69
+ | `onDateRangeSelect` | `(startDate: Date, endDate: Date) => void` | No | Called when a date range is selected |
70
+ | `onEventClick` | `(event: CalendarEvent) => void` | No | Called when an event is clicked |
71
+ | `onEventMove` | `(event, newStartDate, newEndDate) => void` | No | Called when an event is moved or resized |
66
72
 
67
73
  ## CalendarEvent
68
74
 
69
75
  ```ts
70
76
  interface CalendarEvent {
71
- id: string; // 一意のID
72
- date: Date; // 開始日
73
- endDate?: Date; // 終了日(複数日イベントの場合)
74
- title: string; // タイトル
75
- color?: string; // 個別の色(categoryColorsより優先)
76
- category?: string; // カテゴリ(categoryColorsで色を指定)
77
+ id: string; // Unique ID
78
+ date: Date; // Start date
79
+ endDate?: Date; // End date (for multi-day events)
80
+ title: string; // Title
81
+ color?: string; // Individual color (overrides categoryColors)
82
+ category?: string; // Category (use categoryColors to specify color)
83
+ }
84
+ ```
85
+
86
+ ## Holiday
87
+
88
+ ```ts
89
+ interface Holiday {
90
+ date: Date; // Holiday date
91
+ name: string; // Holiday name
92
+ }
93
+ ```
94
+
95
+ ### Holidays Example
96
+
97
+ ```tsx
98
+ import { YearlyCalendar, Holiday } from 'react-yearly-calendar-grid';
99
+
100
+ const holidays: Holiday[] = [
101
+ { date: new Date(2026, 0, 1), name: "New Year's Day" },
102
+ { date: new Date(2026, 11, 25), name: 'Christmas' },
103
+ ];
104
+
105
+ function App() {
106
+ return (
107
+ <YearlyCalendar
108
+ year={2026}
109
+ holidays={holidays}
110
+ theme={{
111
+ bgHoliday: '#fef2f2', // Holiday background color
112
+ }}
113
+ />
114
+ );
77
115
  }
78
116
  ```
79
117
 
80
- ## 機能
118
+ ## Features
119
+
120
+ ### Drag & Drop
121
+ Drag events to move them to different dates. Multi-day events maintain their duration when moved.
122
+
123
+ ### Resize
124
+ Drag the top or bottom edge of multi-day events to extend or shorten their duration.
81
125
 
82
- ### ドラッグ&ドロップ
83
- イベントをドラッグして別の日に移動できます。複数日イベントは期間を維持したまま移動します。
126
+ ### Cross-Month Display
127
+ Events spanning multiple months are displayed continuously across each month.
84
128
 
85
- ### リサイズ
86
- 複数日イベントの上端/下端をドラッグして期間を伸縮できます。
129
+ ### Date Range Selection
130
+ Click and drag across dates to select a date range.
87
131
 
88
- ### 月またぎ表示
89
- 複数月にまたがるイベントは各月に連続して表示されます。
132
+ ## Theme Customization
90
133
 
91
- ## テーマカスタマイズ
134
+ All theme properties are optional. Only specify the properties you want to override - unspecified properties will use default values.
92
135
 
93
136
  ```tsx
94
137
  <YearlyCalendar
95
138
  year={2026}
96
139
  events={events}
97
140
  theme={{
98
- bgSunday: '#ffe4e6', // 日曜日の背景色
99
- bgSaturday: '#e0f2fe', // 土曜日の背景色
100
- buttonPrimary: '#059669', // ボタン色
101
- tooltipBg: '#1f2937', // ツールチップ背景
141
+ bgSunday: '#ffe4e6', // Sunday background color
142
+ bgSaturday: '#e0f2fe', // Saturday background color
143
+ bgHoliday: '#fef2f2', // Holiday background color
144
+ buttonPrimary: '#059669', // Button color
145
+ tooltipBg: '#1f2937', // Tooltip background
102
146
  }}
103
147
  />
104
148
  ```
105
149
 
106
150
  ### ThemeColors
107
151
 
108
- | プロパティ | 説明 | デフォルト |
109
- |-----------|------|-----------|
110
- | `bgWhite` | 通常セル背景 | `#ffffff` |
111
- | `bgGray50` | ホバー時背景 | `#f9fafb` |
112
- | `bgGray100` | ヘッダー背景 | `#f3f4f6` |
113
- | `bgSunday` | 日曜日背景 | `#fef2f2` |
114
- | `bgSaturday` | 土曜日背景 | `#eff6ff` |
115
- | `bgDropHighlight` | ドロップ先ハイライト | `rgba(191, 219, 254, 0.5)` |
116
- | `borderDefault` | ボーダー色 | `#d1d5db` |
117
- | `borderDropHighlight` | ドロップ先ボーダー | `#3b82f6` |
118
- | `textPrimary` | メインテキスト | `#111827` |
119
- | `textSecondary` | サブテキスト | `#4b5563` |
120
- | `textMuted` | 薄いテキスト | `#6b7280` |
121
- | `tooltipBg` | ツールチップ背景 | `#111827` |
122
- | `tooltipText` | ツールチップ文字 | `#ffffff` |
123
- | `buttonPrimary` | ボタン背景 | `#2563eb` |
124
- | `buttonPrimaryHover` | ボタンホバー | `#1d4ed8` |
125
- | `floatingDateBg` | ドラッグ中日付表示 | `#2563eb` |
126
- | `resizeFloatingBg` | リサイズ中日付表示 | `#9333ea` |
127
-
128
- ## イベント移動の実装例
152
+ | Property | Description | Default |
153
+ |----------|-------------|---------|
154
+ | `bgWhite` | Normal cell background | `#ffffff` |
155
+ | `bgGray50` | Hover background | `#f9fafb` |
156
+ | `bgGray100` | Header background | `#f3f4f6` |
157
+ | `bgSunday` | Sunday background | `#fef2f2` |
158
+ | `bgSaturday` | Saturday background | `#eff6ff` |
159
+ | `bgHoliday` | Holiday background | `#fef2f2` |
160
+ | `bgDropHighlight` | Drop target highlight | `rgba(191, 219, 254, 0.5)` |
161
+ | `borderDefault` | Border color | `#d1d5db` |
162
+ | `borderDropHighlight` | Drop target border | `#3b82f6` |
163
+ | `textPrimary` | Main text color | `#111827` |
164
+ | `textSecondary` | Secondary text color | `#4b5563` |
165
+ | `textMuted` | Muted text color | `#6b7280` |
166
+ | `tooltipBg` | Tooltip background | `#111827` |
167
+ | `tooltipText` | Tooltip text color | `#ffffff` |
168
+ | `buttonPrimary` | Button background | `#2563eb` |
169
+ | `buttonPrimaryHover` | Button hover background | `#1d4ed8` |
170
+ | `floatingDateBg` | Dragging date display background | `#2563eb` |
171
+ | `resizeFloatingBg` | Resizing date display background | `#9333ea` |
172
+
173
+ ## Event Move Implementation Example
129
174
 
130
175
  ```tsx
131
176
  import { useState, useCallback } from 'react';
@@ -133,7 +178,7 @@ import { YearlyCalendar, CalendarEvent } from 'react-yearly-calendar-grid';
133
178
 
134
179
  function App() {
135
180
  const [events, setEvents] = useState<CalendarEvent[]>([
136
- { id: '1', date: new Date(2026, 0, 15), title: '予定1' },
181
+ { id: '1', date: new Date(2026, 0, 15), title: 'Event 1' },
137
182
  ]);
138
183
 
139
184
  const handleEventMove = useCallback(
@@ -159,11 +204,11 @@ function App() {
159
204
  }
160
205
  ```
161
206
 
162
- ## 注意点
207
+ ## Notes
163
208
 
164
- - コンテナに高さを指定してください(`height: 100vh` など)
165
- - カレンダーは親要素いっぱいに広がります
166
- - 依存ライブラリなし(React/ReactDOM のみ peerDependency)
209
+ - Set a height on the container (e.g., `height: 100vh`)
210
+ - The calendar expands to fill its parent element
211
+ - No external dependencies (only React/ReactDOM as peerDependencies)
167
212
 
168
213
  ## License
169
214
 
package/dist/index.d.mts CHANGED
@@ -9,12 +9,17 @@ interface CalendarEvent {
9
9
  color?: string;
10
10
  category?: string;
11
11
  }
12
+ interface Holiday {
13
+ date: Date;
14
+ name: string;
15
+ }
12
16
  interface ThemeColors {
13
17
  bgWhite?: string;
14
18
  bgGray50?: string;
15
19
  bgGray100?: string;
16
20
  bgSunday?: string;
17
21
  bgSaturday?: string;
22
+ bgHoliday?: string;
18
23
  bgDropHighlight?: string;
19
24
  borderDefault?: string;
20
25
  borderDropHighlight?: string;
@@ -32,6 +37,7 @@ interface ThemeColors {
32
37
  interface YearlyCalendarProps {
33
38
  year: number;
34
39
  events?: CalendarEvent[];
40
+ holidays?: Holiday[];
35
41
  onDateClick?: (date: Date, events: CalendarEvent[]) => void;
36
42
  onDateDoubleClick?: (date: Date, events: CalendarEvent[]) => void;
37
43
  onDateRangeSelect?: (startDate: Date, endDate: Date) => void;
@@ -53,7 +59,7 @@ interface DayCellProps {
53
59
  onEventClick?: (event: CalendarEvent) => void;
54
60
  }
55
61
 
56
- declare function YearlyCalendar({ year, events, onDateClick, onDateDoubleClick, onDateRangeSelect, onEventClick, onEventMove, highlightRange, categoryColors, theme: customTheme, }: YearlyCalendarProps): react_jsx_runtime.JSX.Element;
62
+ declare function YearlyCalendar({ year, events, holidays, onDateClick, onDateDoubleClick, onDateRangeSelect, onEventClick, onEventMove, highlightRange, categoryColors, theme: customTheme, }: YearlyCalendarProps): react_jsx_runtime.JSX.Element;
57
63
 
58
64
  declare const defaultTheme: Required<ThemeColors>;
59
65
  declare function mergeTheme(custom?: ThemeColors): Required<ThemeColors>;
@@ -98,4 +104,4 @@ declare function createStyles(theme: Required<ThemeColors>): {
98
104
  truncate: CSSProperties;
99
105
  };
100
106
 
101
- export { type CalendarEvent, type DayCellProps, type ThemeColors, YearlyCalendar, type YearlyCalendarProps, createStyles, defaultTheme, mergeTheme };
107
+ export { type CalendarEvent, type DayCellProps, type Holiday, type ThemeColors, YearlyCalendar, type YearlyCalendarProps, createStyles, defaultTheme, mergeTheme };
package/dist/index.d.ts CHANGED
@@ -9,12 +9,17 @@ interface CalendarEvent {
9
9
  color?: string;
10
10
  category?: string;
11
11
  }
12
+ interface Holiday {
13
+ date: Date;
14
+ name: string;
15
+ }
12
16
  interface ThemeColors {
13
17
  bgWhite?: string;
14
18
  bgGray50?: string;
15
19
  bgGray100?: string;
16
20
  bgSunday?: string;
17
21
  bgSaturday?: string;
22
+ bgHoliday?: string;
18
23
  bgDropHighlight?: string;
19
24
  borderDefault?: string;
20
25
  borderDropHighlight?: string;
@@ -32,6 +37,7 @@ interface ThemeColors {
32
37
  interface YearlyCalendarProps {
33
38
  year: number;
34
39
  events?: CalendarEvent[];
40
+ holidays?: Holiday[];
35
41
  onDateClick?: (date: Date, events: CalendarEvent[]) => void;
36
42
  onDateDoubleClick?: (date: Date, events: CalendarEvent[]) => void;
37
43
  onDateRangeSelect?: (startDate: Date, endDate: Date) => void;
@@ -53,7 +59,7 @@ interface DayCellProps {
53
59
  onEventClick?: (event: CalendarEvent) => void;
54
60
  }
55
61
 
56
- declare function YearlyCalendar({ year, events, onDateClick, onDateDoubleClick, onDateRangeSelect, onEventClick, onEventMove, highlightRange, categoryColors, theme: customTheme, }: YearlyCalendarProps): react_jsx_runtime.JSX.Element;
62
+ declare function YearlyCalendar({ year, events, holidays, onDateClick, onDateDoubleClick, onDateRangeSelect, onEventClick, onEventMove, highlightRange, categoryColors, theme: customTheme, }: YearlyCalendarProps): react_jsx_runtime.JSX.Element;
57
63
 
58
64
  declare const defaultTheme: Required<ThemeColors>;
59
65
  declare function mergeTheme(custom?: ThemeColors): Required<ThemeColors>;
@@ -98,4 +104,4 @@ declare function createStyles(theme: Required<ThemeColors>): {
98
104
  truncate: CSSProperties;
99
105
  };
100
106
 
101
- export { type CalendarEvent, type DayCellProps, type ThemeColors, YearlyCalendar, type YearlyCalendarProps, createStyles, defaultTheme, mergeTheme };
107
+ export { type CalendarEvent, type DayCellProps, type Holiday, type ThemeColors, YearlyCalendar, type YearlyCalendarProps, createStyles, defaultTheme, mergeTheme };
package/dist/index.js CHANGED
@@ -32,6 +32,7 @@ var defaultTheme = {
32
32
  bgGray100: "#f3f4f6",
33
33
  bgSunday: "#fef2f2",
34
34
  bgSaturday: "#eff6ff",
35
+ bgHoliday: "#fef2f2",
35
36
  bgDropHighlight: "rgba(191, 219, 254, 0.5)",
36
37
  // ボーダー
37
38
  borderDefault: "#d1d5db",
@@ -337,9 +338,10 @@ function createStyles(theme) {
337
338
  }
338
339
  };
339
340
  }
340
- function getCellBackgroundColor(theme, isValidDay, isSunday2, isSaturday2, isHovered) {
341
+ function getCellBackgroundColor(theme, isValidDay, isSunday2, isSaturday2, isHovered, isHoliday = false) {
341
342
  if (!isValidDay) return theme.bgGray100;
342
343
  if (isHovered) return theme.bgGray50;
344
+ if (isHoliday) return theme.bgHoliday;
343
345
  if (isSunday2) return theme.bgSunday;
344
346
  if (isSaturday2) return theme.bgSaturday;
345
347
  return theme.bgWhite;
@@ -412,6 +414,7 @@ function calculateLanes(spans) {
412
414
  function YearlyCalendar({
413
415
  year,
414
416
  events = [],
417
+ holidays = [],
415
418
  onDateClick,
416
419
  onDateDoubleClick,
417
420
  onDateRangeSelect,
@@ -458,6 +461,18 @@ function YearlyCalendar({
458
461
  const [rangeSelectionStart, setRangeSelectionStart] = react.useState(null);
459
462
  const [rangeSelectionEnd, setRangeSelectionEnd] = react.useState(null);
460
463
  const isRangeSelecting = rangeSelectionStart !== null;
464
+ const holidayMap = react.useMemo(() => {
465
+ const map = /* @__PURE__ */ new Map();
466
+ holidays.forEach((holiday) => {
467
+ const dateKey = `${holiday.date.getFullYear()}-${holiday.date.getMonth()}-${holiday.date.getDate()}`;
468
+ map.set(dateKey, holiday);
469
+ });
470
+ return map;
471
+ }, [holidays]);
472
+ const isHoliday = (month, day) => {
473
+ const dateKey = `${year}-${month}-${day}`;
474
+ return holidayMap.has(dateKey);
475
+ };
461
476
  const monthSpans = react.useMemo(() => {
462
477
  const result = [];
463
478
  for (let month = 0; month < 12; month++) {
@@ -830,6 +845,7 @@ function YearlyCalendar({
830
845
  const isValidDay = day <= daysInMonth;
831
846
  const sunday = isValidDay && isSunday(year, monthIndex, day);
832
847
  const saturday = isValidDay && isSaturday(year, monthIndex, day);
848
+ const holiday = isValidDay && isHoliday(monthIndex, day);
833
849
  const isHovered = (hoveredCell == null ? void 0 : hoveredCell.month) === monthIndex && (hoveredCell == null ? void 0 : hoveredCell.day) === day;
834
850
  const isInRange = isValidDay && isInSelectionRange(monthIndex, day);
835
851
  const isHighlighted = isValidDay && isInHighlightRange(monthIndex, day);
@@ -843,7 +859,8 @@ function YearlyCalendar({
843
859
  isValidDay,
844
860
  sunday,
845
861
  saturday,
846
- isHovered && isValidDay && !isRangeSelecting
862
+ isHovered && isValidDay && !isRangeSelecting,
863
+ holiday
847
864
  ),
848
865
  cursor: isValidDay ? "pointer" : "default",
849
866
  userSelect: "none"