@momo-kits/native-kits 0.157.1-skill.1-debug → 0.157.1-skill.3-debug
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/.claude/momo-native-kits-skill/SKILL.md +51 -0
- package/.claude/momo-native-kits-skill/evals/evals.json +95 -0
- package/.claude/momo-native-kits-skill/references/badge.md +52 -0
- package/.claude/momo-native-kits-skill/references/button.md +182 -0
- package/.claude/momo-native-kits-skill/references/card.md +48 -0
- package/.claude/momo-native-kits-skill/references/checkbox.md +51 -0
- package/.claude/momo-native-kits-skill/references/chip.md +48 -0
- package/.claude/momo-native-kits-skill/references/constants.md +260 -0
- package/.claude/momo-native-kits-skill/references/divider.md +26 -0
- package/.claude/momo-native-kits-skill/references/input.md +408 -0
- package/.claude/momo-native-kits-skill/references/navigation.md +475 -0
- package/.claude/momo-native-kits-skill/references/popup.md +97 -0
- package/.claude/momo-native-kits-skill/references/radio.md +60 -0
- package/.claude/momo-native-kits-skill/references/skeleton.md +40 -0
- package/.claude/momo-native-kits-skill/references/snackbar.md +54 -0
- package/.claude/momo-native-kits-skill/references/switch.md +62 -0
- package/.claude/momo-native-kits-skill/references/text.md +195 -0
- package/.claude/momo-native-kits-skill/references/tooltip.md +34 -0
- package/.claude/momo-native-kits-skill/references/trustbanner.md +61 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/benchmark.json +20 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/benchmark.md +13 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-0-button/eval_metadata.json +6 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-0-button/with_skill/outputs/ButtonExample.kt +55 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-0-button/without_skill/outputs/ButtonExample.kt +45 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-1-input/eval_metadata.json +6 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-1-input/with_skill/outputs/InputPhoneExample.kt +40 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-1-input/without_skill/outputs/InputPhoneExample.kt +42 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-2-bottomtab/eval_metadata.json +6 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-2-bottomtab/with_skill/outputs/BottomTabExample.kt +236 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-2-bottomtab/without_skill/outputs/BottomTabExample.kt +152 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-3-checkbox/eval_metadata.json +6 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-3-checkbox/with_skill/outputs/CheckBoxExample.kt +49 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-3-checkbox/without_skill/outputs/CheckBoxExample.kt +123 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-4-datetimepicker/eval_metadata.json +6 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-4-datetimepicker/with_skill/outputs/DateTimePickerExample.kt +318 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-1/eval-4-datetimepicker/without_skill/outputs/DateTimePickerExample.kt +330 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-card/with_skill/outputs/CardExample.kt +124 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-card/without_skill/outputs/CardExample.kt +71 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-loginform/with_skill/outputs/LoginFormExample.kt +134 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-loginform/without_skill/outputs/LoginFormExample.kt +199 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-navcontainer/with_skill/outputs/NavigationContainerExample.kt +224 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-navcontainer/without_skill/outputs/NavigationContainerExample.kt +225 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-popup/with_skill/outputs/PopupExample.kt +79 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-popup/without_skill/outputs/PopupExample.kt +169 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-setoptions/eval_metadata.json +6 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-setoptions/with_skill/outputs/SetOptionsExample.kt +255 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-setoptions/without_skill/outputs/SetOptionsExample.kt +212 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-skeleton/with_skill/outputs/SkeletonExample.kt +199 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-2/eval-skeleton/without_skill/outputs/SkeletonExample.kt +229 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/benchmark.json +20 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/benchmark.md +13 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-button/eval_metadata.json +22 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-button/with_skill/outputs/PrimaryButtonExample.kt +38 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-button/with_skill/timing.json +5 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-button/without_skill/outputs/PrimaryButtonExample.kt +83 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-button/without_skill/timing.json +5 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-navcontainer/eval_metadata.json +22 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-navcontainer/with_skill/outputs/NavigationContainerExample.kt +547 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-navcontainer/with_skill/timing.json +5 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-navcontainer/without_skill/outputs/MoMoNavigationContainer.kt +519 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-navcontainer/without_skill/timing.json +5 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-setoptions/eval_metadata.json +27 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-setoptions/with_skill/outputs/SetOptionsExample.kt +429 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-setoptions/with_skill/timing.json +5 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-setoptions/without_skill/outputs/SetOptionsExample.kt +353 -0
- package/.claude/momo-native-kits-skill/workspace/iteration-3/eval-setoptions/without_skill/timing.json +5 -0
- package/.claude/settings.local.json +35 -7
- package/compose/build.gradle.kts +1 -1
- package/gradle.properties +1 -1
- package/ios/Input/Input.swift +112 -50
- package/local.properties +1 -1
- package/package.json +1 -1
- package/.claude/momo-native-kits/SKILL.md +0 -87
- package/.claude/momo-native-kits/references/Badge.md +0 -39
- package/.claude/momo-native-kits/references/BadgeDot.md +0 -37
- package/.claude/momo-native-kits/references/BottomSheet.md +0 -51
- package/.claude/momo-native-kits/references/BottomTab.md +0 -65
- package/.claude/momo-native-kits/references/Button.md +0 -197
- package/.claude/momo-native-kits/references/CheckBox.md +0 -51
- package/.claude/momo-native-kits/references/Chip.md +0 -47
- package/.claude/momo-native-kits/references/Divider.md +0 -29
- package/.claude/momo-native-kits/references/HeaderTitle.md +0 -45
- package/.claude/momo-native-kits/references/HeaderType.md +0 -47
- package/.claude/momo-native-kits/references/Icon.md +0 -32
- package/.claude/momo-native-kits/references/Image.md +0 -38
- package/.claude/momo-native-kits/references/Information.md +0 -36
- package/.claude/momo-native-kits/references/Input.md +0 -334
- package/.claude/momo-native-kits/references/InputDropDown.md +0 -47
- package/.claude/momo-native-kits/references/InputMoney.md +0 -241
- package/.claude/momo-native-kits/references/InputOTP.md +0 -52
- package/.claude/momo-native-kits/references/InputPhoneNumber.md +0 -175
- package/.claude/momo-native-kits/references/InputSearch.md +0 -57
- package/.claude/momo-native-kits/references/InputTextArea.md +0 -46
- package/.claude/momo-native-kits/references/NavigationContainer.md +0 -51
- package/.claude/momo-native-kits/references/Navigator.md +0 -287
- package/.claude/momo-native-kits/references/PaginationDot.md +0 -28
- package/.claude/momo-native-kits/references/PaginationNumber.md +0 -28
- package/.claude/momo-native-kits/references/PopupNotify.md +0 -47
- package/.claude/momo-native-kits/references/Radio.md +0 -44
- package/.claude/momo-native-kits/references/Skeleton.md +0 -32
- package/.claude/momo-native-kits/references/Switch.md +0 -36
- package/.claude/momo-native-kits/references/Tag.md +0 -40
- package/.claude/momo-native-kits/references/Text.md +0 -37
- package/.claude/momo-native-kits/references/Title.md +0 -43
- package/.claude/momo-native-kits/references/Tooltip.md +0 -30
- package/building-skill-for-claude.md +0 -1190
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# Constants & Design Tokens
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Design tokens and constants ensure consistent styling across the app.
|
|
6
|
+
|
|
7
|
+
**Package:** `vn.momo.kits.const`
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Colors
|
|
12
|
+
|
|
13
|
+
**File:** `vn.momo/kits/const/Colors.kt`
|
|
14
|
+
|
|
15
|
+
### Color Palette
|
|
16
|
+
|
|
17
|
+
#### Black
|
|
18
|
+
| Name | Hex | Usage |
|
|
19
|
+
|------|-----|-------|
|
|
20
|
+
| `Colors.black_01` | #000000 | Primary text |
|
|
21
|
+
| `Colors.black_02` | #1A1A1A | Secondary text |
|
|
22
|
+
| `Colors.black_03` | #333333 | Tertiary text |
|
|
23
|
+
| ... | ... | ... |
|
|
24
|
+
| `Colors.black_10` | #FFFFFF | Not really black |
|
|
25
|
+
|
|
26
|
+
#### White
|
|
27
|
+
| Name | Hex | Usage |
|
|
28
|
+
|------|-----|-------|
|
|
29
|
+
| `Colors.white_01` | #FFFFFF | Primary background |
|
|
30
|
+
| `Colors.white_02` | #F5F5F5 | Secondary background |
|
|
31
|
+
|
|
32
|
+
#### Red (Error/Danger)
|
|
33
|
+
| Name | Hex | Usage |
|
|
34
|
+
|------|-----|-------|
|
|
35
|
+
| `Colors.red_01` | #FFEBEE | Light background |
|
|
36
|
+
| `Colors.red_02` | #F44336 | Primary red |
|
|
37
|
+
| `Colors.red_03` | #D32F2F | Dark red |
|
|
38
|
+
| `Colors.red_04` | #C62828 | Error text |
|
|
39
|
+
| `Colors.red_05` | #B71C1C | Deep red |
|
|
40
|
+
|
|
41
|
+
#### Pink (Primary Brand)
|
|
42
|
+
| Name | Hex | Usage |
|
|
43
|
+
|------|-----|-------|
|
|
44
|
+
| `Colors.pink_01` | #AD0000 | MoMo primary |
|
|
45
|
+
| `Colors.pink_02` | #C62828 | Hover state |
|
|
46
|
+
| `Colors.pink_03` | #7F0000 | Pressed state |
|
|
47
|
+
|
|
48
|
+
#### Blue
|
|
49
|
+
| Name | Hex | Usage |
|
|
50
|
+
|------|-----|-------|
|
|
51
|
+
| `Colors.blue_01` | #E3F2FD | Light background |
|
|
52
|
+
| `Colors.blue_02` | #2196F3 | Primary blue |
|
|
53
|
+
| `Colors.blue_03` | #1976D2 | Dark blue |
|
|
54
|
+
| `Colors.blue_04` | #0D47A1 | Deep blue |
|
|
55
|
+
| `Colors.blue_05` | #001F5C | Navy |
|
|
56
|
+
|
|
57
|
+
#### Green (Success)
|
|
58
|
+
| Name | Hex | Usage |
|
|
59
|
+
|------|-----|-------|
|
|
60
|
+
| `Colors.green_01` | #E8F5E9 | Light background |
|
|
61
|
+
| `Colors.green_02` | #4CAF50 | Success |
|
|
62
|
+
| `Colors.green_03` | #388E3C | Dark green |
|
|
63
|
+
|
|
64
|
+
#### Yellow (Warning)
|
|
65
|
+
| Name | Hex | Usage |
|
|
66
|
+
|------|-----|-------|
|
|
67
|
+
| `Colors.yellow_01` | #FFFDE7 | Light background |
|
|
68
|
+
| `Colors.yellow_02` | #FFC107 | Warning |
|
|
69
|
+
| `Colors.yellow_03` | #FFA000 | Dark yellow |
|
|
70
|
+
|
|
71
|
+
#### Gray
|
|
72
|
+
| Name | Hex | Usage |
|
|
73
|
+
|------|-----|-------|
|
|
74
|
+
| `Colors.gray_01` | #FAFAFA | Lightest gray |
|
|
75
|
+
| `Colors.gray_02` | #F5F5F5 | Light gray |
|
|
76
|
+
| `Colors.gray_03` | #EEEEEE | ... |
|
|
77
|
+
| `Colors.gray_04` | #E0E0E0 | ... |
|
|
78
|
+
| `Colors.gray_05` | #BDBDBD | ... |
|
|
79
|
+
| `Colors.gray_06` | #9E9E9E | ... |
|
|
80
|
+
| `Colors.gray_07` | #757575 | ... |
|
|
81
|
+
| `Colors.gray_08` | #616161 | ... |
|
|
82
|
+
| `Colors.gray_09` | #424242 | Dark gray |
|
|
83
|
+
|
|
84
|
+
### Usage
|
|
85
|
+
|
|
86
|
+
```kotlin
|
|
87
|
+
import vn.momo.kits.const.Colors
|
|
88
|
+
|
|
89
|
+
// Text color
|
|
90
|
+
Text(
|
|
91
|
+
text = "Hello",
|
|
92
|
+
color = Colors.black_01
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
// Background
|
|
96
|
+
Box(
|
|
97
|
+
modifier = Modifier.background(Colors.pink_01)
|
|
98
|
+
) { /* content */ }
|
|
99
|
+
|
|
100
|
+
// Conditional color
|
|
101
|
+
val statusColor = if (isSuccess) Colors.green_02 else Colors.red_02
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Radius
|
|
107
|
+
|
|
108
|
+
**File:** `vn.momo/kits/const/Radius.kt`
|
|
109
|
+
|
|
110
|
+
### Values
|
|
111
|
+
|
|
112
|
+
| Name | Value | Usage |
|
|
113
|
+
|------|-------|-------|
|
|
114
|
+
| `Radius.S` | 4.dp | Small elements, tags |
|
|
115
|
+
| `Radius.M` | 8.dp | Cards, inputs |
|
|
116
|
+
| `Radius.L` | 12.dp | Large cards |
|
|
117
|
+
| `Radius.XL` | 16.dp | Modals |
|
|
118
|
+
| `Radius.XXL` | 24.dp | Large modals |
|
|
119
|
+
|
|
120
|
+
### Usage
|
|
121
|
+
|
|
122
|
+
```kotlin
|
|
123
|
+
import vn.momo.kits.const.Radius
|
|
124
|
+
|
|
125
|
+
// With Card
|
|
126
|
+
Card(
|
|
127
|
+
cornerRadius = Radius.M
|
|
128
|
+
) { /* content */ }
|
|
129
|
+
|
|
130
|
+
// With shape
|
|
131
|
+
Box(
|
|
132
|
+
modifier = Modifier
|
|
133
|
+
.clip(RoundedCornerShape(Radius.S))
|
|
134
|
+
) { /* content */ }
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Spacing
|
|
140
|
+
|
|
141
|
+
**File:** `vn.momo/kits/const/Spacing.kt`
|
|
142
|
+
|
|
143
|
+
### Values
|
|
144
|
+
|
|
145
|
+
| Name | Value | Usage |
|
|
146
|
+
|------|-------|-------|
|
|
147
|
+
| `Spacing.XS` | 4.dp | Tight spacing |
|
|
148
|
+
| `Spacing.S` | 8.dp | Small gaps |
|
|
149
|
+
| `Spacing.M` | 12.dp | Default gaps |
|
|
150
|
+
| `Spacing.L` | 16.dp | Standard padding |
|
|
151
|
+
| `Spacing.XL` | 24.dp | Section spacing |
|
|
152
|
+
| `Spacing.XXL` | 32.dp | Large gaps |
|
|
153
|
+
|
|
154
|
+
### Usage
|
|
155
|
+
|
|
156
|
+
```kotlin
|
|
157
|
+
import vn.momo.kits.const.Spacing
|
|
158
|
+
|
|
159
|
+
// Column spacing
|
|
160
|
+
Column(
|
|
161
|
+
verticalArrangement = Arrangement.spacedBy(Spacing.M)
|
|
162
|
+
) { /* items */ }
|
|
163
|
+
|
|
164
|
+
// Padding
|
|
165
|
+
Box(
|
|
166
|
+
modifier = Modifier.padding(Spacing.L)
|
|
167
|
+
) { /* content */ }
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Typography
|
|
173
|
+
|
|
174
|
+
**File:** `vn.momo/kits/const/Typography.kt`
|
|
175
|
+
|
|
176
|
+
### Available Styles
|
|
177
|
+
|
|
178
|
+
| Style | Size | Weight | Usage |
|
|
179
|
+
|-------|------|--------|-------|
|
|
180
|
+
| `headlineDefault` | 24sp | Regular | Large titles |
|
|
181
|
+
| `headlineDefaultBold` | 24sp | Bold | Bold headlines |
|
|
182
|
+
| `titleDefault` | 20sp | Regular | Section titles |
|
|
183
|
+
| `titleDefaultBold` | 20sp | Bold | Bold titles |
|
|
184
|
+
| `bodyDefault` | 16sp | Regular | Body text |
|
|
185
|
+
| `bodyBold` | 16sp | Bold | Bold body |
|
|
186
|
+
| `bodySmall` | 14sp | Regular | Secondary text |
|
|
187
|
+
| `actionDefault` | 14sp | Regular | Button text |
|
|
188
|
+
| `actionDefaultBold` | 14sp | Bold | Bold buttons |
|
|
189
|
+
| `captionDefault` | 12sp | Regular | Captions |
|
|
190
|
+
| `captionBold` | 12sp | Bold | Bold captions |
|
|
191
|
+
|
|
192
|
+
### Usage
|
|
193
|
+
|
|
194
|
+
```kotlin
|
|
195
|
+
import vn.momo.kits.const.Typography
|
|
196
|
+
|
|
197
|
+
Text(
|
|
198
|
+
text = "Headline",
|
|
199
|
+
style = Typography.headlineDefaultBold
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
Text(
|
|
203
|
+
text = "Body text",
|
|
204
|
+
style = Typography.bodyDefault
|
|
205
|
+
)
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## AppTheme
|
|
211
|
+
|
|
212
|
+
**File:** `vn.momo.kits/const/AppTheme.kt`
|
|
213
|
+
|
|
214
|
+
### Accessing Theme
|
|
215
|
+
|
|
216
|
+
```kotlin
|
|
217
|
+
import vn.momo.kits.const.AppTheme
|
|
218
|
+
|
|
219
|
+
val theme = AppTheme.current
|
|
220
|
+
|
|
221
|
+
// Theme colors
|
|
222
|
+
theme.colors.primary // Primary brand color
|
|
223
|
+
theme.colors.background.surface // Surface background
|
|
224
|
+
theme.colors.text.default // Default text color
|
|
225
|
+
theme.colors.text.secondary // Secondary text
|
|
226
|
+
theme.colors.text.disable // Disabled text
|
|
227
|
+
theme.colors.border.default // Default border
|
|
228
|
+
theme.colors.error.primary // Error color
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Usage in Components
|
|
232
|
+
|
|
233
|
+
```kotlin
|
|
234
|
+
@Composable
|
|
235
|
+
fun MyComponent() {
|
|
236
|
+
val theme = AppTheme.current
|
|
237
|
+
|
|
238
|
+
Box(
|
|
239
|
+
modifier = Modifier
|
|
240
|
+
.background(theme.colors.background.surface)
|
|
241
|
+
.padding(theme.spacing?.let { Spacing.L } ?: 16.dp)
|
|
242
|
+
) {
|
|
243
|
+
Text(
|
|
244
|
+
text = "Themed text",
|
|
245
|
+
color = theme.colors.text.default
|
|
246
|
+
)
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Best Practices
|
|
254
|
+
|
|
255
|
+
1. **Use design tokens** - Never hardcode colors, spacing, etc.
|
|
256
|
+
2. **Use Colors constants** - Consistent palette
|
|
257
|
+
3. **Use Radius constants** - Consistent corner radii
|
|
258
|
+
4. **Use Spacing constants** - Consistent gaps and padding
|
|
259
|
+
5. **Use Typography constants** - Consistent text styles
|
|
260
|
+
6. **Use AppTheme for theming** - Support light/dark mode
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Divider
|
|
2
|
+
|
|
3
|
+
**File:** `vn.momo/kits/components/Divider.kt`
|
|
4
|
+
|
|
5
|
+
## Parameters
|
|
6
|
+
|
|
7
|
+
```kotlin
|
|
8
|
+
@Composable
|
|
9
|
+
fun Divider(
|
|
10
|
+
modifier: Modifier = Modifier,
|
|
11
|
+
color: Color = AppTheme.current.colors.border.default,
|
|
12
|
+
thickness: Dp = 1.dp
|
|
13
|
+
)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```kotlin
|
|
19
|
+
Column {
|
|
20
|
+
Text(text = "Item 1")
|
|
21
|
+
Divider()
|
|
22
|
+
Text(text = "Item 2")
|
|
23
|
+
Divider()
|
|
24
|
+
Text(text = "Item 3")
|
|
25
|
+
}
|
|
26
|
+
```
|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
# Input Components
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
MoMo Native Kits provides a comprehensive set of input components for various use cases.
|
|
6
|
+
|
|
7
|
+
**Package:** `vn.momo.kits.components`
|
|
8
|
+
|
|
9
|
+
## Input Types
|
|
10
|
+
|
|
11
|
+
| Component | Description | Use Case |
|
|
12
|
+
|-----------|-------------|----------|
|
|
13
|
+
| `Input` | Basic text input | Text fields, forms |
|
|
14
|
+
| `InputSearch` | Search input with clear button | Search functionality |
|
|
15
|
+
| `InputTextArea` | Multi-line text input | Comments, descriptions |
|
|
16
|
+
| `InputOTP` | OTP code input | Verification codes |
|
|
17
|
+
| `InputMoney` | Money/currency input | Payment amounts |
|
|
18
|
+
| `InputDropDown` | Dropdown selection | Selection lists |
|
|
19
|
+
| `InputPhoneNumber` | Phone number input | Phone fields |
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Input Component
|
|
24
|
+
|
|
25
|
+
**File:** `vn/momo/kits/components/Input.kt`
|
|
26
|
+
|
|
27
|
+
### Parameters
|
|
28
|
+
|
|
29
|
+
```kotlin
|
|
30
|
+
@Composable
|
|
31
|
+
fun Input(
|
|
32
|
+
text: MutableState<String>, // Required: Text value (MutableState)
|
|
33
|
+
onChangeText: (String) -> Unit, // Required: Text change callback
|
|
34
|
+
modifier: Modifier = Modifier,
|
|
35
|
+
size: InputSize = InputSize.LARGE, // SMALL or LARGE
|
|
36
|
+
floatingValue: String = "", // Floating label text
|
|
37
|
+
placeholder: String = "", // Placeholder text
|
|
38
|
+
error: String = "", // Error message
|
|
39
|
+
helper: String = "", // Helper text
|
|
40
|
+
icon: String = "", // Icon (URL or icon name)
|
|
41
|
+
leadingIcon: String = "", // Leading icon
|
|
42
|
+
disabled: Boolean = false, // Disabled state
|
|
43
|
+
errorSpacing: Boolean = false, // Extra spacing for error
|
|
44
|
+
keyboardType: KeyboardType = KeyboardType.Text,
|
|
45
|
+
password: Boolean = false, // Password field
|
|
46
|
+
maxLine: Int = 1,
|
|
47
|
+
maxLength: Int = Int.MAX_VALUE,
|
|
48
|
+
onRightIconClick: (() -> Unit)? = null,
|
|
49
|
+
onTap: (() -> Unit)? = null,
|
|
50
|
+
floatingIcon: String = "", // Floating icon (left)
|
|
51
|
+
floatingIconColor: Color? = null // Floating icon color
|
|
52
|
+
)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### InputSize Values
|
|
56
|
+
|
|
57
|
+
| Size | Height | Border Width | Border Radius |
|
|
58
|
+
|------|--------|--------------|---------------|
|
|
59
|
+
| `SMALL` | 48.dp | 1.dp | 4.dp |
|
|
60
|
+
| `LARGE` | 56.dp | 1.dp | 4.dp |
|
|
61
|
+
|
|
62
|
+
### Usage Examples
|
|
63
|
+
|
|
64
|
+
#### Basic Input
|
|
65
|
+
|
|
66
|
+
```kotlin
|
|
67
|
+
val text = remember { mutableStateOf("") }
|
|
68
|
+
|
|
69
|
+
Input(
|
|
70
|
+
text = text,
|
|
71
|
+
onChangeText = { text.value = it },
|
|
72
|
+
floatingValue = "Họ và tên",
|
|
73
|
+
placeholder = "Nhập họ và tên"
|
|
74
|
+
)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### Input with Error
|
|
78
|
+
|
|
79
|
+
```kotlin
|
|
80
|
+
val email = remember { mutableStateOf("") }
|
|
81
|
+
val emailError = remember { mutableStateOf("Email không hợp lệ") }
|
|
82
|
+
|
|
83
|
+
Input(
|
|
84
|
+
text = email,
|
|
85
|
+
onChangeText = { email.value = it },
|
|
86
|
+
floatingValue = "Email",
|
|
87
|
+
error = emailError.value // Shows error state
|
|
88
|
+
)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
#### Input with Leading Icon
|
|
92
|
+
|
|
93
|
+
```kotlin
|
|
94
|
+
val phone = remember { mutableStateOf("") }
|
|
95
|
+
|
|
96
|
+
Input(
|
|
97
|
+
text = phone,
|
|
98
|
+
onChangeText = { phone.value = it },
|
|
99
|
+
floatingValue = "Số điện thoại",
|
|
100
|
+
leadingIcon = "https://example.com/phone-icon.png"
|
|
101
|
+
)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### Password Input
|
|
105
|
+
|
|
106
|
+
```kotlin
|
|
107
|
+
val password = remember { mutableStateOf("") }
|
|
108
|
+
|
|
109
|
+
Input(
|
|
110
|
+
text = password,
|
|
111
|
+
onChangeText = { password.value = it },
|
|
112
|
+
floatingValue = "Mật khẩu",
|
|
113
|
+
password = true,
|
|
114
|
+
keyboardType = KeyboardType.Password
|
|
115
|
+
)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
#### Disabled Input
|
|
119
|
+
|
|
120
|
+
```kotlin
|
|
121
|
+
Input(
|
|
122
|
+
text = remember { mutableStateOf("Giá trị cố định") },
|
|
123
|
+
onChangeText = { },
|
|
124
|
+
floatingValue = "Trường chỉ đọc",
|
|
125
|
+
disabled = true
|
|
126
|
+
)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## InputSearch Component
|
|
132
|
+
|
|
133
|
+
**File:** `vn/momo/kits/components/InputSearch.kt`
|
|
134
|
+
|
|
135
|
+
### Parameters
|
|
136
|
+
|
|
137
|
+
```kotlin
|
|
138
|
+
@Composable
|
|
139
|
+
fun InputSearch(
|
|
140
|
+
text: MutableState<String>,
|
|
141
|
+
onChangeText: (String) -> Unit,
|
|
142
|
+
modifier: Modifier = Modifier,
|
|
143
|
+
placeholder: String = "Tìm kiếm...",
|
|
144
|
+
onClear: () -> Unit = {},
|
|
145
|
+
enabled: Boolean = true,
|
|
146
|
+
leftIcon: String = "search", // Search icon
|
|
147
|
+
rightIcon: String = "close" // Clear icon
|
|
148
|
+
)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Usage Example
|
|
152
|
+
|
|
153
|
+
```kotlin
|
|
154
|
+
val searchQuery = remember { mutableStateOf("") }
|
|
155
|
+
|
|
156
|
+
InputSearch(
|
|
157
|
+
text = searchQuery,
|
|
158
|
+
onChangeText = { searchQuery.value = it },
|
|
159
|
+
placeholder = "Tìm kiếm sản phẩm...",
|
|
160
|
+
onClear = { searchQuery.value = "" }
|
|
161
|
+
)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## InputTextArea Component
|
|
167
|
+
|
|
168
|
+
**File:** `vn/momo/kits/components/InputTextArea.kt`
|
|
169
|
+
|
|
170
|
+
### Parameters
|
|
171
|
+
|
|
172
|
+
```kotlin
|
|
173
|
+
@Composable
|
|
174
|
+
fun InputTextArea(
|
|
175
|
+
text: MutableState<String>,
|
|
176
|
+
onChangeText: (String) -> Unit,
|
|
177
|
+
modifier: Modifier = Modifier,
|
|
178
|
+
floatingValue: String = "", // Floating label
|
|
179
|
+
placeholder: String = "", // Placeholder
|
|
180
|
+
error: String = "", // Error message
|
|
181
|
+
minLine: Int = 3, // Minimum lines
|
|
182
|
+
maxLine: Int = 5, // Maximum lines
|
|
183
|
+
maxLength: Int = Int.MAX_VALUE,
|
|
184
|
+
wordCount: Boolean = false, // Show word count
|
|
185
|
+
disabled: Boolean = false
|
|
186
|
+
)
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Usage Example
|
|
190
|
+
|
|
191
|
+
```kotlin
|
|
192
|
+
val comment = remember { mutableStateOf("") }
|
|
193
|
+
|
|
194
|
+
InputTextArea(
|
|
195
|
+
text = comment,
|
|
196
|
+
onChangeText = { comment.value = it },
|
|
197
|
+
floatingValue = "Bình luận",
|
|
198
|
+
placeholder = "Nhập bình luận của bạn...",
|
|
199
|
+
minLine = 3,
|
|
200
|
+
maxLine = 5,
|
|
201
|
+
wordCount = true
|
|
202
|
+
)
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## InputOTP Component
|
|
208
|
+
|
|
209
|
+
**File:** `vn/momo/kits/components/InputOTP.kt`
|
|
210
|
+
|
|
211
|
+
### Parameters
|
|
212
|
+
|
|
213
|
+
```kotlin
|
|
214
|
+
@Composable
|
|
215
|
+
fun InputOTP(
|
|
216
|
+
length: Int = 6, // Number of OTP digits
|
|
217
|
+
onComplete: (String) -> Unit, // Called when all digits entered
|
|
218
|
+
modifier: Modifier = Modifier
|
|
219
|
+
)
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Usage Example
|
|
223
|
+
|
|
224
|
+
```kotlin
|
|
225
|
+
val otp = remember { mutableStateOf("") }
|
|
226
|
+
|
|
227
|
+
InputOTP(
|
|
228
|
+
length = 6,
|
|
229
|
+
onComplete = { otpCode ->
|
|
230
|
+
// Verify OTP
|
|
231
|
+
verifyOTP(otpCode)
|
|
232
|
+
}
|
|
233
|
+
)
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## InputMoney Component
|
|
239
|
+
|
|
240
|
+
**File:** `vn/momo/kits/components/InputMoney.kt`
|
|
241
|
+
|
|
242
|
+
### Parameters
|
|
243
|
+
|
|
244
|
+
```kotlin
|
|
245
|
+
@Composable
|
|
246
|
+
fun InputMoney(
|
|
247
|
+
text: MutableState<String>,
|
|
248
|
+
onChangeText: (String) -> Unit,
|
|
249
|
+
modifier: Modifier = Modifier,
|
|
250
|
+
currency: String = "VND", // Currency code
|
|
251
|
+
placeholder: String = "0"
|
|
252
|
+
)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Usage Example
|
|
256
|
+
|
|
257
|
+
```kotlin
|
|
258
|
+
val amount = remember { mutableStateOf("") }
|
|
259
|
+
|
|
260
|
+
InputMoney(
|
|
261
|
+
text = amount,
|
|
262
|
+
onChangeText = { amount.value = it },
|
|
263
|
+
currency = "VND",
|
|
264
|
+
placeholder = "0"
|
|
265
|
+
)
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## InputDropDown Component
|
|
271
|
+
|
|
272
|
+
**File:** `vn/momo/kits/components/InputDropDown.kt`
|
|
273
|
+
|
|
274
|
+
### Parameters
|
|
275
|
+
|
|
276
|
+
```kotlin
|
|
277
|
+
@Composable
|
|
278
|
+
fun InputDropDown(
|
|
279
|
+
text: MutableState<String>,
|
|
280
|
+
onChangeText: (String) -> Unit,
|
|
281
|
+
options: List<DropDownOption>, // List of options
|
|
282
|
+
modifier: Modifier = Modifier,
|
|
283
|
+
floatingValue: String = "", // Label
|
|
284
|
+
placeholder: String = "Chọn...",
|
|
285
|
+
error: String = "",
|
|
286
|
+
enabled: Boolean = true
|
|
287
|
+
)
|
|
288
|
+
|
|
289
|
+
data class DropDownOption(
|
|
290
|
+
val label: String, // Display text
|
|
291
|
+
val value: String // Selected value
|
|
292
|
+
)
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Usage Example
|
|
296
|
+
|
|
297
|
+
```kotlin
|
|
298
|
+
val selectedOption = remember { mutableStateOf("") }
|
|
299
|
+
|
|
300
|
+
val cities = listOf(
|
|
301
|
+
DropDownOption("Hà Nội", "hanoi"),
|
|
302
|
+
DropDownOption("TP. Hồ Chí Minh", "hcm"),
|
|
303
|
+
DropDownOption("Đà Nẵng", "danang")
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
InputDropDown(
|
|
307
|
+
text = selectedOption,
|
|
308
|
+
onChangeText = { selectedOption.value = it },
|
|
309
|
+
options = cities,
|
|
310
|
+
floatingValue = "Thành phố",
|
|
311
|
+
placeholder = "Chọn thành phố"
|
|
312
|
+
)
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## InputPhoneNumber Component
|
|
318
|
+
|
|
319
|
+
**File:** `vn/momo/kits/components/InputPhoneNumber.kt`
|
|
320
|
+
|
|
321
|
+
### Parameters
|
|
322
|
+
|
|
323
|
+
```kotlin
|
|
324
|
+
@Composable
|
|
325
|
+
fun InputPhoneNumber(
|
|
326
|
+
text: MutableState<String>,
|
|
327
|
+
onChangeText: (String) -> Unit,
|
|
328
|
+
modifier: Modifier = Modifier,
|
|
329
|
+
floatingValue: String = "",
|
|
330
|
+
placeholder: String = "",
|
|
331
|
+
error: String = "",
|
|
332
|
+
enabled: Boolean = true,
|
|
333
|
+
countryCode: String = "+84" // Default country code
|
|
334
|
+
)
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### Usage Example
|
|
338
|
+
|
|
339
|
+
```kotlin
|
|
340
|
+
val phone = remember { mutableStateOf("") }
|
|
341
|
+
|
|
342
|
+
InputPhoneNumber(
|
|
343
|
+
text = phone,
|
|
344
|
+
onChangeText = { phone.value = it },
|
|
345
|
+
floatingValue = "Số điện thoại",
|
|
346
|
+
placeholder = "Nhập số điện thoại",
|
|
347
|
+
countryCode = "+84"
|
|
348
|
+
)
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## Common Patterns
|
|
354
|
+
|
|
355
|
+
### Form with Multiple Inputs
|
|
356
|
+
|
|
357
|
+
```kotlin
|
|
358
|
+
@Composable
|
|
359
|
+
fun LoginForm() {
|
|
360
|
+
val phone = remember { mutableStateOf("") }
|
|
361
|
+
val password = remember { mutableStateOf("") }
|
|
362
|
+
|
|
363
|
+
Column(verticalArrangement = Arrangement.spacedBy(16.dp)) {
|
|
364
|
+
InputPhoneNumber(
|
|
365
|
+
text = phone,
|
|
366
|
+
onChangeText = { phone.value = it },
|
|
367
|
+
floatingValue = "Số điện thoại"
|
|
368
|
+
)
|
|
369
|
+
|
|
370
|
+
Input(
|
|
371
|
+
text = password,
|
|
372
|
+
onChangeText = { password.value = it },
|
|
373
|
+
floatingValue = "Mật khẩu",
|
|
374
|
+
password = true
|
|
375
|
+
)
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
### Search with Debounce
|
|
381
|
+
|
|
382
|
+
```kotlin
|
|
383
|
+
@Composable
|
|
384
|
+
fun SearchScreen() {
|
|
385
|
+
val searchQuery = remember { mutableStateOf("") }
|
|
386
|
+
|
|
387
|
+
LaunchedEffect(searchQuery.value) {
|
|
388
|
+
delay(300) // Debounce
|
|
389
|
+
// Perform search
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
InputSearch(
|
|
393
|
+
text = searchQuery,
|
|
394
|
+
onChangeText = { searchQuery.value = it },
|
|
395
|
+
placeholder = "Tìm kiếm..."
|
|
396
|
+
)
|
|
397
|
+
}
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
## Best Practices
|
|
401
|
+
|
|
402
|
+
1. **Use floating labels** - Better for mobile UX
|
|
403
|
+
2. **Show error states** - Help users correct input
|
|
404
|
+
3. **Set appropriate keyboard types** - Phone, email, password
|
|
405
|
+
4. **Use InputSearch for search** - Includes clear button
|
|
406
|
+
5. **Use InputMoney for amounts** - Handles currency formatting
|
|
407
|
+
6. **Use InputOTP for verification** - Optimized for code entry
|
|
408
|
+
7. **Limit maxLength** - Prevent overflow issues
|