@momo-kits/native-kits 0.117.1-alpha.2 → 0.117.1-beta.10
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/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +23 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +208 -0
- package/local.properties +2 -2
- package/package.json +1 -1
- package/compose/src/androidMain/res/font/momosignature.otf +0 -0
- package/compose/src/androidMain/res/font/sfprotext_black.otf +0 -0
- package/compose/src/androidMain/res/font/sfprotext_bold.ttf +0 -0
- package/compose/src/androidMain/res/font/sfprotext_heavy.ttf +0 -0
- package/compose/src/androidMain/res/font/sfprotext_light.ttf +0 -0
- package/compose/src/androidMain/res/font/sfprotext_medium.ttf +0 -0
- package/compose/src/androidMain/res/font/sfprotext_regular.ttf +0 -0
- package/compose/src/androidMain/res/font/sfprotext_semibold.ttf +0 -0
- package/compose/src/androidMain/res/font/sfprotext_thin.otf +0 -0
- package/compose/src/androidMain/res/font/sfprotext_ultralight.otf +0 -0
|
@@ -8,6 +8,7 @@ import androidx.compose.animation.core.rememberInfiniteTransition
|
|
|
8
8
|
import androidx.compose.animation.core.tween
|
|
9
9
|
import androidx.compose.foundation.background
|
|
10
10
|
import androidx.compose.foundation.border
|
|
11
|
+
import androidx.compose.foundation.clickable
|
|
11
12
|
import androidx.compose.foundation.layout.Arrangement
|
|
12
13
|
import androidx.compose.foundation.layout.Box
|
|
13
14
|
import androidx.compose.foundation.layout.Column
|
|
@@ -35,6 +36,7 @@ import androidx.compose.ui.text.input.KeyboardType
|
|
|
35
36
|
import androidx.compose.ui.unit.dp
|
|
36
37
|
import androidx.compose.ui.zIndex
|
|
37
38
|
import vn.momo.kits.const.AppTheme
|
|
39
|
+
import vn.momo.kits.const.Colors
|
|
38
40
|
import vn.momo.kits.const.Radius
|
|
39
41
|
import vn.momo.kits.const.Spacing
|
|
40
42
|
import vn.momo.kits.const.Typography
|
|
@@ -87,7 +89,7 @@ fun InputOTP(
|
|
|
87
89
|
dataType: String = "number",
|
|
88
90
|
modifier: Modifier = Modifier
|
|
89
91
|
) {
|
|
90
|
-
val maxLength = 10
|
|
92
|
+
val maxLength = length ?: 10
|
|
91
93
|
var isFocused by remember { mutableStateOf(false) }
|
|
92
94
|
var isBlurred = false
|
|
93
95
|
|
|
@@ -100,6 +102,10 @@ fun InputOTP(
|
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
104
|
|
|
105
|
+
fun onClearText(){
|
|
106
|
+
handleChangeText("")
|
|
107
|
+
}
|
|
108
|
+
|
|
103
109
|
|
|
104
110
|
Column {
|
|
105
111
|
BasicTextField(
|
|
@@ -193,6 +199,22 @@ fun InputOTP(
|
|
|
193
199
|
}
|
|
194
200
|
}
|
|
195
201
|
}
|
|
202
|
+
Box(
|
|
203
|
+
modifier = Modifier.align(Alignment.Center).zIndex(10f)
|
|
204
|
+
) {
|
|
205
|
+
Row(
|
|
206
|
+
horizontalArrangement = Arrangement.End,
|
|
207
|
+
modifier = Modifier.fillMaxWidth()
|
|
208
|
+
) {
|
|
209
|
+
Icon(
|
|
210
|
+
"24_navigation_close_circle_full",
|
|
211
|
+
size = 12.dp,
|
|
212
|
+
modifier = Modifier.padding(end = 12.dp).clickable {
|
|
213
|
+
onClearText()
|
|
214
|
+
}
|
|
215
|
+
)
|
|
216
|
+
}
|
|
217
|
+
}
|
|
196
218
|
}
|
|
197
219
|
}
|
|
198
220
|
)
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
package vn.momo.kits.components
|
|
2
|
+
|
|
3
|
+
import androidx.compose.foundation.background
|
|
4
|
+
import androidx.compose.foundation.clickable
|
|
5
|
+
import androidx.compose.foundation.layout.Arrangement
|
|
6
|
+
import androidx.compose.foundation.layout.Box
|
|
7
|
+
import androidx.compose.foundation.layout.Column
|
|
8
|
+
import androidx.compose.foundation.layout.IntrinsicSize
|
|
9
|
+
import androidx.compose.foundation.layout.Row
|
|
10
|
+
import androidx.compose.foundation.layout.Spacer
|
|
11
|
+
import androidx.compose.foundation.layout.fillMaxHeight
|
|
12
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
13
|
+
import androidx.compose.foundation.layout.height
|
|
14
|
+
import androidx.compose.foundation.layout.padding
|
|
15
|
+
import androidx.compose.foundation.layout.size
|
|
16
|
+
import androidx.compose.foundation.layout.width
|
|
17
|
+
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
18
|
+
import androidx.compose.runtime.Composable
|
|
19
|
+
import androidx.compose.ui.Alignment
|
|
20
|
+
import androidx.compose.ui.Modifier
|
|
21
|
+
import androidx.compose.ui.graphics.Color
|
|
22
|
+
import androidx.compose.ui.text.TextStyle
|
|
23
|
+
import androidx.compose.ui.text.font.FontWeight
|
|
24
|
+
import androidx.compose.ui.unit.dp
|
|
25
|
+
import androidx.compose.ui.unit.sp
|
|
26
|
+
import vn.momo.kits.const.AppTheme
|
|
27
|
+
import vn.momo.kits.const.Colors
|
|
28
|
+
import vn.momo.kits.const.Spacing
|
|
29
|
+
import vn.momo.kits.const.Typography
|
|
30
|
+
|
|
31
|
+
enum class TitleType { Card, Section }
|
|
32
|
+
enum class TitleSize { Small, Medium, Large }
|
|
33
|
+
enum class IconAlign { Top, Center, Bottom }
|
|
34
|
+
enum class ButtonSize { Small, Large }
|
|
35
|
+
|
|
36
|
+
@Composable
|
|
37
|
+
fun Title(
|
|
38
|
+
title: String,
|
|
39
|
+
type: TitleType = TitleType.Section,
|
|
40
|
+
size: TitleSize = TitleSize.Medium,
|
|
41
|
+
icon: String? = null,
|
|
42
|
+
iconColor: Color? = null,
|
|
43
|
+
iconAlign: IconAlign = IconAlign.Top,
|
|
44
|
+
showRightAction: Boolean = false,
|
|
45
|
+
showTrailingAction: Boolean = false,
|
|
46
|
+
badgeLabel: String? = null,
|
|
47
|
+
buttonTitle: String? = null,
|
|
48
|
+
buttonSize: ButtonSize = ButtonSize.Small,
|
|
49
|
+
onPressRightAction: () -> Unit = {},
|
|
50
|
+
onPressTrailingAction: () -> Unit = {},
|
|
51
|
+
textOnly: Boolean = false,
|
|
52
|
+
description: String? = null,
|
|
53
|
+
modifier: Modifier = Modifier
|
|
54
|
+
) {
|
|
55
|
+
val theme = AppTheme.current
|
|
56
|
+
val textStyle: TextStyle = when (type) {
|
|
57
|
+
TitleType.Card -> when (size) {
|
|
58
|
+
TitleSize.Small -> TextStyle(fontSize = 14.sp, lineHeight = 20.sp)
|
|
59
|
+
TitleSize.Medium -> TextStyle(fontSize = 16.sp, lineHeight = 22.sp)
|
|
60
|
+
TitleSize.Large -> TextStyle(fontSize = 18.sp, lineHeight = 26.sp)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
TitleType.Section -> when (size) {
|
|
64
|
+
TitleSize.Small -> TextStyle(
|
|
65
|
+
fontSize = 16.sp,
|
|
66
|
+
lineHeight = 24.sp,
|
|
67
|
+
fontWeight = FontWeight.Bold
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
TitleSize.Medium -> TextStyle(
|
|
71
|
+
fontSize = 18.sp,
|
|
72
|
+
lineHeight = 26.sp,
|
|
73
|
+
fontWeight = FontWeight.Bold
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
TitleSize.Large -> TextStyle(
|
|
77
|
+
fontSize = 20.sp,
|
|
78
|
+
lineHeight = 28.sp,
|
|
79
|
+
fontWeight = FontWeight.Bold
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (textOnly) {
|
|
85
|
+
Text(
|
|
86
|
+
text = title,
|
|
87
|
+
style = textStyle,
|
|
88
|
+
modifier = modifier
|
|
89
|
+
)
|
|
90
|
+
return
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
Row(
|
|
94
|
+
modifier = modifier
|
|
95
|
+
.fillMaxWidth()
|
|
96
|
+
.height(IntrinsicSize.Min)
|
|
97
|
+
.padding(8.dp),
|
|
98
|
+
verticalAlignment = Alignment.CenterVertically
|
|
99
|
+
) {
|
|
100
|
+
icon?.let {
|
|
101
|
+
Column(
|
|
102
|
+
modifier = Modifier.fillMaxHeight().padding(end = Spacing.S),
|
|
103
|
+
verticalArrangement = when (iconAlign) {
|
|
104
|
+
IconAlign.Top -> Arrangement.Top
|
|
105
|
+
IconAlign.Center -> Arrangement.Center
|
|
106
|
+
IconAlign.Bottom -> Arrangement.Bottom
|
|
107
|
+
},
|
|
108
|
+
) {
|
|
109
|
+
// Icon
|
|
110
|
+
Icon(
|
|
111
|
+
source = it,
|
|
112
|
+
color = iconColor ?: theme.colors.text.default,
|
|
113
|
+
modifier = Modifier.size(24.dp)
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
Column(
|
|
119
|
+
modifier = Modifier.weight(1f)
|
|
120
|
+
) {
|
|
121
|
+
Row(
|
|
122
|
+
verticalAlignment = Alignment.CenterVertically
|
|
123
|
+
) {
|
|
124
|
+
Row(
|
|
125
|
+
verticalAlignment = Alignment.CenterVertically,
|
|
126
|
+
modifier = if (showTrailingAction) Modifier else Modifier.weight(1f),
|
|
127
|
+
) {
|
|
128
|
+
Text(
|
|
129
|
+
text = title,
|
|
130
|
+
style = textStyle,
|
|
131
|
+
maxLines = if (showTrailingAction || badgeLabel != null) 1 else 2,
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
// Badge
|
|
135
|
+
badgeLabel?.let {
|
|
136
|
+
Spacer(modifier = Modifier.width(4.dp))
|
|
137
|
+
Badge(
|
|
138
|
+
label = it
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Trailing action (icon)
|
|
145
|
+
if (showTrailingAction && !showRightAction) {
|
|
146
|
+
Spacer(modifier = Modifier.width(8.dp))
|
|
147
|
+
Box(
|
|
148
|
+
modifier = Modifier
|
|
149
|
+
.size(24.dp)
|
|
150
|
+
.background(
|
|
151
|
+
color = if (type == TitleType.Section) Colors.black_06.copy(0.6f) else Colors.black_06.copy(
|
|
152
|
+
0.3f
|
|
153
|
+
),
|
|
154
|
+
shape = RoundedCornerShape(12.dp)
|
|
155
|
+
)
|
|
156
|
+
.clickable { onPressTrailingAction() },
|
|
157
|
+
contentAlignment = Alignment.Center
|
|
158
|
+
) {
|
|
159
|
+
Icon(
|
|
160
|
+
source = "arrow_chevron_right_small",
|
|
161
|
+
size = 18.dp
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Description
|
|
168
|
+
description?.let {
|
|
169
|
+
Spacer(modifier = Modifier.height(4.dp))
|
|
170
|
+
Text(
|
|
171
|
+
text = it,
|
|
172
|
+
style = Typography.descriptionDefaultRegular,
|
|
173
|
+
color = theme.colors.text.secondary
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Right action (button or icon)
|
|
179
|
+
if (showRightAction && !showTrailingAction) {
|
|
180
|
+
Spacer(modifier = Modifier.width(8.dp))
|
|
181
|
+
if (buttonTitle != null) {
|
|
182
|
+
Text(
|
|
183
|
+
text = buttonTitle,
|
|
184
|
+
style = if (buttonSize === ButtonSize.Small) Typography.actionXsBold else Typography.actionSBold,
|
|
185
|
+
color = theme.colors.primary,
|
|
186
|
+
modifier = Modifier.clickable { onPressRightAction() }
|
|
187
|
+
)
|
|
188
|
+
} else {
|
|
189
|
+
Box(
|
|
190
|
+
modifier = Modifier
|
|
191
|
+
.size(24.dp)
|
|
192
|
+
.background(
|
|
193
|
+
color = Colors.pink_03.copy(alpha = 0.1f),
|
|
194
|
+
shape = RoundedCornerShape(12.dp)
|
|
195
|
+
)
|
|
196
|
+
.clickable { onPressRightAction() },
|
|
197
|
+
contentAlignment = Alignment.Center
|
|
198
|
+
) {
|
|
199
|
+
Icon(
|
|
200
|
+
source = "arrow_chevron_right_small",
|
|
201
|
+
modifier = Modifier.size(22.dp),
|
|
202
|
+
color = theme.colors.primary
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
package/local.properties
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
# Location of the SDK. This is only used by Gradle.
|
|
5
5
|
# For customization when using a Version Control System, please read the
|
|
6
6
|
# header note.
|
|
7
|
-
#
|
|
8
|
-
sdk.dir=/Users/
|
|
7
|
+
#Tue Apr 08 11:13:31 ICT 2025
|
|
8
|
+
sdk.dir=/Users/sonnguyen/Library/Android/sdk
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|