@umituz/react-native-design-system 2.6.94 → 2.6.96
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/package.json +1 -1
- package/src/atoms/AtomicAvatar.README.md +284 -397
- package/src/atoms/AtomicBadge.README.md +123 -358
- package/src/atoms/AtomicCard.README.md +358 -247
- package/src/atoms/AtomicDatePicker.README.md +127 -332
- package/src/atoms/AtomicFab.README.md +194 -352
- package/src/atoms/AtomicIcon.README.md +241 -274
- package/src/atoms/AtomicProgress.README.md +100 -338
- package/src/atoms/AtomicSpinner.README.md +304 -337
- package/src/atoms/AtomicText.README.md +153 -389
- package/src/atoms/AtomicTextArea.README.md +267 -268
- package/src/atoms/EmptyState.README.md +247 -292
- package/src/atoms/GlassView/README.md +313 -444
- package/src/atoms/button/README.md +186 -297
- package/src/atoms/button/STRATEGY.md +252 -0
- package/src/atoms/chip/README.md +242 -290
- package/src/atoms/input/README.md +296 -290
- package/src/atoms/picker/README.md +278 -309
- package/src/atoms/skeleton/AtomicSkeleton.README.md +394 -252
- package/src/molecules/BaseModal/README.md +356 -0
- package/src/molecules/BaseModal.README.md +324 -200
- package/src/molecules/ConfirmationModal.README.md +349 -302
- package/src/molecules/Divider/README.md +293 -376
- package/src/molecules/FormField.README.md +321 -534
- package/src/molecules/GlowingCard/GlowingCard.tsx +1 -1
- package/src/molecules/GlowingCard/README.md +230 -372
- package/src/molecules/List/README.md +281 -488
- package/src/molecules/ListItem.README.md +320 -315
- package/src/molecules/SearchBar/README.md +332 -430
- package/src/molecules/StepHeader/README.md +311 -411
- package/src/molecules/StepProgress/README.md +281 -448
- package/src/molecules/alerts/README.md +272 -355
- package/src/molecules/avatar/README.md +295 -356
- package/src/molecules/bottom-sheet/README.md +303 -340
- package/src/molecules/calendar/README.md +301 -265
- package/src/molecules/countdown/README.md +347 -456
- package/src/molecules/emoji/README.md +281 -514
- package/src/molecules/listitem/README.md +307 -399
- package/src/molecules/media-card/MediaCard.tsx +31 -34
- package/src/molecules/media-card/README.md +217 -319
- package/src/molecules/navigation/README.md +263 -284
- package/src/molecules/navigation/components/NavigationHeader.tsx +77 -0
- package/src/molecules/navigation/index.ts +1 -0
- package/src/molecules/splash/README.md +76 -80
- package/src/molecules/swipe-actions/README.md +376 -588
|
@@ -1,471 +1,388 @@
|
|
|
1
1
|
# Alert System
|
|
2
2
|
|
|
3
|
-
React Native Design System
|
|
3
|
+
React Native Design System provides a comprehensive alert system for different use cases. Each alert type is optimized for specific scenarios.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Import & Usage
|
|
6
6
|
|
|
7
|
-
|
|
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
|
|
7
|
+
```typescript
|
|
16
8
|
import {
|
|
17
9
|
AlertBanner,
|
|
18
10
|
AlertToast,
|
|
19
11
|
AlertInline,
|
|
20
12
|
AlertModal,
|
|
21
|
-
AlertContainer
|
|
22
|
-
|
|
13
|
+
AlertContainer,
|
|
14
|
+
useAlert
|
|
15
|
+
} from 'react-native-design-system/src/molecules/alerts';
|
|
23
16
|
```
|
|
24
17
|
|
|
25
|
-
|
|
18
|
+
**Location:** `src/molecules/alerts/`
|
|
26
19
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Temel Kullanım
|
|
20
|
+
## Basic Usage
|
|
30
21
|
|
|
31
22
|
```tsx
|
|
32
|
-
|
|
33
|
-
variant="info"
|
|
34
|
-
title="Bilgilendirme"
|
|
35
|
-
message="Bu özellik yakında kullanıma sunulacak"
|
|
36
|
-
/>
|
|
37
|
-
```
|
|
23
|
+
import { useAlert } from 'react-native-design-system/src/molecules/alerts';
|
|
38
24
|
|
|
39
|
-
|
|
25
|
+
const { showToast } = useAlert();
|
|
40
26
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<AlertBanner variant="error" title="Hata" message="Bir hata oluştu" />
|
|
47
|
-
</View>
|
|
27
|
+
showToast({
|
|
28
|
+
variant: 'success',
|
|
29
|
+
title: 'Success',
|
|
30
|
+
message: 'Operation completed',
|
|
31
|
+
});
|
|
48
32
|
```
|
|
49
33
|
|
|
50
|
-
|
|
34
|
+
## Strategy
|
|
51
35
|
|
|
52
|
-
|
|
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
|
-
```
|
|
36
|
+
**Purpose**: Provide consistent, accessible, and user-friendly alert mechanisms for different communication needs.
|
|
61
37
|
|
|
62
|
-
|
|
38
|
+
**When to Use**:
|
|
39
|
+
- **AlertBanner**: Page-level notifications (maintenance, updates)
|
|
40
|
+
- **AlertToast**: Temporary feedback (success, error messages)
|
|
41
|
+
- **AlertInline**: Form validation errors
|
|
42
|
+
- **AlertModal**: Critical confirmations (delete, irreversible actions)
|
|
63
43
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
message="Oturumunuz 5 dakika içinde sona erecek"
|
|
69
|
-
actionLabel="Uzat"
|
|
70
|
-
onAction={() => console.log('Uzatıldı')}
|
|
71
|
-
/>
|
|
72
|
-
```
|
|
44
|
+
**When NOT to Use**:
|
|
45
|
+
- For navigation - use navigation components
|
|
46
|
+
- For complex dialogs - use custom modals
|
|
47
|
+
- For persistent content - use other UI patterns
|
|
73
48
|
|
|
74
|
-
##
|
|
49
|
+
## Rules
|
|
75
50
|
|
|
76
|
-
|
|
51
|
+
### Required
|
|
77
52
|
|
|
78
|
-
|
|
53
|
+
1. **ALWAYS** wrap app in `AlertContainer` provider
|
|
54
|
+
2. **MUST** use appropriate alert type for context
|
|
55
|
+
3. **NEVER** show multiple alerts simultaneously
|
|
56
|
+
4. **ALWAYS** provide meaningful messages
|
|
57
|
+
5. **MUST** use i18n for user-facing text
|
|
79
58
|
|
|
80
|
-
|
|
81
|
-
import { useAlert } from 'react-native-design-system';
|
|
59
|
+
### Alert Types
|
|
82
60
|
|
|
83
|
-
|
|
84
|
-
|
|
61
|
+
1. **AlertBanner**: Persistent page-level warnings
|
|
62
|
+
2. **AlertToast**: Temporary notifications (auto-dismiss)
|
|
63
|
+
3. **AlertInline**: Contextual form errors
|
|
64
|
+
4. **AlertModal**: Critical confirmations (user action)
|
|
85
65
|
|
|
86
|
-
|
|
87
|
-
showToast({
|
|
88
|
-
variant: 'success',
|
|
89
|
-
title: 'Başarılı',
|
|
90
|
-
message: 'İşlem tamamlandı',
|
|
91
|
-
});
|
|
92
|
-
};
|
|
66
|
+
### Variants
|
|
93
67
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
68
|
+
1. **info**: Neutral information
|
|
69
|
+
2. **success**: Successful operations
|
|
70
|
+
3. **warning**: Warnings and cautions
|
|
71
|
+
4. **error**: Errors and failures
|
|
72
|
+
|
|
73
|
+
## Forbidden
|
|
99
74
|
|
|
100
|
-
|
|
75
|
+
❌ **NEVER** do these:
|
|
101
76
|
|
|
102
77
|
```tsx
|
|
103
|
-
//
|
|
104
|
-
|
|
78
|
+
// ❌ Missing provider
|
|
79
|
+
export const App = () => {
|
|
80
|
+
return <MyApp />; // Missing AlertContainer ❌
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// ❌ Wrong alert type
|
|
84
|
+
useAlert().showAlert({
|
|
105
85
|
variant: 'success',
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
86
|
+
message: 'Saved successfully',
|
|
87
|
+
}); // Should be showToast ❌
|
|
88
|
+
|
|
89
|
+
// ❌ Too many alerts
|
|
90
|
+
const handleClick = () => {
|
|
91
|
+
showToast({ message: 'First' });
|
|
92
|
+
showToast({ message: 'Second' }); // ❌ Too many
|
|
93
|
+
showToast({ message: 'Third' });
|
|
94
|
+
};
|
|
109
95
|
|
|
110
|
-
//
|
|
96
|
+
// ❌ Hardcoded text
|
|
111
97
|
showToast({
|
|
112
|
-
|
|
113
|
-
title: 'Hata',
|
|
114
|
-
message: 'İşlem başarısız',
|
|
98
|
+
message: 'Success', // ❌ Use i18n
|
|
115
99
|
});
|
|
116
100
|
|
|
117
|
-
//
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
message: 'Yeni özellik eklendi',
|
|
101
|
+
// ❌ No variant
|
|
102
|
+
showAlert({
|
|
103
|
+
message: 'Are you sure?',
|
|
104
|
+
// Missing variant ❌
|
|
122
105
|
});
|
|
123
106
|
|
|
124
|
-
//
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
message: 'Lütfen kontrol edin',
|
|
107
|
+
// ❌ Alert for navigation
|
|
108
|
+
showAlert({
|
|
109
|
+
message: 'Go to settings',
|
|
110
|
+
onConfirm: () => navigate('Settings'), // ❌ Use navigation
|
|
129
111
|
});
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### Custom Süre
|
|
133
112
|
|
|
134
|
-
|
|
113
|
+
// ❌ Too long messages
|
|
135
114
|
showToast({
|
|
136
|
-
|
|
137
|
-
title: 'Mesaj',
|
|
138
|
-
message: '5 saniye gösterilecek',
|
|
139
|
-
duration: 5000,
|
|
115
|
+
message: 'This is an extremely long message that will be difficult to read and understand', // ❌
|
|
140
116
|
});
|
|
141
117
|
```
|
|
142
118
|
|
|
143
|
-
##
|
|
119
|
+
## Best Practices
|
|
144
120
|
|
|
145
|
-
|
|
121
|
+
### Alert Type Selection
|
|
146
122
|
|
|
147
|
-
|
|
123
|
+
✅ **DO**:
|
|
124
|
+
- Use AlertBanner for system-wide notices
|
|
125
|
+
- Use AlertToast for quick feedback (3-5 seconds)
|
|
126
|
+
- Use AlertInline for form validation
|
|
127
|
+
- Use AlertModal for destructive actions
|
|
148
128
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
```
|
|
129
|
+
❌ **DON'T**:
|
|
130
|
+
- Use AlertModal for simple notifications
|
|
131
|
+
- Use AlertToast for critical confirmations
|
|
132
|
+
- Use AlertBanner for temporary messages
|
|
133
|
+
- Show multiple alerts at once
|
|
155
134
|
|
|
156
|
-
###
|
|
135
|
+
### Message Length
|
|
157
136
|
|
|
137
|
+
✅ **DO**:
|
|
158
138
|
```tsx
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
onChangeText={setEmail}
|
|
164
|
-
error={emailError}
|
|
165
|
-
/>
|
|
139
|
+
// Short for toast
|
|
140
|
+
showToast({
|
|
141
|
+
message: 'Saved successfully', // Short and clear
|
|
142
|
+
});
|
|
166
143
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
</View>
|
|
144
|
+
// Detailed for modal
|
|
145
|
+
showAlert({
|
|
146
|
+
title: 'Delete Item',
|
|
147
|
+
message: 'This action cannot be undone. Are you sure you want to continue?',
|
|
148
|
+
onConfirm: handleDelete,
|
|
149
|
+
});
|
|
174
150
|
```
|
|
175
151
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
152
|
+
❌ **DON'T**:
|
|
153
|
+
```tsx
|
|
154
|
+
// Long toast message
|
|
155
|
+
showToast({
|
|
156
|
+
message: 'Your changes have been saved successfully and you can continue with your work', // ❌ Too long
|
|
157
|
+
});
|
|
158
|
+
```
|
|
179
159
|
|
|
180
|
-
###
|
|
160
|
+
### Variant Usage
|
|
181
161
|
|
|
162
|
+
✅ **DO**:
|
|
182
163
|
```tsx
|
|
183
|
-
|
|
164
|
+
// Success - completed actions
|
|
165
|
+
showToast({ variant: 'success', message: 'Saved' });
|
|
184
166
|
|
|
185
|
-
|
|
186
|
-
|
|
167
|
+
// Error - failed operations
|
|
168
|
+
showToast({ variant: 'error', message: 'Failed to save' });
|
|
187
169
|
|
|
188
|
-
|
|
189
|
-
|
|
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
|
-
};
|
|
170
|
+
// Warning - potential issues
|
|
171
|
+
showAlert({ variant: 'warning', message: 'Unsaved changes' });
|
|
200
172
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
);
|
|
204
|
-
};
|
|
173
|
+
// Info - neutral information
|
|
174
|
+
showBanner({ variant: 'info', message: 'New feature available' });
|
|
205
175
|
```
|
|
206
176
|
|
|
207
|
-
|
|
208
|
-
|
|
177
|
+
❌ **DON'T**:
|
|
209
178
|
```tsx
|
|
210
|
-
//
|
|
211
|
-
|
|
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
|
-
});
|
|
179
|
+
// Wrong variant for context
|
|
180
|
+
showToast({ variant: 'error', message: 'Success!' }); // ❌ Wrong variant
|
|
233
181
|
```
|
|
234
182
|
|
|
235
|
-
##
|
|
183
|
+
## AI Coding Guidelines
|
|
236
184
|
|
|
237
|
-
|
|
185
|
+
### For AI Agents
|
|
238
186
|
|
|
239
|
-
|
|
187
|
+
When generating Alert components, follow these rules:
|
|
240
188
|
|
|
241
|
-
|
|
242
|
-
|
|
189
|
+
1. **Always import from correct path**:
|
|
190
|
+
```typescript
|
|
191
|
+
import { useAlert } from 'react-native-design-system/src/molecules/alerts';
|
|
192
|
+
```
|
|
243
193
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
);
|
|
250
|
-
};
|
|
251
|
-
```
|
|
194
|
+
2. **Always use appropriate alert type**:
|
|
195
|
+
```tsx
|
|
196
|
+
// Quick feedback
|
|
197
|
+
const { showToast } = useAlert();
|
|
198
|
+
showToast({ variant: 'success', message: 'Saved' });
|
|
252
199
|
|
|
253
|
-
|
|
200
|
+
// Critical action
|
|
201
|
+
const { showAlert } = useAlert();
|
|
202
|
+
showAlert({ variant: 'error', onConfirm: delete });
|
|
254
203
|
|
|
255
|
-
|
|
256
|
-
|
|
204
|
+
// Form error
|
|
205
|
+
<AlertInline variant="error" message="Invalid input" />
|
|
257
206
|
|
|
258
|
-
|
|
259
|
-
|
|
207
|
+
// Page notice
|
|
208
|
+
<AlertBanner variant="warning" message="Maintenance mode" />
|
|
209
|
+
```
|
|
260
210
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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();
|
|
211
|
+
3. **Always use i18n for messages**:
|
|
212
|
+
```tsx
|
|
213
|
+
// ❌ Bad
|
|
214
|
+
showToast({ message: 'Success' });
|
|
296
215
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
variant: 'error',
|
|
301
|
-
title: 'Hata',
|
|
302
|
-
message: 'E-posta alanı zorunludur',
|
|
303
|
-
});
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
216
|
+
// ✅ Good
|
|
217
|
+
showToast({ message: t('alerts.success') });
|
|
218
|
+
```
|
|
306
219
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
220
|
+
4. **Always provide variant**:
|
|
221
|
+
```tsx
|
|
222
|
+
// ❌ Bad
|
|
223
|
+
showToast({ message: 'Something happened' });
|
|
311
224
|
|
|
312
|
-
|
|
225
|
+
// ✅ Good
|
|
226
|
+
showToast({ variant: 'info', message: t('alerts.info') });
|
|
227
|
+
```
|
|
313
228
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
229
|
+
5. **Never show multiple alerts**:
|
|
230
|
+
```tsx
|
|
231
|
+
// ❌ Bad
|
|
232
|
+
const handleClick = () => {
|
|
233
|
+
showToast({ message: 'First' });
|
|
234
|
+
showToast({ message: 'Second' }); // Don't stack
|
|
235
|
+
};
|
|
317
236
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
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
|
-
```
|
|
237
|
+
// ✅ Good
|
|
238
|
+
const handleClick = () => {
|
|
239
|
+
showToast({ message: 'Complete action' });
|
|
240
|
+
};
|
|
241
|
+
```
|
|
336
242
|
|
|
337
|
-
###
|
|
243
|
+
### Common Patterns
|
|
338
244
|
|
|
245
|
+
#### Success Feedback
|
|
339
246
|
```tsx
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
const handleSave = async () => {
|
|
247
|
+
const handleSave = async () => {
|
|
248
|
+
try {
|
|
344
249
|
await saveData();
|
|
345
250
|
showToast({
|
|
346
251
|
variant: 'success',
|
|
347
|
-
title: '
|
|
348
|
-
message: '
|
|
252
|
+
title: t('alerts.success'),
|
|
253
|
+
message: t('alerts.saved'),
|
|
349
254
|
});
|
|
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({
|
|
255
|
+
} catch (error) {
|
|
256
|
+
showToast({
|
|
362
257
|
variant: 'error',
|
|
363
|
-
title: '
|
|
364
|
-
message: '
|
|
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
|
-
},
|
|
258
|
+
title: t('alerts.error'),
|
|
259
|
+
message: t('alerts.saveFailed'),
|
|
375
260
|
});
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
return (
|
|
379
|
-
<Button title="Sil" onPress={handleDelete} />
|
|
380
|
-
);
|
|
261
|
+
}
|
|
381
262
|
};
|
|
382
263
|
```
|
|
383
264
|
|
|
384
|
-
|
|
385
|
-
|
|
265
|
+
#### Delete Confirmation
|
|
386
266
|
```tsx
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
267
|
+
const handleDelete = () => {
|
|
268
|
+
showAlert({
|
|
269
|
+
variant: 'error',
|
|
270
|
+
title: t('alerts.deleteTitle'),
|
|
271
|
+
message: t('alerts.deleteConfirm'),
|
|
272
|
+
confirmLabel: t('common.delete'),
|
|
273
|
+
cancelLabel: t('common.cancel'),
|
|
274
|
+
onConfirm: async () => {
|
|
275
|
+
await deleteItem();
|
|
276
|
+
showToast({
|
|
277
|
+
variant: 'success',
|
|
278
|
+
message: t('alerts.deleted'),
|
|
279
|
+
});
|
|
280
|
+
},
|
|
281
|
+
});
|
|
396
282
|
};
|
|
397
283
|
```
|
|
398
284
|
|
|
399
|
-
|
|
285
|
+
#### Form Validation
|
|
286
|
+
```tsx
|
|
287
|
+
<View>
|
|
288
|
+
<FormField
|
|
289
|
+
label="Email"
|
|
290
|
+
value={email}
|
|
291
|
+
onChangeText={setEmail}
|
|
292
|
+
error={emailError}
|
|
293
|
+
/>
|
|
400
294
|
|
|
401
|
-
|
|
295
|
+
{emailError && (
|
|
296
|
+
<AlertInline
|
|
297
|
+
variant="error"
|
|
298
|
+
message={t('validation.invalidEmail')}
|
|
299
|
+
/>
|
|
300
|
+
)}
|
|
301
|
+
</View>
|
|
302
|
+
```
|
|
402
303
|
|
|
304
|
+
#### System Notice
|
|
403
305
|
```tsx
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
306
|
+
<AlertBanner
|
|
307
|
+
variant="warning"
|
|
308
|
+
title={t('alerts.maintenance')}
|
|
309
|
+
message={t('alerts.maintenanceMessage')}
|
|
310
|
+
dismissible
|
|
311
|
+
onDismiss={() => setShowBanner(false)}
|
|
312
|
+
/>
|
|
313
|
+
```
|
|
409
314
|
|
|
410
|
-
|
|
411
|
-
<AlertInline variant="error" message="Geçersiz değer" />
|
|
315
|
+
## Props Reference
|
|
412
316
|
|
|
413
|
-
|
|
414
|
-
<AlertBanner variant="info" message="Sistem bakımda" />
|
|
415
|
-
```
|
|
317
|
+
### AlertBanner
|
|
416
318
|
|
|
417
|
-
|
|
319
|
+
| Prop | Type | Required | Default | Description |
|
|
320
|
+
|------|------|----------|---------|-------------|
|
|
321
|
+
| `variant` | `'info' \| 'success' \| 'warning' \| 'error'` | No | `'info'` | Alert variant |
|
|
322
|
+
| `title` | `string` | No | - | Alert title |
|
|
323
|
+
| `message` | `string` | Yes | - | Alert message |
|
|
324
|
+
| `dismissible` | `boolean` | No | `false` | Show dismiss button |
|
|
325
|
+
| `onDismiss` | `() => void` | No | - | Dismiss callback |
|
|
326
|
+
| `actionLabel` | `string` | No | - | Action button text |
|
|
327
|
+
| `onAction` | `() => void` | No | - | Action callback |
|
|
418
328
|
|
|
419
|
-
|
|
420
|
-
// Kısa ve öz
|
|
421
|
-
showToast({
|
|
422
|
-
message: 'Kaydedildi', // İyi
|
|
423
|
-
});
|
|
329
|
+
### AlertInline
|
|
424
330
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
```
|
|
331
|
+
| Prop | Type | Required | Default | Description |
|
|
332
|
+
|------|------|----------|---------|-------------|
|
|
333
|
+
| `variant` | `'info' \| 'success' \| 'warning' \| 'error'` | No | `'error'` | Alert variant |
|
|
334
|
+
| `message` | `string` | Yes | - | Error message |
|
|
430
335
|
|
|
431
|
-
###
|
|
336
|
+
### useAlert Hook
|
|
432
337
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
showToast
|
|
338
|
+
| Method | Parameters | Description |
|
|
339
|
+
|--------|-----------|-------------|
|
|
340
|
+
| `showToast` | `ToastOptions` | Show temporary notification |
|
|
341
|
+
| `showAlert` | `AlertOptions` | Show confirmation modal |
|
|
342
|
+
| `showBanner` | `BannerOptions` | Show page banner |
|
|
436
343
|
|
|
437
|
-
|
|
438
|
-
showToast({ variant: 'error' });
|
|
344
|
+
### ToastOptions
|
|
439
345
|
|
|
440
|
-
|
|
441
|
-
|
|
346
|
+
| Prop | Type | Required | Default | Description |
|
|
347
|
+
|------|------|----------|---------|-------------|
|
|
348
|
+
| `variant` | `'info' \| 'success' \| 'warning' \| 'error'` | Yes | - | Toast variant |
|
|
349
|
+
| `title` | `string` | No | - | Toast title |
|
|
350
|
+
| `message` | `string` | Yes | - | Toast message |
|
|
351
|
+
| `duration` | `number` | No | `3000` | Duration in ms |
|
|
442
352
|
|
|
443
|
-
|
|
444
|
-
showBanner({ variant: 'info' });
|
|
445
|
-
```
|
|
353
|
+
### AlertOptions
|
|
446
354
|
|
|
447
|
-
|
|
355
|
+
| Prop | Type | Required | Default | Description |
|
|
356
|
+
|------|------|----------|---------|-------------|
|
|
357
|
+
| `variant` | `'info' \| 'success' \| 'warning' \| 'error'` | Yes | - | Alert variant |
|
|
358
|
+
| `title` | `string` | Yes | - | Alert title |
|
|
359
|
+
| `message` | `string` | Yes | - | Alert message |
|
|
360
|
+
| `confirmLabel` | `string` | No | `'OK'` | Confirm button text |
|
|
361
|
+
| `cancelLabel` | `string` | No | - | Cancel button text |
|
|
362
|
+
| `onConfirm` | `() => void` | No | - | Confirm callback |
|
|
448
363
|
|
|
449
|
-
|
|
364
|
+
## Accessibility
|
|
450
365
|
|
|
451
|
-
- ✅ Screen reader
|
|
452
|
-
- ✅
|
|
453
|
-
- ✅
|
|
454
|
-
- ✅
|
|
455
|
-
- ✅
|
|
366
|
+
- ✅ Screen reader announces all alerts
|
|
367
|
+
- ✅ Auto-dismiss for non-critical alerts
|
|
368
|
+
- ✅ Focus management for modals
|
|
369
|
+
- ✅ Keyboard navigation support
|
|
370
|
+
- ✅ Semantic alert roles
|
|
371
|
+
- ✅ ARIA live regions
|
|
456
372
|
|
|
457
|
-
##
|
|
373
|
+
## Performance
|
|
458
374
|
|
|
459
|
-
1. **Auto-dismiss**:
|
|
460
|
-
2. **Queue**:
|
|
461
|
-
3. **Unmount**:
|
|
375
|
+
1. **Auto-dismiss**: Toasts dismiss automatically
|
|
376
|
+
2. **Queue**: Multiple alerts queue automatically
|
|
377
|
+
3. **Unmount**: Unmount when closed
|
|
378
|
+
4. **Debounce**: Debounce rapid alert calls
|
|
462
379
|
|
|
463
|
-
##
|
|
380
|
+
## Related Components
|
|
464
381
|
|
|
465
|
-
- [`BaseModal`](../BaseModal/README.md) - Modal
|
|
466
|
-
- [`FormField`](../FormField/README.md) - Form
|
|
467
|
-
- [`
|
|
382
|
+
- [`BaseModal`](../BaseModal/README.md) - Modal component
|
|
383
|
+
- [`FormField`](../FormField/README.md) - Form field component
|
|
384
|
+
- [`Button`](../../atoms/button/README.md) - Button component
|
|
468
385
|
|
|
469
|
-
##
|
|
386
|
+
## License
|
|
470
387
|
|
|
471
388
|
MIT
|