@umituz/react-native-design-system 2.6.94 → 2.6.95

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.
Files changed (43) hide show
  1. package/package.json +1 -1
  2. package/src/atoms/AtomicAvatar.README.md +284 -397
  3. package/src/atoms/AtomicBadge.README.md +123 -358
  4. package/src/atoms/AtomicCard.README.md +358 -247
  5. package/src/atoms/AtomicDatePicker.README.md +127 -332
  6. package/src/atoms/AtomicFab.README.md +194 -352
  7. package/src/atoms/AtomicIcon.README.md +241 -274
  8. package/src/atoms/AtomicProgress.README.md +100 -338
  9. package/src/atoms/AtomicSpinner.README.md +304 -337
  10. package/src/atoms/AtomicText.README.md +153 -389
  11. package/src/atoms/AtomicTextArea.README.md +267 -268
  12. package/src/atoms/EmptyState.README.md +247 -292
  13. package/src/atoms/GlassView/README.md +313 -444
  14. package/src/atoms/button/README.md +186 -297
  15. package/src/atoms/button/STRATEGY.md +252 -0
  16. package/src/atoms/chip/README.md +242 -290
  17. package/src/atoms/input/README.md +296 -290
  18. package/src/atoms/picker/README.md +278 -309
  19. package/src/atoms/skeleton/AtomicSkeleton.README.md +394 -252
  20. package/src/molecules/BaseModal/README.md +356 -0
  21. package/src/molecules/BaseModal.README.md +324 -200
  22. package/src/molecules/ConfirmationModal.README.md +349 -302
  23. package/src/molecules/Divider/README.md +293 -376
  24. package/src/molecules/FormField.README.md +321 -534
  25. package/src/molecules/GlowingCard/GlowingCard.tsx +1 -1
  26. package/src/molecules/GlowingCard/README.md +230 -372
  27. package/src/molecules/List/README.md +281 -488
  28. package/src/molecules/ListItem.README.md +320 -315
  29. package/src/molecules/SearchBar/README.md +332 -430
  30. package/src/molecules/StepHeader/README.md +311 -411
  31. package/src/molecules/StepProgress/README.md +281 -448
  32. package/src/molecules/alerts/README.md +272 -355
  33. package/src/molecules/avatar/README.md +295 -356
  34. package/src/molecules/bottom-sheet/README.md +303 -340
  35. package/src/molecules/calendar/README.md +301 -265
  36. package/src/molecules/countdown/README.md +347 -456
  37. package/src/molecules/emoji/README.md +281 -514
  38. package/src/molecules/listitem/README.md +307 -399
  39. package/src/molecules/media-card/MediaCard.tsx +31 -34
  40. package/src/molecules/media-card/README.md +217 -319
  41. package/src/molecules/navigation/README.md +263 -284
  42. package/src/molecules/splash/README.md +76 -80
  43. package/src/molecules/swipe-actions/README.md +376 -588
