@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,370 +1,417 @@
|
|
|
1
1
|
# ConfirmationModal
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A modal component for getting user confirmation before critical actions like delete, save, or important changes.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Import & Usage
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
- ♿ **Erişilebilir**: Tam erişilebilirlik desteği
|
|
7
|
+
```typescript
|
|
8
|
+
import { ConfirmationModal } from 'react-native-design-system/src/molecules/ConfirmationModal';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Location:** `src/molecules/ConfirmationModal.tsx`
|
|
13
12
|
|
|
14
|
-
##
|
|
13
|
+
## Basic Usage
|
|
15
14
|
|
|
16
15
|
```tsx
|
|
17
|
-
|
|
16
|
+
const [visible, setVisible] = useState(false);
|
|
17
|
+
|
|
18
|
+
<ConfirmationModal
|
|
19
|
+
visible={visible}
|
|
20
|
+
title="Are you sure?"
|
|
21
|
+
message="This action cannot be undone"
|
|
22
|
+
confirmText="Confirm"
|
|
23
|
+
cancelText="Cancel"
|
|
24
|
+
onConfirm={() => {
|
|
25
|
+
handleAction();
|
|
26
|
+
setVisible(false);
|
|
27
|
+
}}
|
|
28
|
+
onCancel={() => setVisible(false)}
|
|
29
|
+
/>
|
|
18
30
|
```
|
|
19
31
|
|
|
20
|
-
##
|
|
32
|
+
## Strategy
|
|
21
33
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
```
|
|
34
|
+
**Purpose**: Provide a standardized, accessible confirmation dialog for critical and destructive actions.
|
|
35
|
+
|
|
36
|
+
**When to Use**:
|
|
37
|
+
- Deleting items (files, messages, accounts)
|
|
38
|
+
- Destructive operations (cancel subscription, remove data)
|
|
39
|
+
- Unsaved changes warnings
|
|
40
|
+
- Navigation away from forms with unsaved changes
|
|
41
|
+
- Critical settings changes
|
|
42
|
+
- Irreversible actions
|
|
43
|
+
|
|
44
|
+
**When NOT to Use**:
|
|
45
|
+
- For simple alerts (use Alert/toast instead)
|
|
46
|
+
- For non-critical confirmations (use inline confirmation)
|
|
47
|
+
- For information display (use BaseModal instead)
|
|
48
|
+
- For form submissions (use loading state instead)
|
|
49
|
+
|
|
50
|
+
## Rules
|
|
51
|
+
|
|
52
|
+
### Required
|
|
53
|
+
|
|
54
|
+
1. **MUST** have `visible`, `onConfirm`, and `onCancel` props
|
|
55
|
+
2. **ALWAYS** provide clear `title` and `message`
|
|
56
|
+
3. **MUST** use appropriate variant for action severity
|
|
57
|
+
4. **SHOULD** prevent accidental confirmation (consider backdropDismissible=false)
|
|
58
|
+
5. **MUST** close modal after action
|
|
59
|
+
6. **ALWAYS** provide specific button text (not just "OK")
|
|
60
|
+
7. **SHOULD** mention consequence in message
|
|
50
61
|
|
|
51
|
-
|
|
62
|
+
### Variant Selection
|
|
63
|
+
|
|
64
|
+
1. **Danger**: For destructive, irreversible actions (delete, remove)
|
|
65
|
+
2. **Warning**: For data loss or important changes (unsaved changes, logout)
|
|
66
|
+
3. **Default/Info**: For non-critical confirmations
|
|
67
|
+
|
|
68
|
+
### Message Guidelines
|
|
69
|
+
|
|
70
|
+
1. **Be specific**: Clearly state what will happen
|
|
71
|
+
2. **Mention consequences**: "This action cannot be undone"
|
|
72
|
+
3. **Keep concise**: 1-2 sentences max
|
|
73
|
+
4. **Use plain language**: Avoid technical jargon
|
|
74
|
+
|
|
75
|
+
### Button Text
|
|
76
|
+
|
|
77
|
+
1. **Confirm button**: Use action verbs (Delete, Save, Confirm)
|
|
78
|
+
2. **Cancel button**: Use Cancel, Go Back, Stay
|
|
79
|
+
3. **Be specific**: "Delete Account" not "OK"
|
|
80
|
+
4. **Match action**: Button text should match the action
|
|
81
|
+
|
|
82
|
+
## Forbidden
|
|
83
|
+
|
|
84
|
+
❌ **NEVER** do these:
|
|
52
85
|
|
|
53
86
|
```tsx
|
|
54
|
-
|
|
87
|
+
// ❌ No close mechanism
|
|
55
88
|
<ConfirmationModal
|
|
56
|
-
visible={
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
89
|
+
visible={true}
|
|
90
|
+
title="Confirm"
|
|
91
|
+
// Missing onConfirm and onCancel
|
|
92
|
+
/>
|
|
93
|
+
|
|
94
|
+
// ❌ Vague message
|
|
95
|
+
<ConfirmationModal
|
|
96
|
+
title="Are you sure?"
|
|
97
|
+
message="Are you sure?" // ❌ Doesn't say what will happen
|
|
60
98
|
onConfirm={handleConfirm}
|
|
61
99
|
onCancel={handleCancel}
|
|
62
100
|
/>
|
|
63
101
|
|
|
64
|
-
|
|
102
|
+
// ❌ Wrong variant
|
|
65
103
|
<ConfirmationModal
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
cancelText="İptal"
|
|
72
|
-
onConfirm={handleDelete}
|
|
73
|
-
onCancel={handleCancel}
|
|
104
|
+
variant="default" // ❌ Should be danger for delete
|
|
105
|
+
title="Delete Account"
|
|
106
|
+
message="This cannot be undone"
|
|
107
|
+
onConfirm={deleteAccount}
|
|
108
|
+
onCancel={cancel}
|
|
74
109
|
/>
|
|
75
110
|
|
|
76
|
-
|
|
111
|
+
// ❌ Generic button text
|
|
77
112
|
<ConfirmationModal
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
cancelText="Geri Dön"
|
|
84
|
-
onConfirm={handleProceed}
|
|
85
|
-
onCancel={handleCancel}
|
|
113
|
+
title="Delete Account"
|
|
114
|
+
confirmText="OK" // ❌ Not specific
|
|
115
|
+
cancelText="Cancel"
|
|
116
|
+
onConfirm={deleteAccount}
|
|
117
|
+
onCancel={cancel}
|
|
86
118
|
/>
|
|
87
|
-
```
|
|
88
119
|
|
|
89
|
-
|
|
120
|
+
// ❌ Doesn't close after action
|
|
121
|
+
<ConfirmationModal
|
|
122
|
+
title="Delete Item"
|
|
123
|
+
onConfirm={() => deleteItem()} // ❌ Doesn't close modal
|
|
124
|
+
onCancel={cancel}
|
|
125
|
+
/>
|
|
90
126
|
|
|
91
|
-
|
|
127
|
+
// ❌ No consequence warning
|
|
128
|
+
<ConfirmationModal
|
|
129
|
+
title="Delete Account"
|
|
130
|
+
message="Do you want to delete?" // ❌ Doesn't mention it's permanent
|
|
131
|
+
onConfirm={deleteAccount}
|
|
132
|
+
onCancel={cancel}
|
|
133
|
+
/>
|
|
134
|
+
|
|
135
|
+
// ❌ Dismissible critical action
|
|
92
136
|
<ConfirmationModal
|
|
93
|
-
visible={visible}
|
|
94
137
|
variant="danger"
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
onCancel={handleCancel}
|
|
138
|
+
title="Delete Account"
|
|
139
|
+
backdropDismissible={true} // ❌ Should be false for critical
|
|
140
|
+
onConfirm={deleteAccount}
|
|
141
|
+
onCancel={cancel}
|
|
100
142
|
/>
|
|
101
143
|
```
|
|
102
144
|
|
|
103
|
-
##
|
|
145
|
+
## Best Practices
|
|
146
|
+
|
|
147
|
+
### Delete Confirmation
|
|
104
148
|
|
|
149
|
+
✅ **DO**:
|
|
105
150
|
```tsx
|
|
106
151
|
<ConfirmationModal
|
|
107
152
|
visible={visible}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
153
|
+
variant="danger"
|
|
154
|
+
icon="trash-outline"
|
|
155
|
+
title="Delete Item"
|
|
156
|
+
message="Are you sure you want to delete '{item.name}'? This action cannot be undone."
|
|
157
|
+
confirmText="Delete"
|
|
158
|
+
cancelText="Cancel"
|
|
159
|
+
onConfirm={() => {
|
|
160
|
+
deleteItem(item.id);
|
|
161
|
+
setVisible(false);
|
|
162
|
+
}}
|
|
163
|
+
onCancel={() => setVisible(false)}
|
|
113
164
|
/>
|
|
114
165
|
```
|
|
115
166
|
|
|
116
|
-
|
|
117
|
-
|
|
167
|
+
❌ **DON'T**:
|
|
118
168
|
```tsx
|
|
169
|
+
// ❌ Vague message, wrong variant
|
|
119
170
|
<ConfirmationModal
|
|
120
171
|
visible={visible}
|
|
121
|
-
|
|
122
|
-
title="
|
|
123
|
-
message="
|
|
124
|
-
|
|
125
|
-
|
|
172
|
+
variant="default"
|
|
173
|
+
title="Delete"
|
|
174
|
+
message="Are you sure?"
|
|
175
|
+
confirmText="OK"
|
|
176
|
+
onConfirm={deleteItem}
|
|
177
|
+
onCancel={cancel}
|
|
126
178
|
/>
|
|
127
179
|
```
|
|
128
180
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
### Silme Onayı
|
|
132
|
-
|
|
133
|
-
```tsx
|
|
134
|
-
export const DeleteConfirmation = ({ item, onDelete }) => {
|
|
135
|
-
const [visible, setVisible] = useState(false);
|
|
136
|
-
|
|
137
|
-
return (
|
|
138
|
-
<>
|
|
139
|
-
<Button title="Sil" onPress={() => setVisible(true)} />
|
|
140
|
-
|
|
141
|
-
<ConfirmationModal
|
|
142
|
-
visible={visible}
|
|
143
|
-
variant="danger"
|
|
144
|
-
icon="trash-outline"
|
|
145
|
-
title="Öğeyi Sil"
|
|
146
|
-
message={`${item.title} öğesini silmek istediğinizden emin misiniz? Bu işlem geri alınamaz.`}
|
|
147
|
-
confirmText="Sil"
|
|
148
|
-
cancelText="İptal"
|
|
149
|
-
onConfirm={() => {
|
|
150
|
-
onDelete(item.id);
|
|
151
|
-
setVisible(false);
|
|
152
|
-
}}
|
|
153
|
-
onCancel={() => setVisible(false)}
|
|
154
|
-
/>
|
|
155
|
-
</>
|
|
156
|
-
);
|
|
157
|
-
};
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### Çıkış Onayı
|
|
161
|
-
|
|
162
|
-
```tsx
|
|
163
|
-
export const LogoutConfirmation = () => {
|
|
164
|
-
const [visible, setVisible] = useState(false);
|
|
165
|
-
|
|
166
|
-
return (
|
|
167
|
-
<>
|
|
168
|
-
<Button title="Çıkış Yap" onPress={() => setVisible(true)} />
|
|
169
|
-
|
|
170
|
-
<ConfirmationModal
|
|
171
|
-
visible={visible}
|
|
172
|
-
variant="warning"
|
|
173
|
-
icon="log-out-outline"
|
|
174
|
-
title="Çıkış Yap"
|
|
175
|
-
message="Oturumunuzu sonlandırmak istediğinizden emin misiniz?"
|
|
176
|
-
confirmText="Çıkış"
|
|
177
|
-
cancelText="İptal"
|
|
178
|
-
onConfirm={() => {
|
|
179
|
-
logout();
|
|
180
|
-
setVisible(false);
|
|
181
|
-
}}
|
|
182
|
-
onCancel={() => setVisible(false)}
|
|
183
|
-
/>
|
|
184
|
-
</>
|
|
185
|
-
);
|
|
186
|
-
};
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### Değişiklik Kaydetme
|
|
190
|
-
|
|
191
|
-
```tsx
|
|
192
|
-
export const UnsavedChangesModal = ({ onSave, onDiscard }) => {
|
|
193
|
-
const [visible, setVisible] = useState(false);
|
|
194
|
-
|
|
195
|
-
return (
|
|
196
|
-
<ConfirmationModal
|
|
197
|
-
visible={visible}
|
|
198
|
-
variant="warning"
|
|
199
|
-
icon="save-outline"
|
|
200
|
-
title="Kaydedilmemiş Değişiklikler"
|
|
201
|
-
message="Yaptığınız değişiklikleri kaydetmediniz. Ne yapmak istersiniz?"
|
|
202
|
-
confirmText="Kaydet"
|
|
203
|
-
cancelText="İptal"
|
|
204
|
-
onConfirm={() => {
|
|
205
|
-
onSave();
|
|
206
|
-
setVisible(false);
|
|
207
|
-
}}
|
|
208
|
-
onCancel={() => {
|
|
209
|
-
onDiscard();
|
|
210
|
-
setVisible(false);
|
|
211
|
-
}}
|
|
212
|
-
/>
|
|
213
|
-
);
|
|
214
|
-
};
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### Formu Terk Etme
|
|
181
|
+
### Unsaved Changes Warning
|
|
218
182
|
|
|
183
|
+
✅ **DO**:
|
|
219
184
|
```tsx
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
)
|
|
233
|
-
|
|
185
|
+
<ConfirmationModal
|
|
186
|
+
visible={hasUnsavedChanges}
|
|
187
|
+
variant="warning"
|
|
188
|
+
icon="save-outline"
|
|
189
|
+
title="Unsaved Changes"
|
|
190
|
+
message="You have unsaved changes. What would you like to do?"
|
|
191
|
+
confirmText="Save"
|
|
192
|
+
cancelText="Discard"
|
|
193
|
+
onConfirm={() => {
|
|
194
|
+
saveChanges();
|
|
195
|
+
setVisible(false);
|
|
196
|
+
}}
|
|
197
|
+
onCancel={() => {
|
|
198
|
+
discardChanges();
|
|
199
|
+
setVisible(false);
|
|
200
|
+
}}
|
|
201
|
+
/>
|
|
234
202
|
```
|
|
235
203
|
|
|
236
|
-
|
|
237
|
-
|
|
204
|
+
❌ **DON'T**:
|
|
238
205
|
```tsx
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
confirmText="İptal Et"
|
|
248
|
-
cancelText="Devam Et"
|
|
249
|
-
onConfirm={() => {
|
|
250
|
-
cancelOperation();
|
|
251
|
-
setVisible(false);
|
|
252
|
-
}}
|
|
253
|
-
onCancel={() => setVisible(false)}
|
|
254
|
-
/>
|
|
255
|
-
);
|
|
256
|
-
};
|
|
206
|
+
// ❌ No clear options
|
|
207
|
+
<ConfirmationModal
|
|
208
|
+
visible={hasUnsavedChanges}
|
|
209
|
+
title="Changes"
|
|
210
|
+
message="You have changes"
|
|
211
|
+
confirmText="OK"
|
|
212
|
+
onConfirm={saveChanges}
|
|
213
|
+
/>
|
|
257
214
|
```
|
|
258
215
|
|
|
259
|
-
###
|
|
216
|
+
### Logout Confirmation
|
|
260
217
|
|
|
218
|
+
✅ **DO**:
|
|
261
219
|
```tsx
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
};
|
|
220
|
+
<ConfirmationModal
|
|
221
|
+
visible={showLogout}
|
|
222
|
+
variant="warning"
|
|
223
|
+
icon="log-out-outline"
|
|
224
|
+
title="Log Out"
|
|
225
|
+
message="Are you sure you want to log out of your account?"
|
|
226
|
+
confirmText="Log Out"
|
|
227
|
+
cancelText="Cancel"
|
|
228
|
+
onConfirm={() => {
|
|
229
|
+
logout();
|
|
230
|
+
setShowLogout(false);
|
|
231
|
+
}}
|
|
232
|
+
onCancel={() => setShowLogout(false)}
|
|
233
|
+
/>
|
|
277
234
|
```
|
|
278
235
|
|
|
279
|
-
|
|
280
|
-
|
|
236
|
+
## AI Coding Guidelines
|
|
237
|
+
|
|
238
|
+
### For AI Agents
|
|
239
|
+
|
|
240
|
+
When generating ConfirmationModal components, follow these rules:
|
|
241
|
+
|
|
242
|
+
1. **Always import from correct path**:
|
|
243
|
+
```typescript
|
|
244
|
+
import { ConfirmationModal } from 'react-native-design-system/src/molecules/ConfirmationModal';
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
2. **Always use appropriate variant**:
|
|
248
|
+
```tsx
|
|
249
|
+
// ✅ Good - variant by severity
|
|
250
|
+
const getVariant = (action) => {
|
|
251
|
+
if (action === 'delete') return 'danger';
|
|
252
|
+
if (action === 'logout') return 'warning';
|
|
253
|
+
return 'default';
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
// ❌ Bad - always default
|
|
257
|
+
<ConfirmationModal variant="default" /> // Even for delete
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
3. **Always be specific in message**:
|
|
261
|
+
```tsx
|
|
262
|
+
// ✅ Good - specific message
|
|
263
|
+
message={`Delete '${item.name}'? This cannot be undone.`}
|
|
264
|
+
|
|
265
|
+
// ❌ Bad - vague message
|
|
266
|
+
message="Are you sure?"
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
4. **Always match button text to action**:
|
|
270
|
+
```tsx
|
|
271
|
+
// ✅ Good - specific button text
|
|
272
|
+
<ConfirmationModal
|
|
273
|
+
confirmText="Delete Account"
|
|
274
|
+
onConfirm={deleteAccount}
|
|
275
|
+
/>
|
|
276
|
+
|
|
277
|
+
// ❌ Bad - generic button text
|
|
278
|
+
<ConfirmationModal
|
|
279
|
+
confirmText="OK"
|
|
280
|
+
onConfirm={deleteAccount}
|
|
281
|
+
/>
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
5. **Always close modal after action**:
|
|
285
|
+
```tsx
|
|
286
|
+
// ✅ Good - closes after action
|
|
287
|
+
const handleConfirm = () => {
|
|
288
|
+
deleteItem(id);
|
|
289
|
+
setVisible(false);
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
// ❌ Bad - doesn't close
|
|
293
|
+
const handleConfirm = () => {
|
|
294
|
+
deleteItem(id);
|
|
295
|
+
// Modal stays open
|
|
296
|
+
};
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Common Patterns
|
|
300
|
+
|
|
301
|
+
#### Delete Confirmation
|
|
281
302
|
```tsx
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
};
|
|
303
|
+
<ConfirmationModal
|
|
304
|
+
visible={showDelete}
|
|
305
|
+
variant="danger"
|
|
306
|
+
icon="trash-outline"
|
|
307
|
+
title="Delete Item"
|
|
308
|
+
message={`Delete '${item.name}'? This action cannot be undone.`}
|
|
309
|
+
confirmText="Delete"
|
|
310
|
+
cancelText="Cancel"
|
|
311
|
+
onConfirm={() => {
|
|
312
|
+
deleteItem(item.id);
|
|
313
|
+
setShowDelete(false);
|
|
314
|
+
}}
|
|
315
|
+
onCancel={() => setShowDelete(false)}
|
|
316
|
+
/>
|
|
297
317
|
```
|
|
298
318
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
### ConfirmationModalProps
|
|
302
|
-
|
|
303
|
-
| Prop | Tip | Varsayılan | Açıklama |
|
|
304
|
-
|------|-----|------------|----------|
|
|
305
|
-
| `visible` | `boolean` | - **(Zorunlu)** | Modal görünürlüğü |
|
|
306
|
-
| `title` | `string` | - | Modal başlığı |
|
|
307
|
-
| `message` | `string` | - | Modal mesajı |
|
|
308
|
-
| `variant` | `'default' \| 'danger' \| 'warning' \| 'info'` | `'default'` | Modal variant'ı |
|
|
309
|
-
| `confirmText` | `string` | `'Confirm'` | Onay butonu metni |
|
|
310
|
-
| `cancelText` | `string` | `'Cancel'` | İptal butonu metni |
|
|
311
|
-
| `icon` | `string` | - | İkon ismi |
|
|
312
|
-
| `onConfirm` | `() => void` | - | Onay callback'i |
|
|
313
|
-
| `onCancel` | `() => void` | - | İptal callback'i |
|
|
314
|
-
| `showBackdrop` | `boolean` | `true` | Backdrop göster |
|
|
315
|
-
| `backdropDismissible` | `boolean` | `true` | Backdrop tıklama ile kapat |
|
|
316
|
-
| `style` | `ViewStyle` | - | Özel stil |
|
|
317
|
-
| `testID` | `string` | - | Test ID'si |
|
|
318
|
-
|
|
319
|
-
## Best Practices
|
|
320
|
-
|
|
321
|
-
### 1. Variant Seçimi
|
|
322
|
-
|
|
319
|
+
#### Unsaved Changes
|
|
323
320
|
```tsx
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
321
|
+
<ConfirmationModal
|
|
322
|
+
visible={hasUnsavedChanges}
|
|
323
|
+
variant="warning"
|
|
324
|
+
icon="warning"
|
|
325
|
+
title="Unsaved Changes"
|
|
326
|
+
message="You have unsaved changes. Do you want to save them?"
|
|
327
|
+
confirmText="Save"
|
|
328
|
+
cancelText="Don't Save"
|
|
329
|
+
onConfirm={() => {
|
|
330
|
+
saveChanges();
|
|
331
|
+
setHasUnsavedChanges(false);
|
|
332
|
+
}}
|
|
333
|
+
onCancel={() => {
|
|
334
|
+
discardChanges();
|
|
335
|
+
setHasUnsavedChanges(false);
|
|
336
|
+
}}
|
|
337
|
+
/>
|
|
332
338
|
```
|
|
333
339
|
|
|
334
|
-
|
|
335
|
-
|
|
340
|
+
#### Logout Confirmation
|
|
336
341
|
```tsx
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
+
<ConfirmationModal
|
|
343
|
+
visible={showLogout}
|
|
344
|
+
variant="warning"
|
|
345
|
+
icon="log-out-outline"
|
|
346
|
+
title="Log Out"
|
|
347
|
+
message="Are you sure you want to log out?"
|
|
348
|
+
confirmText="Log Out"
|
|
349
|
+
cancelText="Cancel"
|
|
350
|
+
onConfirm={() => {
|
|
351
|
+
logout();
|
|
352
|
+
setShowLogout(false);
|
|
353
|
+
}}
|
|
354
|
+
onCancel={() => setShowLogout(false)}
|
|
355
|
+
/>
|
|
342
356
|
```
|
|
343
357
|
|
|
344
|
-
|
|
345
|
-
|
|
358
|
+
#### Critical Action (No Backdrop Dismiss)
|
|
346
359
|
```tsx
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
360
|
+
<ConfirmationModal
|
|
361
|
+
visible={showCritical}
|
|
362
|
+
variant="danger"
|
|
363
|
+
backdropDismissible={false} // Prevents accidental dismiss
|
|
364
|
+
title="Delete Account"
|
|
365
|
+
message="This will permanently delete your account and all data. This cannot be undone."
|
|
366
|
+
confirmText="Delete Account"
|
|
367
|
+
cancelText="Cancel"
|
|
368
|
+
onConfirm={() => {
|
|
369
|
+
deleteAccount();
|
|
370
|
+
setShowCritical(false);
|
|
371
|
+
}}
|
|
372
|
+
onCancel={() => setShowCritical(false)}
|
|
373
|
+
/>
|
|
350
374
|
```
|
|
351
375
|
|
|
352
|
-
##
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
-
|
|
357
|
-
-
|
|
358
|
-
-
|
|
359
|
-
-
|
|
360
|
-
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
376
|
+
## Props Reference
|
|
377
|
+
|
|
378
|
+
| Prop | Type | Required | Default | Description |
|
|
379
|
+
|------|------|----------|---------|-------------|
|
|
380
|
+
| `visible` | `boolean` | Yes | - | Modal visibility |
|
|
381
|
+
| `onConfirm` | `() => void` | Yes | - | Confirm callback |
|
|
382
|
+
| `onCancel` | `() => void` | Yes | - | Cancel callback |
|
|
383
|
+
| `title` | `string` | No | - | Modal title |
|
|
384
|
+
| `message` | `string` | No | - | Modal message |
|
|
385
|
+
| `variant` | `'default' \| 'danger' \| 'warning' \| 'info'` | No | `'default'` | Visual variant |
|
|
386
|
+
| `confirmText` | `string` | No | `'Confirm'` | Confirm button text |
|
|
387
|
+
| `cancelText` | `string` | No | `'Cancel'` | Cancel button text |
|
|
388
|
+
| `icon` | `string` | No | - | Icon name (Ionicons) |
|
|
389
|
+
| `showBackdrop` | `boolean` | No | `true` | Show backdrop |
|
|
390
|
+
| `backdropDismissible` | `boolean` | No | `true` | Allow backdrop dismiss |
|
|
391
|
+
| `style` | `ViewStyle` | No | - | Custom container style |
|
|
392
|
+
|
|
393
|
+
## Accessibility
|
|
394
|
+
|
|
395
|
+
- ✅ Screen reader announces title and message
|
|
396
|
+
- ✅ Focus trap within modal
|
|
397
|
+
- ✅ Keyboard navigation (Escape to cancel)
|
|
398
|
+
- ✅ Touch target size maintained (min 44x44pt)
|
|
399
|
+
- ✅ Semantic dialog role
|
|
400
|
+
- ✅ Proper button labeling
|
|
401
|
+
|
|
402
|
+
## Performance Tips
|
|
403
|
+
|
|
404
|
+
1. **State management**: Use local state for visibility
|
|
405
|
+
2. **Cleanup**: Close modal after navigation
|
|
406
|
+
3. **Memo callbacks**: Use useCallback for handlers
|
|
407
|
+
4. **Prevent double-tap**: Disable confirm button during action
|
|
408
|
+
|
|
409
|
+
## Related Components
|
|
410
|
+
|
|
411
|
+
- [`BaseModal`](./BaseModal/README.md) - Base modal component
|
|
412
|
+
- [`AlertModal`](./alerts/README.md) - Alert modal component
|
|
413
|
+
- [`Button`](../atoms/button/README.md) - Button component
|
|
414
|
+
|
|
415
|
+
## License
|
|
369
416
|
|
|
370
417
|
MIT
|