@momo-kits/native-kits 0.114.2-beta.6 → 0.114.2-pu.1
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/Input.kt +22 -10
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +3 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +5 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +3 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +6 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +6 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +1 -1
- package/ios/Popup/PopupDisplay.swift +2 -2
- package/local.properties +2 -2
- package/package.json +1 -1
|
@@ -20,7 +20,6 @@ import androidx.compose.foundation.text.BasicTextField
|
|
|
20
20
|
import androidx.compose.foundation.text.KeyboardOptions
|
|
21
21
|
import androidx.compose.material3.CircularProgressIndicator
|
|
22
22
|
import androidx.compose.runtime.Composable
|
|
23
|
-
import androidx.compose.runtime.MutableState
|
|
24
23
|
import androidx.compose.runtime.getValue
|
|
25
24
|
import androidx.compose.runtime.mutableStateOf
|
|
26
25
|
import androidx.compose.runtime.remember
|
|
@@ -29,13 +28,11 @@ import androidx.compose.ui.Alignment
|
|
|
29
28
|
import androidx.compose.ui.Modifier
|
|
30
29
|
import androidx.compose.ui.focus.onFocusChanged
|
|
31
30
|
import androidx.compose.ui.graphics.Color
|
|
32
|
-
import androidx.compose.ui.semantics.contentDescription
|
|
33
|
-
import androidx.compose.ui.semantics.semantics
|
|
34
|
-
import androidx.compose.ui.semantics.testTag
|
|
35
31
|
import androidx.compose.ui.text.TextStyle
|
|
36
32
|
import androidx.compose.ui.text.font.FontWeight
|
|
37
33
|
import androidx.compose.ui.text.input.KeyboardType
|
|
38
34
|
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
|
35
|
+
import androidx.compose.ui.text.input.TextFieldValue
|
|
39
36
|
import androidx.compose.ui.text.input.VisualTransformation
|
|
40
37
|
import androidx.compose.ui.unit.Dp
|
|
41
38
|
import androidx.compose.ui.unit.dp
|
|
@@ -154,7 +151,7 @@ fun ErrorView(errorMessage: String, errorSpacing: Boolean, hintText: String) {
|
|
|
154
151
|
|
|
155
152
|
@Composable
|
|
156
153
|
fun Input(
|
|
157
|
-
text:
|
|
154
|
+
text: String = "",
|
|
158
155
|
floatingValue: String = "",
|
|
159
156
|
floatingValueColor: Color = AppTheme.current.colors.text.hint,
|
|
160
157
|
floatingIcon: String = "",
|
|
@@ -181,6 +178,10 @@ fun Input(
|
|
|
181
178
|
keyboardType: KeyboardType = KeyboardType.Text,
|
|
182
179
|
modifier: Modifier = Modifier,
|
|
183
180
|
) {
|
|
181
|
+
var textFieldValueState by remember { mutableStateOf(TextFieldValue(text = text)) }
|
|
182
|
+
val textFieldValue = textFieldValueState.copy(text = text)
|
|
183
|
+
var lastTextValue by remember(text) { mutableStateOf(text) }
|
|
184
|
+
|
|
184
185
|
var isFocused by remember { mutableStateOf(false) }
|
|
185
186
|
var passHidden by remember { mutableStateOf(false) }
|
|
186
187
|
var isBlurred = false
|
|
@@ -209,10 +210,10 @@ fun Input(
|
|
|
209
210
|
modifier = modifier.setAutomationId(testId)
|
|
210
211
|
) {
|
|
211
212
|
BasicTextField(
|
|
213
|
+
value = text,
|
|
212
214
|
enabled = !disabled,
|
|
213
215
|
readOnly = readOnly,
|
|
214
216
|
singleLine = true,
|
|
215
|
-
value = text.value,
|
|
216
217
|
textStyle = TextStyle(
|
|
217
218
|
color = textColor,
|
|
218
219
|
fontSize = 16.sp,
|
|
@@ -229,7 +230,15 @@ fun Input(
|
|
|
229
230
|
if (!it.isFocused && isBlurred) onBlur()
|
|
230
231
|
if (it.isFocused && !isBlurred) isBlurred = true
|
|
231
232
|
},
|
|
232
|
-
onValueChange =
|
|
233
|
+
onValueChange = { newValue ->
|
|
234
|
+
textFieldValueState.copy(text = newValue)
|
|
235
|
+
val stringChangedSinceLastInvocation = lastTextValue != newValue
|
|
236
|
+
lastTextValue = newValue
|
|
237
|
+
|
|
238
|
+
if (stringChangedSinceLastInvocation) {
|
|
239
|
+
onChangeText(newValue)
|
|
240
|
+
}
|
|
241
|
+
},
|
|
233
242
|
decorationBox = { innerTextField ->
|
|
234
243
|
// Floating Icon
|
|
235
244
|
if (floatingValue.isNotEmpty() || floatingIcon.isNotEmpty()) {
|
|
@@ -291,7 +300,7 @@ fun Input(
|
|
|
291
300
|
)
|
|
292
301
|
}
|
|
293
302
|
Box(Modifier.weight(1f)) {
|
|
294
|
-
if (text.
|
|
303
|
+
if (textFieldValue.text.isEmpty()) {
|
|
295
304
|
Text(
|
|
296
305
|
text = placeholder,
|
|
297
306
|
style = TextStyle(
|
|
@@ -304,7 +313,7 @@ fun Input(
|
|
|
304
313
|
}
|
|
305
314
|
innerTextField()
|
|
306
315
|
}
|
|
307
|
-
if (isFocused && text.
|
|
316
|
+
if (isFocused && textFieldValue.text.isNotEmpty()) {
|
|
308
317
|
Row {
|
|
309
318
|
Spacer(Modifier.width(Spacing.XS))
|
|
310
319
|
Icon(
|
|
@@ -312,7 +321,10 @@ fun Input(
|
|
|
312
321
|
size = 16.dp,
|
|
313
322
|
color = AppTheme.current.colors.text.hint,
|
|
314
323
|
modifier = Modifier.clickable(
|
|
315
|
-
onClick = {
|
|
324
|
+
onClick = {
|
|
325
|
+
onChangeText("")
|
|
326
|
+
textFieldValueState = TextFieldValue(text = "")
|
|
327
|
+
},
|
|
316
328
|
interactionSource = remember { MutableInteractionSource() },
|
|
317
329
|
indication = null
|
|
318
330
|
)
|
|
@@ -13,7 +13,6 @@ import androidx.compose.foundation.layout.padding
|
|
|
13
13
|
import androidx.compose.foundation.layout.wrapContentSize
|
|
14
14
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
15
15
|
import androidx.compose.runtime.Composable
|
|
16
|
-
import androidx.compose.runtime.MutableState
|
|
17
16
|
import androidx.compose.runtime.getValue
|
|
18
17
|
import androidx.compose.runtime.mutableStateOf
|
|
19
18
|
import androidx.compose.runtime.remember
|
|
@@ -33,7 +32,7 @@ import vn.momo.kits.const.Typography
|
|
|
33
32
|
|
|
34
33
|
@Composable
|
|
35
34
|
fun InputDropDown(
|
|
36
|
-
|
|
35
|
+
text: String = "",
|
|
37
36
|
floatingValue: String = "",
|
|
38
37
|
floatingValueColor: Color = AppTheme.current.colors.text.hint,
|
|
39
38
|
floatingIcon: String = "",
|
|
@@ -140,12 +139,12 @@ fun InputDropDown(
|
|
|
140
139
|
}
|
|
141
140
|
Box(Modifier.weight(1f)) {
|
|
142
141
|
Text(
|
|
143
|
-
text =
|
|
142
|
+
text = text.ifEmpty { placeholder },
|
|
144
143
|
style = TextStyle(
|
|
145
144
|
fontSize = 16.sp,
|
|
146
145
|
lineHeight = 24.sp
|
|
147
146
|
),
|
|
148
|
-
color = if (
|
|
147
|
+
color = if (text.isEmpty()) placeholderColor else textColor
|
|
149
148
|
)
|
|
150
149
|
}
|
|
151
150
|
RenderRightIcon(
|
|
@@ -18,7 +18,6 @@ import androidx.compose.foundation.shape.RoundedCornerShape
|
|
|
18
18
|
import androidx.compose.foundation.text.BasicTextField
|
|
19
19
|
import androidx.compose.foundation.text.KeyboardOptions
|
|
20
20
|
import androidx.compose.runtime.Composable
|
|
21
|
-
import androidx.compose.runtime.MutableState
|
|
22
21
|
import androidx.compose.runtime.getValue
|
|
23
22
|
import androidx.compose.runtime.mutableStateOf
|
|
24
23
|
import androidx.compose.runtime.remember
|
|
@@ -63,7 +62,7 @@ class CustomConverter : VisualTransformation {
|
|
|
63
62
|
|
|
64
63
|
@Composable
|
|
65
64
|
fun InputMoney(
|
|
66
|
-
text:
|
|
65
|
+
text: String = "0",
|
|
67
66
|
floatingValue: String = "",
|
|
68
67
|
floatingValueColor: Color = AppTheme.current.colors.text.hint,
|
|
69
68
|
floatingIcon: String = "",
|
|
@@ -115,7 +114,7 @@ fun InputMoney(
|
|
|
115
114
|
BasicTextField(
|
|
116
115
|
enabled = !disabled,
|
|
117
116
|
singleLine = true,
|
|
118
|
-
value = text
|
|
117
|
+
value = text,
|
|
119
118
|
textStyle = TextStyle(
|
|
120
119
|
color = textColor,
|
|
121
120
|
fontSize = 20.sp,
|
|
@@ -195,7 +194,7 @@ fun InputMoney(
|
|
|
195
194
|
)
|
|
196
195
|
}
|
|
197
196
|
Box(Modifier.weight(9f).padding(start = 0.dp)) {
|
|
198
|
-
if (text.
|
|
197
|
+
if (text.isEmpty()) {
|
|
199
198
|
Text(
|
|
200
199
|
text = placeholder,
|
|
201
200
|
style = TextStyle(
|
|
@@ -209,7 +208,7 @@ fun InputMoney(
|
|
|
209
208
|
innerTextField()
|
|
210
209
|
}
|
|
211
210
|
}
|
|
212
|
-
if (isFocused && text.
|
|
211
|
+
if (isFocused && text.isNotEmpty()) {
|
|
213
212
|
Row {
|
|
214
213
|
Spacer(Modifier.width(Spacing.XS))
|
|
215
214
|
Icon(
|
|
@@ -217,7 +216,7 @@ fun InputMoney(
|
|
|
217
216
|
size = 16.dp,
|
|
218
217
|
color = AppTheme.current.colors.text.hint,
|
|
219
218
|
modifier = Modifier.clickable(
|
|
220
|
-
onClick = {
|
|
219
|
+
onClick = { onChangeText("") },
|
|
221
220
|
interactionSource = remember { MutableInteractionSource() },
|
|
222
221
|
indication = null
|
|
223
222
|
)
|
|
@@ -87,12 +87,12 @@ fun InputOTP(
|
|
|
87
87
|
dataType: String = "number",
|
|
88
88
|
modifier: Modifier = Modifier
|
|
89
89
|
) {
|
|
90
|
-
val
|
|
90
|
+
val MAX_LENGTH = 10
|
|
91
91
|
var isFocused by remember { mutableStateOf(false) }
|
|
92
92
|
var isBlurred = false
|
|
93
93
|
|
|
94
94
|
val handleChangeText: (String) -> Unit = { text ->
|
|
95
|
-
if (text.length <=
|
|
95
|
+
if (text.length <= MAX_LENGTH &&
|
|
96
96
|
(dataType != "number" || !text.any { !it.isDigit() }) &&
|
|
97
97
|
(text.length < value.length || value.length < text.length)
|
|
98
98
|
) {
|
|
@@ -115,7 +115,7 @@ fun InputOTP(
|
|
|
115
115
|
if (!it.isFocused && isBlurred) onBlur()
|
|
116
116
|
if (it.isFocused && !isBlurred) isBlurred = true
|
|
117
117
|
},
|
|
118
|
-
decorationBox = {
|
|
118
|
+
decorationBox = { innerTextField ->
|
|
119
119
|
Box {
|
|
120
120
|
if (floatingValue.isNotEmpty()) {
|
|
121
121
|
Box(
|
|
@@ -19,7 +19,6 @@ import androidx.compose.foundation.text.KeyboardActions
|
|
|
19
19
|
import androidx.compose.foundation.text.KeyboardOptions
|
|
20
20
|
import androidx.compose.material3.CircularProgressIndicator
|
|
21
21
|
import androidx.compose.runtime.Composable
|
|
22
|
-
import androidx.compose.runtime.MutableState
|
|
23
22
|
import androidx.compose.runtime.getValue
|
|
24
23
|
import androidx.compose.runtime.mutableStateOf
|
|
25
24
|
import androidx.compose.runtime.remember
|
|
@@ -78,7 +77,7 @@ fun RenderRightIconSearch(
|
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
data class InputSearchProps(
|
|
81
|
-
val text:
|
|
80
|
+
val text: String = "",
|
|
82
81
|
val buttonText: String = "",
|
|
83
82
|
val showButtonText: Boolean = false,
|
|
84
83
|
val placeholder: String = "",
|
|
@@ -106,7 +105,7 @@ data class InputSearchProps(
|
|
|
106
105
|
@Composable
|
|
107
106
|
fun InputSearch(
|
|
108
107
|
inputSearchProps: InputSearchProps = InputSearchProps(
|
|
109
|
-
text =
|
|
108
|
+
text = "",
|
|
110
109
|
iconColor = AppTheme.current.colors.text.default
|
|
111
110
|
),
|
|
112
111
|
) {
|
|
@@ -127,7 +126,7 @@ fun InputSearch(
|
|
|
127
126
|
BasicTextField(
|
|
128
127
|
enabled = !inputSearchProps.disabled,
|
|
129
128
|
singleLine = true,
|
|
130
|
-
value = inputSearchProps.text
|
|
129
|
+
value = inputSearchProps.text,
|
|
131
130
|
textStyle = TextStyle(
|
|
132
131
|
color = textColor,
|
|
133
132
|
fontSize = 14.sp,
|
|
@@ -175,7 +174,7 @@ fun InputSearch(
|
|
|
175
174
|
color = AppTheme.current.colors.text.hint
|
|
176
175
|
)
|
|
177
176
|
Box(Modifier.weight(1f)) {
|
|
178
|
-
if (inputSearchProps.text.
|
|
177
|
+
if (inputSearchProps.text.isEmpty()) {
|
|
179
178
|
Text(
|
|
180
179
|
text = inputSearchProps.placeholder,
|
|
181
180
|
style = TextStyle(
|
|
@@ -190,7 +189,7 @@ fun InputSearch(
|
|
|
190
189
|
}
|
|
191
190
|
innerTextField()
|
|
192
191
|
}
|
|
193
|
-
if (inputSearchProps.clearCondition?.invoke() == true || (isFocused && inputSearchProps.text.
|
|
192
|
+
if (inputSearchProps.clearCondition?.invoke() == true || (isFocused && inputSearchProps.text.isNotEmpty())) {
|
|
194
193
|
Row {
|
|
195
194
|
Spacer(Modifier.width(Spacing.XS))
|
|
196
195
|
Icon(
|
|
@@ -199,7 +198,7 @@ fun InputSearch(
|
|
|
199
198
|
color = AppTheme.current.colors.text.hint,
|
|
200
199
|
modifier = Modifier.clickable(
|
|
201
200
|
onClick = {
|
|
202
|
-
inputSearchProps.
|
|
201
|
+
inputSearchProps.onChangeText("")
|
|
203
202
|
inputSearchProps.onClearPress.invoke()
|
|
204
203
|
},
|
|
205
204
|
interactionSource = remember { MutableInteractionSource() },
|
|
@@ -18,7 +18,6 @@ import androidx.compose.foundation.shape.RoundedCornerShape
|
|
|
18
18
|
import androidx.compose.foundation.text.BasicTextField
|
|
19
19
|
import androidx.compose.foundation.text.KeyboardOptions
|
|
20
20
|
import androidx.compose.runtime.Composable
|
|
21
|
-
import androidx.compose.runtime.MutableState
|
|
22
21
|
import androidx.compose.runtime.getValue
|
|
23
22
|
import androidx.compose.runtime.mutableStateOf
|
|
24
23
|
import androidx.compose.runtime.remember
|
|
@@ -42,7 +41,7 @@ val DEFAULT_HEIGHT = 104.dp
|
|
|
42
41
|
|
|
43
42
|
@Composable
|
|
44
43
|
fun InputTextArea(
|
|
45
|
-
text:
|
|
44
|
+
text: String = "",
|
|
46
45
|
maxLength: Int = MAX_LENGTH,
|
|
47
46
|
height: Dp = DEFAULT_HEIGHT,
|
|
48
47
|
floatingValue: String = "",
|
|
@@ -92,7 +91,7 @@ fun InputTextArea(
|
|
|
92
91
|
BasicTextField(
|
|
93
92
|
enabled = !disabled,
|
|
94
93
|
singleLine = false,
|
|
95
|
-
value = text
|
|
94
|
+
value = text,
|
|
96
95
|
textStyle = TextStyle(
|
|
97
96
|
color = textColor,
|
|
98
97
|
fontSize = 16.sp,
|
|
@@ -173,7 +172,7 @@ fun InputTextArea(
|
|
|
173
172
|
verticalAlignment = Alignment.Top
|
|
174
173
|
) {
|
|
175
174
|
Box(Modifier.weight(1f)) {
|
|
176
|
-
if (text.
|
|
175
|
+
if (text.isEmpty()) {
|
|
177
176
|
Text(
|
|
178
177
|
text = placeholder,
|
|
179
178
|
style = TextStyle(
|
|
@@ -186,7 +185,7 @@ fun InputTextArea(
|
|
|
186
185
|
}
|
|
187
186
|
innerTextField()
|
|
188
187
|
}
|
|
189
|
-
if (isFocused && text.
|
|
188
|
+
if (isFocused && text.isNotEmpty()) {
|
|
190
189
|
Row {
|
|
191
190
|
Spacer(Modifier.width(Spacing.XS))
|
|
192
191
|
Icon(
|
|
@@ -194,7 +193,7 @@ fun InputTextArea(
|
|
|
194
193
|
size = 16.dp,
|
|
195
194
|
color = AppTheme.current.colors.text.hint,
|
|
196
195
|
modifier = Modifier.clickable(
|
|
197
|
-
onClick = {
|
|
196
|
+
onClick = { onChangeText("") },
|
|
198
197
|
interactionSource = remember { MutableInteractionSource() },
|
|
199
198
|
indication = null
|
|
200
199
|
)
|
|
@@ -212,7 +211,7 @@ fun InputTextArea(
|
|
|
212
211
|
contentAlignment = Alignment.CenterEnd
|
|
213
212
|
) {
|
|
214
213
|
Text(
|
|
215
|
-
"${text.
|
|
214
|
+
"${text.length}/$maxLength",
|
|
216
215
|
style = Typography.descriptionXsRegular,
|
|
217
216
|
color = AppTheme.current.colors.text.hint
|
|
218
217
|
)
|
|
@@ -147,7 +147,7 @@ fun PopupNotify(
|
|
|
147
147
|
Modifier
|
|
148
148
|
.width(22.dp)
|
|
149
149
|
.height(22.dp)
|
|
150
|
-
.offset(x = -(
|
|
150
|
+
.offset(x = -(1).dp, y = (-11).dp)
|
|
151
151
|
.background(
|
|
152
152
|
color = AppTheme.current.colors.text.default,
|
|
153
153
|
shape = RoundedCornerShape(Radius.M)
|
|
@@ -46,8 +46,8 @@ public struct PopupDisplay: View {
|
|
|
46
46
|
.overlay(RoundedRectangle(cornerRadius: Radius.L).stroke(Colors.black01, lineWidth: 1))
|
|
47
47
|
}.foregroundColor(Colors.black20)
|
|
48
48
|
.background(Colors.black01.cornerRadius(15))
|
|
49
|
-
.padding(.trailing, -
|
|
50
|
-
.padding(.top, -
|
|
49
|
+
.padding(.trailing, -11)
|
|
50
|
+
.padding(.top, -11)
|
|
51
51
|
.zIndex(1)
|
|
52
52
|
.accessibility(identifier: "ic_popup_close")
|
|
53
53
|
|
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
|
+
#Thu Jan 09 10:43:10 ICT 2025
|
|
8
|
+
sdk.dir=/Users/sophia/Library/Android/sdk
|