@@ -0,0 +1,252 @@
1
+ # Button
2
+
3
+ Clickable button component with multiple variants and sizes for React Native applications.
4
+
5
+ ## Import & Usage
6
+
7
+ ```typescript
8
+ import { Button } from 'react-native-design-system/src/atoms/button';
9
+ ```
10
+
11
+ **Location:** `src/atoms/button/Button.tsx`
12
+
13
+ ## Basic Usage
14
+
15
+ ```tsx
16
+ <Button title="Click me" onPress={handlePress} />
17
+ ```
18
+
19
+ ## Strategy
20
+
21
+ **Purpose**: Provide consistent, accessible, and performant button interactions throughout the application.
22
+
23
+ **When to Use**:
24
+ - Primary actions (submit, confirm, save)
25
+ - Secondary actions (cancel, go back)
26
+ - Destructive actions (delete, remove)
27
+ - Navigation actions (open link, go to screen)
28
+
29
+ **When NOT to Use**:
30
+ - For navigation - use Navigation components instead
31
+ - For complex interactions - use Pressable or TouchableOpacity
32
+ - For icon-only buttons - use IconButton instead
33
+
34
+ ## Rules
35
+
36
+ ### Required
37
+
38
+ 1. **ALWAYS** provide a `title` prop (except for loading state)
39
+ 2. **MUST** have an `onPress` handler (unless disabled)
40
+ 3. **NEVER** nest buttons inside buttons
41
+ 4. **ALWAYS** provide accessible label for icon-only buttons
42
+ 5. **MUST** have adequate touch target size (min 44x44pt)
43
+
44
+ ### Disabled State
45
+
46
+ 1. **MUST** visually indicate disabled state
47
+ 2. **MUST NOT** respond to touch when disabled
48
+ 3. **SHOULD** provide reason for disabled state (tooltip or hint)
49
+
50
+ ### Variants
51
+
52
+ 1. **Primary**: Single primary action per screen/section
53
+ 2. **Secondary**: Multiple secondary actions allowed
54
+ 3. **Destructive**: Reserved for destructive actions only
55
+ 4. **Ghost**: For tertiary actions or cancel buttons
56
+
57
+ ## Forbidden
58
+
59
+ ❌ **NEVER** do these:
60
+
61
+ ```tsx
62
+ // ❌ Empty buttons
63
+ <Button />
64
+
65
+ // ❌ Nested buttons
66
+ <Button onPress={action1}>
67
+ <Button onPress={action2} />
68
+ </Button>
69
+
70
+ // ❌ Buttons without onPress
71
+ <Button title="Click me" />
72
+
73
+ // ❌ Inline buttons (use Link instead)
74
+ <View style={{ flexDirection: 'row' }}>
75
+ <Text>Click </Text>
76
+ <Button title="here" />
77
+ </View>
78
+
79
+ // ❌ Too many primary buttons
80
+ <View>
81
+ <Button variant="primary" title="Save" />
82
+ <Button variant="primary" title="Cancel" /> {/* ❌ Use ghost */}
83
+ </View>
84
+
85
+ // ❌ Hardcoded text (use i18n)
86
+ <Button title="Submit" /> {/* ❌ Use t('buttons.submit') */}
87
+ ```
88
+
89
+ ## Best Practices
90
+
91
+ ### Button Placement
92
+
93
+ ✅ **DO**:
94
+ - Place primary action at bottom-right or top-right
95
+ - Group related actions together
96
+ - Use consistent button order (Cancel, OK) or (OK, Cancel)
97
+
98
+ ❌ **DON'T**:
99
+ - Place primary action in middle of other actions
100
+ - Mix button order inconsistently
101
+ - Use too many buttons on one screen
102
+
103
+ ### Button Wording
104
+
105
+ ✅ **DO**:
106
+ - Use action verbs (Save, Delete, Cancel)
107
+ - Be specific (Save Draft vs Save)
108
+ - Use sentence case
109
+ - Keep short (1-3 words)
110
+
111
+ ❌ **DON'T**:
112
+ - Use ambiguous text (OK, Sure, Submit)
113
+ - Use long text (I agree to the terms and conditions)
114
+ - Use all caps (CLICK HERE)
115
+
116
+ ### Loading State
117
+
118
+ ✅ **DO**:
119
+ ```tsx
120
+ <Button loading={isLoading} onPress={handleSubmit}>
121
+ {isLoading ? 'Saving...' : 'Save'}
122
+ </Button>
123
+ ```
124
+
125
+ ❌ **DON'T**:
126
+ ```tsx
127
+ // Don't disable entire form during load
128
+ <Button disabled={isLoading} />
129
+ ```
130
+
131
+ ## AI Coding Guidelines
132
+
133
+ ### For AI Agents
134
+
135
+ When generating Button components, follow these rules:
136
+
137
+ 1. **Always import from correct path**:
138
+ ```typescript
139
+ import { Button } from 'react-native-design-system/src/atoms/button';
140
+ ```
141
+
142
+ 2. **Always provide required props**:
143
+ ```tsx
144
+ <Button
145
+ title="明确且简洁的标题"
146
+ onPress={具体的处理函数}
147
+ variant="根据上下文选择合适的变体"
148
+ />
149
+ ```
150
+
151
+ 3. **Always handle loading state**:
152
+ ```tsx
153
+ const [loading, setLoading] = useState(false);
154
+
155
+ <Button
156
+ loading={loading}
157
+ onPress={async () => {
158
+ setLoading(true);
159
+ await handleAction();
160
+ setLoading(false);
161
+ }}
162
+ />
163
+ ```
164
+
165
+ 4. **Always use i18n for text**:
166
+ ```tsx
167
+ <Button title={t('common.save')} onPress={handleSave} />
168
+ ```
169
+
170
+ 5. **Never disable without reason**:
171
+ ```tsx
172
+ // ❌ Bad
173
+ <Button disabled={true} />
174
+
175
+ // ✅ Good
176
+ <Button disabled={!form.isValid} title={form.error || 'Complete form'} />
177
+ ```
178
+
179
+ ### Common Patterns
180
+
181
+ #### Form Submit Button
182
+ ```tsx
183
+ <Button
184
+ variant="primary"
185
+ title={t('form.submit')}
186
+ onPress={handleSubmit}
187
+ disabled={!isFormValid}
188
+ loading={isSubmitting}
189
+ />
190
+ ```
191
+
192
+ #### Destructive Action
193
+ ```tsx
194
+ <Button
195
+ variant="destructive"
196
+ title={t('common.delete')}
197
+ onPress={handleDelete}
198
+ confirmRequired={true}
199
+ />
200
+ ```
201
+
202
+ #### Cancel Action
203
+ ```tsx
204
+ <Button
205
+ variant="ghost"
206
+ title={t('common.cancel')}
207
+ onPress={handleCancel}
208
+ />
209
+ ```
210
+
211
+ ## Props Reference
212
+
213
+ | Prop | Type | Required | Default | Description |
214
+ |------|------|----------|---------|-------------|
215
+ | `title` | `string` | Yes* | - | Button text (*not required for loading) |
216
+ | `onPress` | `() => void` | Yes | - | Press handler |
217
+ | `variant` | `'primary' \| 'secondary' \| 'ghost' \| 'destructive'` | No | `'primary'` | Visual style |
218
+ | `size` | `'small' \| 'medium' \| 'large'` | No | `'medium'` | Button size |
219
+ | `disabled` | `boolean` | No | `false` | Disable button |
220
+ | `loading` | `boolean` | No | `false` | Show loading indicator |
221
+ | `fullWidth` | `boolean` | No | `false` | Expand to full width |
222
+ | `icon` | `string` | No | - | Icon name (Ionicons) |
223
+
224
+ ## Accessibility
225
+
226
+ - ✅ Screen reader announces button title
227
+ - ✅ Minimum touch target: 44x44pt
228
+ - ✅ Focus visible on keyboard navigation
229
+ - ✅ Disabled state announced to screen readers
230
+ - ✅ Loading state announced to screen readers
231
+
232
+ ## Performance
233
+
234
+ 1. **Memo handlers**: Use `useCallback` for onPress handlers
235
+ 2. **Avoid inline functions**: Don't create functions in render
236
+ 3. **Conditional rendering**: Don't render disabled buttons if action unavailable
237
+
238
+ ## Related Components
239
+
240
+ - [`IconButton`](./icon-button/README.md) - Icon-only buttons
241
+ - [`Link`](./link/README.md) - Navigation links
242
+ - [`Pressable`](../pressable/README.md) - Custom pressable components
243
+
244
+ ## Version History
245
+
246
+ - **2.6.0**: Added loading prop
247
+ - **2.5.0**: Added fullWidth support
248
+ - **2.0.0**: Initial release with 4 variants
249
+
250
+ ## License
251
+
252
+ MIT