@umituz/react-native-design-system 2.6.86 → 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,471 @@
1
+ # Alert System
2
+
3
+ React Native Design System, farklı durumlarda kullanılmak üzere kapsamlı bir alert sistemi sunar. Her alert türü farklı kullanım senaryoları için optimize edilmiştir.
4
+
5
+ ## Alert Türleri
6
+
7
+ - **AlertBanner** - Sayfanın üstünde kalıcı uyarı
8
+ - **AlertToast** - Geçici bildirim mesajları
9
+ - **AlertInline** - Form içinde satır içi uyarı
10
+ - **AlertModal** - Modal onay dialog'u
11
+ - **AlertContainer** - Alert yönetim container'ı
12
+
13
+ ## Kurulum
14
+
15
+ ```tsx
16
+ import {
17
+ AlertBanner,
18
+ AlertToast,
19
+ AlertInline,
20
+ AlertModal,
21
+ AlertContainer
22
+ } from 'react-native-design-system';
23
+ ```
24
+
25
+ ## AlertBanner
26
+
27
+ Sayfa üstünde kalıcı uyarı göstermek için kullanılır.
28
+
29
+ ### Temel Kullanım
30
+
31
+ ```tsx
32
+ <AlertBanner
33
+ variant="info"
34
+ title="Bilgilendirme"
35
+ message="Bu özellik yakında kullanıma sunulacak"
36
+ />
37
+ ```
38
+
39
+ ### Variant'lar
40
+
41
+ ```tsx
42
+ <View style={{ gap: 8 }}>
43
+ <AlertBanner variant="info" title="Bilgi" message="Bilgilendirme mesajı" />
44
+ <AlertBanner variant="success" title="Başarılı" message="İşlem başarılı" />
45
+ <AlertBanner variant="warning" title="Uyarı" message="Dikkat edilmesi gereken durum" />
46
+ <AlertBanner variant="error" title="Hata" message="Bir hata oluştu" />
47
+ </View>
48
+ ```
49
+
50
+ ### Kapatılabilir
51
+
52
+ ```tsx
53
+ <AlertBanner
54
+ variant="info"
55
+ title="Güncelleme Mevcut"
56
+ message="Yeni bir sürüm mevcut"
57
+ dismissible
58
+ onDismiss={() => console.log('Kapatıldı')}
59
+ />
60
+ ```
61
+
62
+ ### Action Button
63
+
64
+ ```tsx
65
+ <AlertBanner
66
+ variant="warning"
67
+ title="Oturum Sona Erecek"
68
+ message="Oturumunuz 5 dakika içinde sona erecek"
69
+ actionLabel="Uzat"
70
+ onAction={() => console.log('Uzatıldı')}
71
+ />
72
+ ```
73
+
74
+ ## AlertToast
75
+
76
+ Geçici bildirimler için kullanılır. Otomatik olarak kapanır.
77
+
78
+ ### Temel Kullanım
79
+
80
+ ```tsx
81
+ import { useAlert } from 'react-native-design-system';
82
+
83
+ export const MyComponent = () => {
84
+ const { showToast } = useAlert();
85
+
86
+ const handleSuccess = () => {
87
+ showToast({
88
+ variant: 'success',
89
+ title: 'Başarılı',
90
+ message: 'İşlem tamamlandı',
91
+ });
92
+ };
93
+
94
+ return (
95
+ <Button title="Gönder" onPress={handleSuccess} />
96
+ );
97
+ };
98
+ ```
99
+
100
+ ### Variant'lar
101
+
102
+ ```tsx
103
+ // Success
104
+ showToast({
105
+ variant: 'success',
106
+ title: 'Kaydedildi',
107
+ message: 'Değişiklikleriniz kaydedildi',
108
+ });
109
+
110
+ // Error
111
+ showToast({
112
+ variant: 'error',
113
+ title: 'Hata',
114
+ message: 'İşlem başarısız',
115
+ });
116
+
117
+ // Info
118
+ showToast({
119
+ variant: 'info',
120
+ title: 'Bilgi',
121
+ message: 'Yeni özellik eklendi',
122
+ });
123
+
124
+ // Warning
125
+ showToast({
126
+ variant: 'warning',
127
+ title: 'Uyarı',
128
+ message: 'Lütfen kontrol edin',
129
+ });
130
+ ```
131
+
132
+ ### Custom Süre
133
+
134
+ ```tsx
135
+ showToast({
136
+ variant: 'info',
137
+ title: 'Mesaj',
138
+ message: '5 saniye gösterilecek',
139
+ duration: 5000,
140
+ });
141
+ ```
142
+
143
+ ## AlertInline
144
+
145
+ Form içinde satır içi uyarı için kullanılır.
146
+
147
+ ### Temel Kullanım
148
+
149
+ ```tsx
150
+ <AlertInline
151
+ variant="error"
152
+ message="Bu alan zorunludur"
153
+ />
154
+ ```
155
+
156
+ ### Form ile
157
+
158
+ ```tsx
159
+ <View>
160
+ <FormField
161
+ label="E-posta"
162
+ value={email}
163
+ onChangeText={setEmail}
164
+ error={emailError}
165
+ />
166
+
167
+ {emailError && (
168
+ <AlertInline
169
+ variant="error"
170
+ message="Geçerli bir e-posta adresi girin"
171
+ />
172
+ )}
173
+ </View>
174
+ ```
175
+
176
+ ## AlertModal
177
+
178
+ Kritik onay dialog'ları için kullanılır.
179
+
180
+ ### Temel Kullanım
181
+
182
+ ```tsx
183
+ import { useAlert } from 'react-native-design-system';
184
+
185
+ export const DeleteConfirmation = () => {
186
+ const { showAlert } = useAlert();
187
+
188
+ const handleDelete = () => {
189
+ showAlert({
190
+ variant: 'error',
191
+ title: 'Öğeyi Sil',
192
+ message: 'Bu öğeyi silmek istediğinizden emin misiniz? Bu işlem geri alınamaz.',
193
+ confirmLabel: 'Sil',
194
+ cancelLabel: 'İptal',
195
+ onConfirm: () => {
196
+ // Silme işlemi
197
+ },
198
+ });
199
+ };
200
+
201
+ return (
202
+ <Button title="Sil" onPress={handleDelete} />
203
+ );
204
+ };
205
+ ```
206
+
207
+ ### Variant'lar
208
+
209
+ ```tsx
210
+ // Error
211
+ showAlert({
212
+ variant: 'error',
213
+ title: 'Emin misiniz?',
214
+ message: 'Bu işlem geri alınamaz',
215
+ onConfirm: handleConfirm,
216
+ });
217
+
218
+ // Warning
219
+ showAlert({
220
+ variant: 'warning',
221
+ title: 'Uyarı',
222
+ message: 'Devam etmek istiyor musunuz?',
223
+ onConfirm: handleConfirm,
224
+ });
225
+
226
+ // Info
227
+ showAlert({
228
+ variant: 'info',
229
+ title: 'Bilgi',
230
+ message='Detaylı bilgi',
231
+ onConfirm: handleConfirm,
232
+ });
233
+ ```
234
+
235
+ ## AlertContainer
236
+
237
+ Alert sistemini yönetmek için kullanılır.
238
+
239
+ ### Provider
240
+
241
+ ```tsx
242
+ import { AlertContainer } from 'react-native-design-system';
243
+
244
+ export const App = () => {
245
+ return (
246
+ <AlertContainer>
247
+ <MyApp />
248
+ </AlertContainer>
249
+ );
250
+ };
251
+ ```
252
+
253
+ ### Hook Kullanımı
254
+
255
+ ```tsx
256
+ import { useAlert } from 'react-native-design-system';
257
+
258
+ export const MyComponent = () => {
259
+ const { showToast, showAlert, showBanner } = useAlert();
260
+
261
+ // Toast göster
262
+ const handleSuccess = () => {
263
+ showToast({
264
+ variant: 'success',
265
+ title: 'Başarılı',
266
+ message: 'İşlem tamamlandı',
267
+ });
268
+ };
269
+
270
+ // Alert göster
271
+ const handleConfirm = () => {
272
+ showAlert({
273
+ variant: 'warning',
274
+ title: 'Onay',
275
+ message: 'Emin misiniz?',
276
+ onConfirm: () => console.log('Onaylandı'),
277
+ });
278
+ };
279
+
280
+ return (
281
+ <View>
282
+ <Button title="Başarılı" onPress={handleSuccess} />
283
+ <Button title="Onay" onPress={handleConfirm} />
284
+ </View>
285
+ );
286
+ };
287
+ ```
288
+
289
+ ## Örnek Kullanımlar
290
+
291
+ ### Form Hataları
292
+
293
+ ```tsx
294
+ export const LoginForm = () => {
295
+ const { showToast } = useAlert();
296
+
297
+ const handleSubmit = () => {
298
+ if (!email) {
299
+ showToast({
300
+ variant: 'error',
301
+ title: 'Hata',
302
+ message: 'E-posta alanı zorunludur',
303
+ });
304
+ return;
305
+ }
306
+
307
+ // Form submit
308
+ };
309
+ };
310
+ ```
311
+
312
+ ### API Hataları
313
+
314
+ ```tsx
315
+ export const DataLoader = () => {
316
+ const { showToast } = useAlert();
317
+
318
+ const loadData = async () => {
319
+ try {
320
+ const data = await fetchData();
321
+ showToast({
322
+ variant: 'success',
323
+ title: 'Başarılı',
324
+ message: 'Veriler yüklendi',
325
+ });
326
+ } catch (error) {
327
+ showToast({
328
+ variant: 'error',
329
+ title: 'Hata',
330
+ message: 'Veriler yüklenemedi',
331
+ });
332
+ }
333
+ };
334
+ };
335
+ ```
336
+
337
+ ### Başarı Bildirimi
338
+
339
+ ```tsx
340
+ export const SaveButton = () => {
341
+ const { showToast } = useAlert();
342
+
343
+ const handleSave = async () => {
344
+ await saveData();
345
+ showToast({
346
+ variant: 'success',
347
+ title: 'Kaydedildi',
348
+ message: 'Değişiklikleriniz başarıyla kaydedildi',
349
+ });
350
+ };
351
+ };
352
+ ```
353
+
354
+ ### Silme Onayı
355
+
356
+ ```tsx
357
+ export const DeleteButton = ({ itemId }) => {
358
+ const { showAlert } = useAlert();
359
+
360
+ const handleDelete = () => {
361
+ showAlert({
362
+ variant: 'error',
363
+ title: 'Öğeyi Sil',
364
+ message: 'Bu öğeyi silmek istediğinizden emin misiniz?',
365
+ confirmLabel: 'Sil',
366
+ cancelLabel: 'İptal',
367
+ onConfirm: async () => {
368
+ await deleteItem(itemId);
369
+ showToast({
370
+ variant: 'success',
371
+ title: 'Silindi',
372
+ message: 'Öğe başarıyla silindi',
373
+ });
374
+ },
375
+ });
376
+ };
377
+
378
+ return (
379
+ <Button title="Sil" onPress={handleDelete} />
380
+ );
381
+ };
382
+ ```
383
+
384
+ ### Banner Uyarısı
385
+
386
+ ```tsx
387
+ export const MaintenanceBanner = () => {
388
+ return (
389
+ <AlertBanner
390
+ variant="warning"
391
+ title="Bakım Modu"
392
+ message="Sistem bakımda, bazı özellikler kullanılamayabilir"
393
+ dismissible
394
+ />
395
+ );
396
+ };
397
+ ```
398
+
399
+ ## Best Practices
400
+
401
+ ### 1. Alert Türü Seçimi
402
+
403
+ ```tsx
404
+ // Kritik işlemler için Modal
405
+ showAlert({ variant: 'error', onConfirm: delete });
406
+
407
+ // Başarı için Toast
408
+ showToast({ variant: 'success', message: 'Kaydedildi' });
409
+
410
+ // Form hatası için Inline
411
+ <AlertInline variant="error" message="Geçersiz değer" />
412
+
413
+ // Sayfa uyarısı için Banner
414
+ <AlertBanner variant="info" message="Sistem bakımda" />
415
+ ```
416
+
417
+ ### 2. Message Length
418
+
419
+ ```tsx
420
+ // Kısa ve öz
421
+ showToast({
422
+ message: 'Kaydedildi', // İyi
423
+ });
424
+
425
+ // Uzun ve açıklayıcı
426
+ showAlert({
427
+ message: 'Bu işlem geri alınamaz. Devam etmek istediğinizden emin misiniz?', // İyi
428
+ });
429
+ ```
430
+
431
+ ### 3. Variant Kullanımı
432
+
433
+ ```tsx
434
+ // Başarı
435
+ showToast({ variant: 'success' });
436
+
437
+ // Hata
438
+ showToast({ variant: 'error' });
439
+
440
+ // Uyarı
441
+ showAlert({ variant: 'warning' });
442
+
443
+ // Bilgi
444
+ showBanner({ variant: 'info' });
445
+ ```
446
+
447
+ ## Erişilebilirlik
448
+
449
+ Alert sistemi, tam erişilebilirlik desteği sunar:
450
+
451
+ - ✅ Screen reader desteği
452
+ - ✅ Semantic anlamlar
453
+ - ✅ Auto-dismiss özelliği
454
+ - ✅ Focus management
455
+ - ✅ Keyboard navigation
456
+
457
+ ## Performans İpuçları
458
+
459
+ 1. **Auto-dismiss**: Toast'ları otomatik kapatın
460
+ 2. **Queue**: Alert'ları sıraya alın
461
+ 3. **Unmount**: Kullanılmayan alert'ları unmount edin
462
+
463
+ ## İlgili Bileşenler
464
+
465
+ - [`BaseModal`](../BaseModal/README.md) - Modal bileşeni
466
+ - [`FormField`](../FormField/README.md) - Form alanı
467
+ - [`AtomicButton`](../../atoms/button/README.md) - Buton bileşeni
468
+
469
+ ## Lisans
470
+
471
+ MIT