@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,423 @@
1
+ # AtomicBadge
2
+
3
+ AtomicBadge, etiketler, durum göstergeleri ve küçük bilgi etiketleri için kullanılan bir rozet bileşenidir.
4
+
5
+ ## Özellikler
6
+
7
+ - 🏷️ **6 Variant**: Primary, Secondary, Success, Warning, Error, Info
8
+ - 📏 **3 Size**: Small, Medium, Large
9
+ - 🎭 **İkon Desteği**: Sol veya sağ ikon
10
+ - 🎨 **Semantic Colors**: Anlamlı renkler
11
+ - ♿ **Erişilebilir**: Tam erişilebilirlik desteği
12
+ - 💪 **React.memo**: Optimize edilmiş render
13
+
14
+ ## Kurulum
15
+
16
+ ```tsx
17
+ import { AtomicBadge } from 'react-native-design-system';
18
+ ```
19
+
20
+ ## Temel Kullanım
21
+
22
+ ```tsx
23
+ import React from 'react';
24
+ import { View } from 'react-native';
25
+ import { AtomicBadge } from 'react-native-design-system';
26
+
27
+ export const BasicExample = () => {
28
+ return (
29
+ <View style={{ padding: 16 }}>
30
+ <AtomicBadge text="Badge" />
31
+ </View>
32
+ );
33
+ };
34
+ ```
35
+
36
+ ## Variant'lar
37
+
38
+ ```tsx
39
+ <View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
40
+ <AtomicBadge text="Primary" variant="primary" />
41
+ <AtomicBadge text="Secondary" variant="secondary" />
42
+ <AtomicBadge text="Success" variant="success" />
43
+ <AtomicBadge text="Warning" variant="warning" />
44
+ <AtomicBadge text="Error" variant="error" />
45
+ <AtomicBadge text="Info" variant="info" />
46
+ </View>
47
+ ```
48
+
49
+ ## Boyutlar
50
+
51
+ ```tsx
52
+ <View style={{ flexDirection: 'row', gap: 8, alignItems: 'center' }}>
53
+ {/* Small */}
54
+ <AtomicBadge text="Small" size="sm" variant="primary" />
55
+
56
+ {/* Medium (Varsayılan) */}
57
+ <AtomicBadge text="Medium" size="md" variant="primary" />
58
+
59
+ {/* Large */}
60
+ <AtomicBadge text="Large" size="lg" variant="primary" />
61
+ </View>
62
+ ```
63
+
64
+ ## İkonlu Badge
65
+
66
+ ```tsx
67
+ <View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
68
+ {/* Sol İkon */}
69
+ <AtomicBadge
70
+ text="New"
71
+ variant="success"
72
+ icon="checkmark-circle"
73
+ iconPosition="left"
74
+ />
75
+
76
+ {/* Sağ İkon */}
77
+ <AtomicBadge
78
+ text="Error"
79
+ variant="error"
80
+ icon="warning"
81
+ iconPosition="right"
82
+ />
83
+ </View>
84
+ ```
85
+
86
+ ## Örnek Kullanımlar
87
+
88
+ ### Durum Rozetleri
89
+
90
+ ```tsx
91
+ export const StatusBadges = () => {
92
+ return (
93
+ <View style={{ flexDirection: 'row', gap: 8 }}>
94
+ <AtomicBadge text="Aktif" variant="success" icon="checkmark-circle" />
95
+ <AtomicBadge text="Beklemede" variant="warning" icon="time" />
96
+ <AtomicBadge text="İptal" variant="error" icon="close-circle" />
97
+ <AtomicBadge text="Taslak" variant="secondary" icon="document" />
98
+ </View>
99
+ );
100
+ };
101
+ ```
102
+
103
+ ### Kategori Etiketleri
104
+
105
+ ```tsx
106
+ export const CategoryBadges = ({ categories }) => {
107
+ return (
108
+ <View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
109
+ {categories.map((category) => (
110
+ <AtomicBadge
111
+ key={category.id}
112
+ text={category.name}
113
+ variant="primary"
114
+ size="sm"
115
+ />
116
+ ))}
117
+ </View>
118
+ );
119
+ };
120
+ ```
121
+
122
+ ### Sürüm Etiketi
123
+
124
+ ```tsx
125
+ export const VersionBadge = ({ version }) => {
126
+ return (
127
+ <AtomicBadge
128
+ text={`v${version}`}
129
+ variant="info"
130
+ icon="code-slash"
131
+ size="sm"
132
+ />
133
+ );
134
+ };
135
+ ```
136
+
137
+ ### Bildirim Sayısı
138
+
139
+ ```tsx
140
+ export const NotificationBadge = ({ count }) => {
141
+ return (
142
+ <View style={{ position: 'relative' }}>
143
+ <AtomicIcon name="notifications-outline" size="lg" />
144
+
145
+ {count > 0 && (
146
+ <View style={{ position: 'absolute', top: -4, right: -4 }}>
147
+ <AtomicBadge
148
+ text={count > 99 ? '99+' : count.toString()}
149
+ variant="error"
150
+ size="sm"
151
+ />
152
+ </View>
153
+ )}
154
+ </View>
155
+ );
156
+ };
157
+ ```
158
+
159
+ ### Ürün Durumu
160
+
161
+ ```tsx
162
+ export const ProductBadges = ({ product }) => {
163
+ return (
164
+ <View style={{ flexDirection: 'row', gap: 8 }}>
165
+ {product.isNew && (
166
+ <AtomicBadge
167
+ text="Yeni"
168
+ variant="success"
169
+ icon="sparkles"
170
+ size="sm"
171
+ />
172
+ )}
173
+
174
+ {product.isOnSale && (
175
+ <AtomicBadge
176
+ text="İndirim"
177
+ variant="error"
178
+ icon="pricetag"
179
+ size="sm"
180
+ />
181
+ )}
182
+
183
+ {product.isLimited && (
184
+ <AtomicBadge
185
+ text="Sınırlı"
186
+ variant="warning"
187
+ icon="time"
188
+ size="sm"
189
+ />
190
+ )}
191
+ </View>
192
+ );
193
+ };
194
+ ```
195
+
196
+ ### Kullanıcı Rolü
197
+
198
+ ```tsx
199
+ export const RoleBadge = ({ role }) => {
200
+ const variants = {
201
+ admin: 'error',
202
+ moderator: 'warning',
203
+ user: 'primary',
204
+ guest: 'secondary',
205
+ };
206
+
207
+ return (
208
+ <AtomicBadge
209
+ text={role.toUpperCase()}
210
+ variant={variants[role]}
211
+ size="sm"
212
+ />
213
+ );
214
+ };
215
+ ```
216
+
217
+ ### Öncelik
218
+
219
+ ```tsx
220
+ export const PriorityBadge = ({ priority }) => {
221
+ const config = {
222
+ low: { variant: 'secondary', icon: 'arrow-down' },
223
+ medium: { variant: 'info', icon: 'remove' },
224
+ high: { variant: 'warning', icon: 'arrow-up' },
225
+ urgent: { variant: 'error', icon: 'warning' },
226
+ };
227
+
228
+ const { variant, icon } = config[priority];
229
+
230
+ return (
231
+ <AtomicBadge
232
+ text={priority.toUpperCase()}
233
+ variant={variant}
234
+ icon={icon}
235
+ size="sm"
236
+ />
237
+ );
238
+ };
239
+ ```
240
+
241
+ ### Fiyat Etiketi
242
+
243
+ ```tsx
244
+ export const PriceBadge = ({ price, originalPrice }) => {
245
+ const discount = originalPrice
246
+ ? Math.round((1 - price / originalPrice) * 100)
247
+ : 0;
248
+
249
+ return (
250
+ <View style={{ flexDirection: 'row', gap: 8, alignItems: 'center' }}>
251
+ <AtomicText type="titleLarge" fontWeight="700">
252
+ ${price}
253
+ </AtomicText>
254
+
255
+ {discount > 0 && (
256
+ <AtomicBadge
257
+ text={`%${discount} İndirim`}
258
+ variant="error"
259
+ icon="pricetag"
260
+ size="sm"
261
+ />
262
+ )}
263
+ </View>
264
+ );
265
+ };
266
+ ```
267
+
268
+ ### Listede Rozetler
269
+
270
+ ```tsx
271
+ export const ListItemWithBadges = ({ item }) => {
272
+ return (
273
+ <View style={{ padding: 16 }}>
274
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
275
+ <View>
276
+ <AtomicText type="bodyLarge" fontWeight="600">
277
+ {item.title}
278
+ </AtomicText>
279
+ <AtomicText type="bodySmall" color="textSecondary">
280
+ {item.description}
281
+ </AtomicText>
282
+ </View>
283
+
284
+ <View style={{ flexDirection: 'row', gap: 4 }}>
285
+ {item.badges.map((badge) => (
286
+ <AtomicBadge
287
+ key={badge.id}
288
+ text={badge.text}
289
+ variant={badge.variant}
290
+ size="sm"
291
+ />
292
+ ))}
293
+ </View>
294
+ </View>
295
+ </View>
296
+ );
297
+ };
298
+ ```
299
+
300
+ ### Özellik Rozetleri
301
+
302
+ ```tsx
303
+ export const FeatureBadges = ({ features }) => {
304
+ return (
305
+ <View style={{ flexDirection: 'row', gap: 8, flexWrap: 'wrap' }}>
306
+ {features.map((feature) => (
307
+ <AtomicBadge
308
+ key={feature.id}
309
+ text={feature.name}
310
+ variant="info"
311
+ icon={feature.icon}
312
+ size="sm"
313
+ />
314
+ ))}
315
+ </View>
316
+ );
317
+ };
318
+ ```
319
+
320
+ ## Props
321
+
322
+ ### AtomicBadgeProps
323
+
324
+ | Prop | Tip | Varsayılan | Açıklama |
325
+ |------|-----|------------|----------|
326
+ | `text` | `string` | - **(Zorunlu)** | Rozet metni |
327
+ | `variant` | `BadgeVariant` | `'primary'` | Rozet variant'ı |
328
+ | `size` | `BadgeSize` | `'md'` | Rozet boyutu |
329
+ | `icon` | `IconName` | - | İkon ismi |
330
+ | `iconPosition` | `'left' \| 'right'` | `'left'` | İkon konumu |
331
+ | `style` | `StyleProp<ViewStyle>` | - | Özel stil |
332
+ | `textStyle` | `StyleProp<TextStyle>` | - | Metin stili |
333
+ | `testID` | `string` | - | Test ID'si |
334
+
335
+ ### BadgeVariant
336
+
337
+ ```typescript
338
+ type BadgeVariant =
339
+ | 'primary' // Ana renk
340
+ | 'secondary' // İkincil renk
341
+ | 'success' // Başarı rengi
342
+ | 'warning' // Uyarı rengi
343
+ | 'error' // Hata rengi
344
+ | 'info'; // Bilgi rengi
345
+ ```
346
+
347
+ ### BadgeSize
348
+
349
+ ```typescript
350
+ type BadgeSize =
351
+ | 'sm' // Small
352
+ | 'md' // Medium (varsayılan)
353
+ | 'lg'; // Large
354
+ ```
355
+
356
+ ## Best Practices
357
+
358
+ ### 1. Variant Seçimi
359
+
360
+ ```tsx
361
+ // Başarı durumu
362
+ <AtomicBadge variant="success" />
363
+
364
+ // Hata durumu
365
+ <AtomicBadge variant="error" />
366
+
367
+ // Uyarı durumu
368
+ <AtomicBadge variant="warning" />
369
+
370
+ // Bilgi durumu
371
+ <AtomicBadge variant="info" />
372
+ ```
373
+
374
+ ### 2. Boyut Seçimi
375
+
376
+ ```tsx
377
+ // Yoğun içerik için
378
+ <AtomicBadge size="sm" />
379
+
380
+ // Normal kullanım
381
+ <AtomicBadge size="md" />
382
+
383
+ // Vurgu için
384
+ <AtomicBadge size="lg" />
385
+ ```
386
+
387
+ ### 3. İkon Kullanımı
388
+
389
+ ```tsx
390
+ // Durum göstergeleri
391
+ <AtomicBadge icon="checkmark-circle" variant="success" />
392
+
393
+ // Kategoriler
394
+ <AtomicBadge icon="pricetag" variant="primary" />
395
+
396
+ // Uyarılar
397
+ <AtomicBadge icon="warning" variant="warning" />
398
+ ```
399
+
400
+ ## Erişilebilirlik
401
+
402
+ AtomicBadge, tam erişilebilirlik desteği sunar:
403
+
404
+ - ✅ Screen reader desteği
405
+ - ✅ Semantic renkler
406
+ - ✅ Touch uygun boyut
407
+ - ✅ Test ID desteği
408
+
409
+ ## Performans İpuçları
410
+
411
+ 1. **React.memo**: AtomicBadge zaten optimize edilmiş
412
+ 2. **Static Props**: Prop'ları sabit tutun
413
+ 3. **Listelerde**: `key` prop'unu kullanmayı unutmayın
414
+
415
+ ## İlgili Bileşenler
416
+
417
+ - [`AtomicChip`](./chip/README.md) - Chip bileşeni
418
+ - [`AtomicIcon`](./AtomicIcon/README.md) - İkon bileşeni
419
+ - [`AtomicText`](./AtomicText/README.md) - Metin bileşeni
420
+
421
+ ## Lisans
422
+
423
+ MIT