@umituz/react-native-design-system 2.6.87 → 2.6.88

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.
@@ -0,0 +1,339 @@
1
+ # AtomicCalendar
2
+
3
+ AtomicCalendar, React Native için tam özellikli bir takvim bileşenidir. Aylık görünümde etkinlik gösterimi, tarih seçimi ve özelleştirme desteği sunar.
4
+
5
+ ## Özellikler
6
+
7
+ - 📅 **Aylık Görünüm**: 6 haftalık 42 günlük grid
8
+ - 🎯 **Tarih Seçimi**: Interactive tarih seçimi
9
+ - 🔵 **Event Indicators**: Etkinlik noktaları gösterimi
10
+ - 🌍 **Timezone Bilinci**: Timezone uyumlu
11
+ - 🎨 **Özelleştirilebilir**: Stil ve tema desteği
12
+ - ♿ **Erişilebilir**: Tam erişilebilirlik desteği
13
+ - 📱 **Responsive**: Cihaz boyutuna uyum
14
+
15
+ ## Kurulum
16
+
17
+ ```tsx
18
+ import { AtomicCalendar } from 'react-native-design-system';
19
+ ```
20
+
21
+ ## Temel Kullanım
22
+
23
+ ```tsx
24
+ import React, { useState } from 'react';
25
+ import { View } from 'react-native';
26
+ import { AtomicCalendar } from 'react-native-design-system';
27
+
28
+ export const BasicExample = () => {
29
+ const [selectedDate, setSelectedDate] = useState(new Date());
30
+
31
+ // Calendar days'i hesaplayın (custom hook veya service kullanabilirsiniz)
32
+ const days = calculateCalendarDays(selectedDate);
33
+
34
+ return (
35
+ <View style={{ padding: 16 }}>
36
+ <AtomicCalendar
37
+ days={days}
38
+ selectedDate={selectedDate}
39
+ onDateSelect={setSelectedDate}
40
+ />
41
+ </View>
42
+ );
43
+ };
44
+ ```
45
+
46
+ ## Basic Calendar
47
+
48
+ ```tsx
49
+ <AtomicCalendar
50
+ days={calendarDays}
51
+ selectedDate={selectedDate}
52
+ onDateSelect={(date) => setSelectedDate(date)}
53
+ />
54
+ ```
55
+
56
+ ## Weekday Headers Gizle
57
+
58
+ ```tsx
59
+ <AtomicCalendar
60
+ days={calendarDays}
61
+ selectedDate={selectedDate}
62
+ onDateSelect={setSelectedDate}
63
+ showWeekdayHeaders={false}
64
+ />
65
+ ```
66
+
67
+ ## Event Indicators
68
+
69
+ ```tsx
70
+ <AtomicCalendar
71
+ days={calendarDays}
72
+ selectedDate={selectedDate}
73
+ onDateSelect={setSelectedDate}
74
+ maxEventIndicators={3}
75
+ />
76
+ ```
77
+
78
+ ## Custom Day Style
79
+
80
+ ```tsx
81
+ <AtomicCalendar
82
+ days={calendarDays}
83
+ selectedDate={selectedDate}
84
+ onDateSelect={setSelectedDate}
85
+ dayStyle={{ borderRadius: 8 }}
86
+ />
87
+ ```
88
+
89
+ ## Örnek Kullanımlar
90
+
91
+ ### Etkinlik Takvimi
92
+
93
+ ```tsx
94
+ export const EventCalendar = () => {
95
+ const [selectedDate, setSelectedDate] = useState(new Date());
96
+ const [events] = useState([
97
+ { id: 1, date: new Date(), title: 'Toplantı', color: '#6366f1' },
98
+ { id: 2, date: new Date(), title: 'Yemek', color: '#10b981' },
99
+ ]);
100
+
101
+ return (
102
+ <View style={{ padding: 16 }}>
103
+ <AtomicText type="headlineMedium" style={{ marginBottom: 16 }}>
104
+ Takvim
105
+ </AtomicText>
106
+
107
+ <AtomicCalendar
108
+ days={getCalendarDaysWithEvents(events)}
109
+ selectedDate={selectedDate}
110
+ onDateSelect={setSelectedDate}
111
+ />
112
+ </View>
113
+ );
114
+ };
115
+ ```
116
+
117
+ ### Randevu Takvimi
118
+
119
+ ```tsx
120
+ export const AppointmentCalendar = () => {
121
+ const [selectedDate, setSelectedDate] = useState(new Date());
122
+ const [appointments, setAppointments] = useState([]);
123
+
124
+ const handleDateSelect = (date) => {
125
+ setSelectedDate(date);
126
+ loadAppointmentsForDate(date);
127
+ };
128
+
129
+ return (
130
+ <View style={{ padding: 16 }}>
131
+ <AtomicCalendar
132
+ days={getCalendarDays()}
133
+ selectedDate={selectedDate}
134
+ onDateSelect={handleDateSelect}
135
+ />
136
+
137
+ {selectedDate && (
138
+ <View style={{ marginTop: 16 }}>
139
+ <AtomicText type="titleMedium">
140
+ {selectedDate.toLocaleDateString('tr-TR')}
141
+ </AtomicText>
142
+
143
+ {appointments.length > 0 ? (
144
+ appointments.map((apt) => (
145
+ <AppointmentCard key={apt.id} appointment={apt} />
146
+ ))
147
+ ) : (
148
+ <AtomicText type="bodyMedium" color="textSecondary">
149
+ Randevu yok
150
+ </AtomicText>
151
+ )}
152
+ </View>
153
+ )}
154
+ </View>
155
+ );
156
+ };
157
+ ```
158
+
159
+ ### Görev Takvimi
160
+
161
+ ```tsx
162
+ export const TaskCalendar = () => {
163
+ const [selectedDate, setSelectedDate] = useState(new Date());
164
+
165
+ const getDaysWithTasks = () => {
166
+ const days = calculateCalendarDays(selectedDate);
167
+ return days.map(day => ({
168
+ ...day,
169
+ events: getTasksForDate(day.date).slice(0, 3),
170
+ }));
171
+ };
172
+
173
+ return (
174
+ <View style={{ padding: 16 }}>
175
+ <AtomicCalendar
176
+ days={getDaysWithTasks()}
177
+ selectedDate={selectedDate}
178
+ onDateSelect={setSelectedDate}
179
+ maxEventIndicators={5}
180
+ />
181
+ </View>
182
+ );
183
+ };
184
+ ```
185
+
186
+ ### Doğum Günü Takvimi
187
+
188
+ ```tsx
189
+ export const BirthdayCalendar = () => {
190
+ const [selectedDate, setSelectedDate] = useState(new Date());
191
+ const [birthdays] = useState([
192
+ { id: 1, name: 'Ahmet', date: new Date(), month: 0, day: 15 },
193
+ ]);
194
+
195
+ const getDaysWithBirthdays = () => {
196
+ const days = calculateCalendarDays(selectedDate);
197
+ return days.map(day => ({
198
+ ...day,
199
+ events: birthdays.filter(b =>
200
+ b.month === day.date.getMonth() && b.day === day.date.getDate()
201
+ ),
202
+ }));
203
+ };
204
+
205
+ return (
206
+ <View style={{ padding: 16 }}>
207
+ <AtomicCalendar
208
+ days={getDaysWithBirthdays()}
209
+ selectedDate={selectedDate}
210
+ onDateSelect={setSelectedDate}
211
+ />
212
+ </View>
213
+ );
214
+ };
215
+ ```
216
+
217
+ ### Check-in Takvimi
218
+
219
+ ```tsx
220
+ export const CheckinCalendar = ({ checkins }) => {
221
+ const [selectedDate, setSelectedDate] = useState(new Date());
222
+
223
+ const getDaysWithCheckins = () => {
224
+ const days = calculateCalendarDays(selectedDate);
225
+ return days.map(day => ({
226
+ ...day,
227
+ hasCheckin: checkins.some(c =>
228
+ isSameDay(c.date, day.date)
229
+ ),
230
+ }));
231
+ };
232
+
233
+ return (
234
+ <View style={{ padding: 16 }}>
235
+ <AtomicCalendar
236
+ days={getDaysWithCheckins()}
237
+ selectedDate={selectedDate}
238
+ onDateSelect={setSelectedDate}
239
+ />
240
+ </View>
241
+ );
242
+ };
243
+ ```
244
+
245
+ ## Props
246
+
247
+ ### AtomicCalendarProps
248
+
249
+ | Prop | Tip | Varsayılan | Açıklama |
250
+ |------|-----|------------|----------|
251
+ | `days` | `CalendarDay[]` | - **(Zorunlu)** | Takvim günleri (42 gün) |
252
+ | `selectedDate` | `Date` | - **(Zorunlu)** | Seçili tarih |
253
+ | `onDateSelect` | `(date: Date) => void` | - **(Zorunlu)** | Tarih seçim callback'i |
254
+ | `showWeekdayHeaders` | `boolean` | `true` | Gün başlıklarını göster |
255
+ | `maxEventIndicators` | `number` | `3` | Maksimum etkinlik sayısı |
256
+ | `dayStyle` | `StyleProp<ViewStyle>` | - | Gün hücresi stili |
257
+ | `showEventCount` | `boolean` | `true` | Event sayısını göster |
258
+ | `style` | `StyleProp<ViewStyle>` | - | Container stili |
259
+ | `testID` | `string` | - | Test ID'si |
260
+
261
+ ### CalendarDay
262
+
263
+ ```typescript
264
+ interface CalendarDay {
265
+ date: Date; // Tarih
266
+ isCurrentMonth: boolean; // Mevcut ay mı
267
+ isSelected: boolean; // Seçili mi
268
+ isToday: boolean; // Bugün mü
269
+ events?: Event[]; // Etkinlikler
270
+ isDisabled?: boolean; // Devre dışı mı
271
+ }
272
+ ```
273
+
274
+ ## Best Practices
275
+
276
+ ### 1. Day Hesaplama
277
+
278
+ ```tsx
279
+ // Takvim günlerini hesaplayın
280
+ const calculateCalendarDays = (date: Date) => {
281
+ const year = date.getFullYear();
282
+ const month = date.getMonth();
283
+ const firstDay = new Date(year, month, 1);
284
+ const lastDay = new Date(year, month + 1, 0);
285
+
286
+ // 42 günlük grid (6 hafta)
287
+ const days = [];
288
+ // ... hesaplama logic
289
+ return days;
290
+ };
291
+ ```
292
+
293
+ ### 2. Event Mapping
294
+
295
+ ```tsx
296
+ // Etkinlikleri günlere map edin
297
+ const mapEventsToDays = (days: CalendarDay[], events: Event[]) => {
298
+ return days.map(day => ({
299
+ ...day,
300
+ events: events.filter(e => isSameDay(e.date, day.date)),
301
+ }));
302
+ };
303
+ ```
304
+
305
+ ### 3. Tarih Seçimi
306
+
307
+ ```tsx
308
+ // Tarih seçimi
309
+ const handleDateSelect = (date: Date) => {
310
+ setSelectedDate(date);
311
+ loadEventsForDate(date);
312
+ };
313
+ ```
314
+
315
+ ## Erişilebilirlik
316
+
317
+ AtomicCalendar, tam erişilebilirlik desteği sunar:
318
+
319
+ - ✅ Screen reader desteği
320
+ - ✅ Tarih anonsu
321
+ - ✅ Event bilgileri
322
+ - ✅ Touch uygun boyut
323
+ - ✅ Keyboard navigation (web)
324
+
325
+ ## Performans İpuçları
326
+
327
+ 1. **Memoization**: `days` array'ini memo edin
328
+ 2. **Lazy Loading**: Event'leri lazy load edin
329
+ 3. **Virtualization**: Uzun listelerde virtualization kullanın
330
+
331
+ ## İlgili Bileşenler
332
+
333
+ - [`AtomicDatePicker`](../../atoms/AtomicDatePicker/README.md) - Tarih seçici
334
+ - [`FormField`](../FormField/README.md) - Form alanı
335
+ - [`AtomicButton`](../../atoms/button/README.md) - Buton bileşeni
336
+
337
+ ## Lisans
338
+
339
+ MIT