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

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,412 @@
1
+ # AtomicPicker
2
+
3
+ AtomicPicker, React Native için güçlü ve özelleştirilebilir bir seçim/dropdown bileşenidir. Tek ve çoklu seçim destekler, modal arayüz ile çalışır.
4
+
5
+ ## Özellikler
6
+
7
+ - ✨ **Single & Multi-Select**: Tek ve çoklu seçim desteği
8
+ - 🔍 **Searchable**: Arama/filtreleme özelliği
9
+ - 🎨 **Tam Özelleştirilebilir**: Tema ve stil desteği
10
+ - 📱 **Modal Display**: Full-screen modal (mobile)
11
+ - 🎭 **İkon Desteği**: Seçenekler için ikonlar
12
+ - ✅ **Clearable**: Seçimi temizleme
13
+ - ♿ **Erişilebilir**: Tam erişilebilirlik desteği
14
+ - 📝 **Form Ready**: react-hook-form entegrasyonu hazır
15
+
16
+ ## Kurulum
17
+
18
+ ```tsx
19
+ import { AtomicPicker } from 'react-native-design-system';
20
+ ```
21
+
22
+ ## Temel Kullanım
23
+
24
+ ```tsx
25
+ import React, { useState } from 'react';
26
+ import { View } from 'react-native';
27
+ import { AtomicPicker } from 'react-native-design-system';
28
+
29
+ export const BasicExample = () => {
30
+ const [value, setValue] = useState('birthday');
31
+
32
+ return (
33
+ <View style={{ padding: 16 }}>
34
+ <AtomicPicker
35
+ value={value}
36
+ onChange={setValue}
37
+ options={[
38
+ { label: 'Doğum Günü', value: 'birthday' },
39
+ { label: 'Düğün', value: 'wedding' },
40
+ { label: 'Kurumsal Etkinlik', value: 'corporate' },
41
+ ]}
42
+ label="Etkinlik Türü"
43
+ placeholder="Seçim yapın"
44
+ />
45
+ </View>
46
+ );
47
+ };
48
+ ```
49
+
50
+ ## Single Select
51
+
52
+ ```tsx
53
+ const [partyType, setPartyType] = useState('birthday');
54
+
55
+ <AtomicPicker
56
+ value={partyType}
57
+ onChange={setPartyType}
58
+ options={[
59
+ { label: 'Doğum Günü', value: 'birthday', icon: 'cake' },
60
+ { label: 'Düğün', value: 'wedding', icon: 'heart' },
61
+ { label: 'Kurumsal Etkinlik', value: 'corporate', icon: 'briefcase' },
62
+ ]}
63
+ label="Parti Türü"
64
+ placeholder="Parti türünü seçin"
65
+ />
66
+ ```
67
+
68
+ ## Multi Select
69
+
70
+ ```tsx
71
+ const [guests, setGuests] = useState<string[]>([]);
72
+
73
+ <AtomicPicker
74
+ value={guests}
75
+ onChange={setGuests}
76
+ multiple
77
+ options={[
78
+ { label: 'Ahmet Yılmaz', value: 'ahmet' },
79
+ { label: 'Ayşe Demir', value: 'ayse' },
80
+ { label: 'Mehmet Kaya', value: 'mehmet' },
81
+ ]}
82
+ label="Davetliler"
83
+ placeholder="Davetli seçin"
84
+ modalTitle="Davetli Seçin"
85
+ />
86
+ ```
87
+
88
+ ## Searchable Picker
89
+
90
+ ```tsx
91
+ <AtomicPicker
92
+ value={selectedCountry}
93
+ onChange={setSelectedCountry}
94
+ options={countries} // Uzun liste
95
+ label="Ülke"
96
+ placeholder="Ülke seçin"
97
+ searchable
98
+ searchPlaceholder="Ülke ara..."
99
+ />
100
+ ```
101
+
102
+ ## Clearable
103
+
104
+ ```tsx
105
+ <AtomicPicker
106
+ value={status}
107
+ onChange={setStatus}
108
+ options={statusOptions}
109
+ label="Durum"
110
+ placeholder="Durum seçin"
111
+ clearable
112
+ />
113
+ ```
114
+
115
+ ## Error State
116
+
117
+ ```tsx
118
+ <AtomicPicker
119
+ value={category}
120
+ onChange={setCategory}
121
+ options={categories}
122
+ label="Kategori"
123
+ placeholder="Kategori seçin"
124
+ error="Bu alan zorunludur"
125
+ />
126
+ ```
127
+
128
+ ## Disabled State
129
+
130
+ ```tsx
131
+ <AtomicPicker
132
+ value={role}
133
+ onChange={setRole}
134
+ options={roles}
135
+ label="Rol"
136
+ placeholder="Rol seçin"
137
+ disabled
138
+ />
139
+ ```
140
+
141
+ ## Sizes
142
+
143
+ ```tsx
144
+ <View style={{ gap: 16 }}>
145
+ {/* Small */}
146
+ <AtomicPicker
147
+ size="sm"
148
+ value={value}
149
+ onChange={setValue}
150
+ options={options}
151
+ label="Small"
152
+ />
153
+
154
+ {/* Medium (Varsayılan) */}
155
+ <AtomicPicker
156
+ size="md"
157
+ value={value}
158
+ onChange={setValue}
159
+ options={options}
160
+ label="Medium"
161
+ />
162
+
163
+ {/* Large */}
164
+ <AtomicPicker
165
+ size="lg"
166
+ value={value}
167
+ onChange={setValue}
168
+ options={options}
169
+ label="Large"
170
+ />
171
+ </View>
172
+ ```
173
+
174
+ ## Auto Close
175
+
176
+ ```tsx
177
+ // Single select için otomatik kapanma
178
+ <AtomicPicker
179
+ value={singleValue}
180
+ onChange={setSingleValue}
181
+ options={options}
182
+ autoClose // Varsayılan: true
183
+ />
184
+
185
+ // Multi select için açık kalarak seçim yapma
186
+ <AtomicPicker
187
+ value={multiValue}
188
+ onChange={setMultiValue}
189
+ options={options}
190
+ multiple
191
+ autoClose={false}
192
+ />
193
+ ```
194
+
195
+ ## Örnek Kullanımlar
196
+
197
+ ### Kullanıcı Rolü Seçimi
198
+
199
+ ```tsx
200
+ const [role, setRole] = useState('user');
201
+
202
+ <AtomicPicker
203
+ value={role}
204
+ onChange={setRole}
205
+ options={[
206
+ { label: 'Admin', value: 'admin', icon: 'shield-checkmark' },
207
+ { label: 'Moderatör', value: 'moderator', icon: 'person' },
208
+ { label: 'Kullanıcı', value: 'user', icon: 'person-outline' },
209
+ ]}
210
+ label="Rol"
211
+ placeholder="Rol seçin"
212
+ searchable={false}
213
+ />
214
+ ```
215
+
216
+ ### Ürün Kategorileri
217
+
218
+ ```tsx
219
+ const [categories, setCategories] = useState<string[]>([]);
220
+
221
+ <AtomicPicker
222
+ value={categories}
223
+ onChange={setCategories}
224
+ multiple
225
+ options={productCategories}
226
+ label="Kategoriler"
227
+ placeholder="Kategori seçin"
228
+ modalTitle="Kategori Seçin"
229
+ searchable
230
+ searchPlaceholder="Kategori ara..."
231
+ emptyMessage="Kategori bulunamadı"
232
+ />
233
+ ```
234
+
235
+ ### Şehir Seçimi (Searchable)
236
+
237
+ ```tsx
238
+ const [city, setCity] = useState('');
239
+
240
+ <AtomicPicker
241
+ value={city}
242
+ onChange={setCity}
243
+ options={turkishCities}
244
+ label="Şehir"
245
+ placeholder="Şehir seçin"
246
+ searchable
247
+ searchPlaceholder="Şehir ara..."
248
+ clearable
249
+ />
250
+ ```
251
+
252
+ ### Öncelik Seçimi
253
+
254
+ ```tsx
255
+ const [priority, setPriority] = useState('medium');
256
+
257
+ <AtomicPicker
258
+ value={priority}
259
+ onChange={setPriority}
260
+ options={[
261
+ { label: 'Düşük', value: 'low', icon: 'arrow-down' },
262
+ { label: 'Orta', value: 'medium', icon: 'remove' },
263
+ { label: 'Yüksek', value: 'high', icon: 'arrow-up' },
264
+ { label: 'Acil', value: 'urgent', icon: 'warning' },
265
+ ]}
266
+ label="Öncelik"
267
+ placeholder="Öncelik seçin"
268
+ />
269
+ ```
270
+
271
+ ## Props
272
+
273
+ ### AtomicPickerProps
274
+
275
+ | Prop | Tip | Varsayılan | Açıklama |
276
+ |------|-----|------------|----------|
277
+ | `value` | `string \| string[]` | - **(Zorunlu)** | Seçili değer(ler) |
278
+ | `onChange` | `(value: any) => void` | - **(Zorunlu)** | Değişiklik olayı |
279
+ | `options` | `PickerOption[]` | - **(Zorunlu)** | Seçenek listesi |
280
+ | `label` | `string` | - | Etiket metni |
281
+ | `placeholder` | `string` | - | Placeholder metni |
282
+ | `error` | `string` | - | Hata mesajı |
283
+ | `disabled` | `boolean` | `false` | Devre dışı |
284
+ | `multiple` | `boolean` | `false` | Çoklu seçim |
285
+ | `searchable` | `boolean` | `false` | Arama özelliği |
286
+ | `clearable` | `boolean` | `false` | Temizleme butonu |
287
+ | `autoClose` | `boolean` | `true` | Otomatik kapanma |
288
+ | `size` | `PickerSize` | `'md'` | Boyut |
289
+ | `modalTitle` | `string` | - | Modal başlığı |
290
+ | `emptyMessage` | `string` | - | Boş liste mesajı |
291
+ | `searchPlaceholder` | `string` | - | Arama placeholder'ı |
292
+ | `clearAccessibilityLabel` | `string` | - | Temizleme erişilebilirlik etiketi |
293
+ | `closeAccessibilityLabel` | `string` | - | Kapatma erişilebilirlik etiketi |
294
+ | `style` | `StyleProp<ViewStyle>` | - | Özel stil |
295
+ | `labelStyle` | `StyleProp<TextStyle>` | - | Etiket stili |
296
+ | `testID` | `string` | - | Test ID'si |
297
+
298
+ ### PickerOption
299
+
300
+ ```typescript
301
+ interface PickerOption {
302
+ label: string; // Görüntülenecek metin
303
+ value: any; // Değer
304
+ icon?: string; // İkon ismi (opsiyonel)
305
+ }
306
+ ```
307
+
308
+ ### PickerSize
309
+
310
+ ```typescript
311
+ type PickerSize = 'sm' | 'md' | 'lg';
312
+ ```
313
+
314
+ ## react-hook-form Entegrasyonu
315
+
316
+ ```tsx
317
+ import { useForm, Controller } from 'react-hook-form';
318
+
319
+ function MyForm() {
320
+ const { control, handleSubmit } = useForm({
321
+ defaultValues: {
322
+ country: 'turkey',
323
+ }
324
+ });
325
+
326
+ const onSubmit = (data) => {
327
+ console.log(data);
328
+ };
329
+
330
+ return (
331
+ <Controller
332
+ control={control}
333
+ name="country"
334
+ render={({ field: { onChange, value }, fieldState: { error } }) => (
335
+ <AtomicPicker
336
+ value={value}
337
+ onChange={onChange}
338
+ options={countries}
339
+ label="Ülke"
340
+ placeholder="Ülke seçin"
341
+ error={error?.message}
342
+ />
343
+ )}
344
+ />
345
+ );
346
+ }
347
+ ```
348
+
349
+ ## Best Practices
350
+
351
+ ### 1. Option Yapısı
352
+
353
+ ```tsx
354
+ // İyi - İkonlu seçenekler
355
+ const options = [
356
+ { label: 'Admin', value: 'admin', icon: 'shield' },
357
+ { label: 'User', value: 'user', icon: 'person' },
358
+ ];
359
+
360
+ // İyi - Basit seçenekler
361
+ const options = [
362
+ { label: 'Evet', value: 'yes' },
363
+ { label: 'Hayır', value: 'no' },
364
+ ];
365
+ ```
366
+
367
+ ### 2. Multi-Select Kullanımı
368
+
369
+ ```tsx
370
+ // AutoClose false - birden fazla seçim yapılabilir
371
+ <AtomicPicker
372
+ multiple
373
+ autoClose={false}
374
+ // ...
375
+ />
376
+ ```
377
+
378
+ ### 3. Searchable Kullanımı
379
+
380
+ ```tsx
381
+ // Uzun listelerde searchable kullanın
382
+ <AtomicPicker
383
+ options={longList} // 50+ seçenek
384
+ searchable
385
+ // ...
386
+ />
387
+ ```
388
+
389
+ ## Erişilebilirlik
390
+
391
+ AtomicPicker, tam erişilebilirlik desteği sunar:
392
+
393
+ - ✅ Screen reader desteği
394
+ - ✅ Keyboard navigation
395
+ - ✅ Accessibility label desteği
396
+ - ✅ Test ID desteği
397
+
398
+ ## Performans İpuçları
399
+
400
+ 1. **Uzun Listeler**: `searchable` özelliğini kullanın
401
+ 2. **Multi-Select**: `autoClose={false}` kullanarak UX'i iyileştirin
402
+ 3. **Re-renders**: `onChange` callback'ini stabilize edin
403
+
404
+ ## İlgili Bileşenler
405
+
406
+ - [`FormField`](../../molecules/FormField/README.md) - Form alanı
407
+ - [`AtomicInput`](../input/README.md) - Input bileşeni
408
+ - [`AtomicChip`](../chip/README.md) - Chip bileşeni (seçili değerleri göstermek için)
409
+
410
+ ## Lisans
411
+
412
+ MIT