@momo-kits/native-kits 0.114.2-beta.2 → 0.114.2-beta.20
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/application/AnimationSearchInput.kt +0 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +6 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +6 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +1 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +4 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +5 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +2 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +41 -22
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +25 -37
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +3 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +11 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +3 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +1 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -10
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +13 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +2 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/{dateTimePicker → datetimepicker}/DateTimePicker.kt +13 -13
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/{dateTimePicker → datetimepicker}/DateTimePickerTypes.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/{dateTimePicker → datetimepicker}/DateTimePickerUtils.kt +34 -23
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/{dateTimePicker → datetimepicker}/WheelPicker.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +9 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +12 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +1 -1
- package/ios/Checkbox/Checkbox.swift +1 -1
- package/ios/Popup/PopupDisplay.swift +2 -2
- package/local.properties +2 -2
- package/package.json +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/dateTimePicker/DateTimePickerExample.kt +0 -90
|
@@ -38,7 +38,7 @@ fun HeaderBackground(
|
|
|
38
38
|
val statusBarHeight = AppStatusBar.current ?: getStatusBarHeight()
|
|
39
39
|
|
|
40
40
|
val opacityAni by animateFloatAsState(
|
|
41
|
-
targetValue = (1 - (scrollState / HEADER_HEIGHT*1f)).coerceIn(0f, 1f),
|
|
41
|
+
targetValue = (1 - (scrollState / HEADER_HEIGHT * 1f)).coerceIn(0f, 1f),
|
|
42
42
|
)
|
|
43
43
|
|
|
44
44
|
val backgroundColor by animateColorAsState(
|
|
@@ -29,21 +29,27 @@ class Navigator {
|
|
|
29
29
|
fun push(content: @Composable () -> Unit) {
|
|
30
30
|
//implement
|
|
31
31
|
}
|
|
32
|
+
|
|
32
33
|
fun present(content: @Composable () -> Unit) {
|
|
33
34
|
//implement
|
|
34
35
|
}
|
|
36
|
+
|
|
35
37
|
fun reset(content: @Composable () -> Unit) {
|
|
36
38
|
//implement
|
|
37
39
|
}
|
|
40
|
+
|
|
38
41
|
fun pop() {
|
|
39
42
|
//implement
|
|
40
43
|
}
|
|
44
|
+
|
|
41
45
|
fun replace(content: @Composable () -> Unit) {
|
|
42
46
|
//implement
|
|
43
47
|
}
|
|
48
|
+
|
|
44
49
|
fun popToTop() {
|
|
45
50
|
//implement
|
|
46
51
|
}
|
|
52
|
+
|
|
47
53
|
fun showModal(
|
|
48
54
|
onClose: () -> Unit = {},
|
|
49
55
|
canBackgroundClose: Boolean = true,
|
|
@@ -87,7 +87,7 @@ fun Screen(
|
|
|
87
87
|
val bottomPadding = min(indicator, 21.dp)
|
|
88
88
|
|
|
89
89
|
val opacity by animateFloatAsState(
|
|
90
|
-
targetValue = ((scrollState.value / HEADER_HEIGHT*1f)).coerceIn(0f, 1f),
|
|
90
|
+
targetValue = ((scrollState.value / HEADER_HEIGHT * 1f)).coerceIn(0f, 1f),
|
|
91
91
|
)
|
|
92
92
|
|
|
93
93
|
val headerAnimated =
|
|
@@ -42,18 +42,21 @@ fun useHeaderSearchAnimation(
|
|
|
42
42
|
)
|
|
43
43
|
|
|
44
44
|
val animatedTranslateX by animateFloatAsState(
|
|
45
|
-
targetValue = (scrollState / HEADER_HEIGHT*1f).coerceIn(
|
|
45
|
+
targetValue = (scrollState / HEADER_HEIGHT * 1f).coerceIn(
|
|
46
|
+
0f,
|
|
47
|
+
1f
|
|
48
|
+
) * (leftPosition.value - 12) + 12,
|
|
46
49
|
)
|
|
47
50
|
|
|
48
51
|
val animatedWidth by animateFloatAsState(
|
|
49
|
-
targetValue = (scrollState / HEADER_HEIGHT*1f).coerceIn(
|
|
52
|
+
targetValue = (scrollState / HEADER_HEIGHT * 1f).coerceIn(
|
|
50
53
|
0f,
|
|
51
54
|
1f
|
|
52
55
|
) * ((searchWidth - leftPosition.value - headerRightWidth.value + 12) - searchWidth) + searchWidth,
|
|
53
56
|
)
|
|
54
57
|
|
|
55
58
|
val animatedTranslateY by animateFloatAsState(
|
|
56
|
-
targetValue = (1 - (scrollState / HEADER_HEIGHT* 1f).coerceIn(0f, 1f)) * HEADER_HEIGHT
|
|
59
|
+
targetValue = (1 - (scrollState / HEADER_HEIGHT * 1f).coerceIn(0f, 1f)) * HEADER_HEIGHT
|
|
57
60
|
)
|
|
58
61
|
return HeaderAnimations(
|
|
59
62
|
opacity = opacityAni,
|
|
@@ -20,7 +20,6 @@ import vn.momo.kits.const.Typography
|
|
|
20
20
|
import vn.momo.kits.const.scaleSize
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
|
|
24
23
|
@Composable
|
|
25
24
|
fun Badge(label: String = "Label", backgroundColor: Color? = null) {
|
|
26
25
|
val primaryColors = listOf(
|
|
@@ -72,7 +71,7 @@ fun Badge(label: String = "Label", backgroundColor: Color? = null) {
|
|
|
72
71
|
Text(
|
|
73
72
|
text = formatTitle(label),
|
|
74
73
|
color = Colors.black_01,
|
|
75
|
-
style = Typography.
|
|
74
|
+
style = Typography.actionXxsBold
|
|
76
75
|
)
|
|
77
76
|
}
|
|
78
77
|
}
|
|
@@ -74,10 +74,10 @@ enum class Size(val value: ButtonSpecs) {
|
|
|
74
74
|
|
|
75
75
|
fun getStyle(size: Size): TextStyle {
|
|
76
76
|
return when (size.name) {
|
|
77
|
-
Size.LARGE.name -> Typography.
|
|
78
|
-
Size.MEDIUM.name -> Typography.
|
|
79
|
-
Size.SMALL.name -> Typography.
|
|
80
|
-
else -> Typography.
|
|
77
|
+
Size.LARGE.name -> Typography.actionDefaultBold
|
|
78
|
+
Size.MEDIUM.name -> Typography.actionSBold
|
|
79
|
+
Size.SMALL.name -> Typography.actionXsBold
|
|
80
|
+
else -> Typography.actionDefaultBold
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
@@ -3,17 +3,15 @@ package vn.momo.kits.components
|
|
|
3
3
|
import androidx.compose.foundation.background
|
|
4
4
|
import androidx.compose.foundation.border
|
|
5
5
|
import androidx.compose.foundation.clickable
|
|
6
|
-
import androidx.compose.foundation.interaction.MutableInteractionSource
|
|
7
6
|
import androidx.compose.foundation.layout.Box
|
|
8
7
|
import androidx.compose.foundation.layout.Row
|
|
9
8
|
import androidx.compose.foundation.layout.Spacer
|
|
10
9
|
import androidx.compose.foundation.layout.size
|
|
11
10
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
12
|
-
import androidx.compose.material.ripple.rememberRipple
|
|
13
11
|
import androidx.compose.runtime.Composable
|
|
14
|
-
import androidx.compose.runtime.remember
|
|
15
12
|
import androidx.compose.ui.Alignment
|
|
16
13
|
import androidx.compose.ui.Modifier
|
|
14
|
+
import androidx.compose.ui.graphics.Color
|
|
17
15
|
import androidx.compose.ui.unit.dp
|
|
18
16
|
import vn.momo.kits.const.AppTheme
|
|
19
17
|
import vn.momo.kits.const.Colors
|
|
@@ -30,8 +28,8 @@ fun CheckBox(
|
|
|
30
28
|
title: String = "",
|
|
31
29
|
) {
|
|
32
30
|
var borderColor = AppTheme.current.colors.text.default
|
|
33
|
-
var backgroundColor =
|
|
34
|
-
val iconSource = if (indeterminate) "
|
|
31
|
+
var backgroundColor = Color.Transparent
|
|
32
|
+
val iconSource = if (indeterminate) "navigation_minus" else "ic_checked"
|
|
35
33
|
|
|
36
34
|
if (checked) {
|
|
37
35
|
borderColor = AppTheme.current.colors.primary
|
|
@@ -39,7 +37,7 @@ fun CheckBox(
|
|
|
39
37
|
}
|
|
40
38
|
if (disabled) {
|
|
41
39
|
borderColor = AppTheme.current.colors.border.disable
|
|
42
|
-
backgroundColor =
|
|
40
|
+
backgroundColor = Color.Transparent
|
|
43
41
|
if (checked) {
|
|
44
42
|
borderColor = AppTheme.current.colors.background.tonal
|
|
45
43
|
backgroundColor = AppTheme.current.colors.background.tonal
|
|
@@ -68,7 +66,7 @@ fun CheckBox(
|
|
|
68
66
|
if (title.isNotEmpty()) {
|
|
69
67
|
Spacer(Modifier.size(Spacing.S))
|
|
70
68
|
Text(
|
|
71
|
-
style = Typography.
|
|
69
|
+
style = Typography.descriptionDefaultRegular,
|
|
72
70
|
text = title,
|
|
73
71
|
)
|
|
74
72
|
}
|
|
@@ -27,7 +27,7 @@ fun Icon(
|
|
|
27
27
|
} else {
|
|
28
28
|
Icons[source] ?: ""
|
|
29
29
|
}
|
|
30
|
-
Box(modifier = modifier.size(size).semantics {contentDescription = "img|$icon"}) {
|
|
30
|
+
Box(modifier = modifier.size(size).semantics { contentDescription = "img|$icon" }) {
|
|
31
31
|
AsyncImage(
|
|
32
32
|
modifier = Modifier.matchParentSize(),
|
|
33
33
|
model = icon,
|
|
@@ -3,13 +3,10 @@ package vn.momo.kits.components
|
|
|
3
3
|
import androidx.compose.foundation.background
|
|
4
4
|
import androidx.compose.foundation.border
|
|
5
5
|
import androidx.compose.foundation.clickable
|
|
6
|
-
import androidx.compose.foundation.interaction.MutableInteractionSource
|
|
7
6
|
import androidx.compose.foundation.layout.Box
|
|
8
7
|
import androidx.compose.foundation.layout.size
|
|
9
8
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
10
|
-
import androidx.compose.material.ripple.rememberRipple
|
|
11
9
|
import androidx.compose.runtime.Composable
|
|
12
|
-
import androidx.compose.runtime.remember
|
|
13
10
|
import androidx.compose.ui.Alignment
|
|
14
11
|
import androidx.compose.ui.Modifier
|
|
15
12
|
import androidx.compose.ui.draw.clip
|
|
@@ -47,7 +47,7 @@ fun Image(
|
|
|
47
47
|
)
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
Box(modifier = modifier.semantics {contentDescription = "img|$source"}) {
|
|
50
|
+
Box(modifier = modifier.semantics { contentDescription = "img|$source" }) {
|
|
51
51
|
AsyncImage(
|
|
52
52
|
modifier = Modifier.matchParentSize(),
|
|
53
53
|
model = source,
|
|
@@ -67,6 +67,7 @@ fun Image(
|
|
|
67
67
|
color = AppTheme.current.colors.text.disable,
|
|
68
68
|
modifier = modifier
|
|
69
69
|
)
|
|
70
|
+
|
|
70
71
|
ImageState.Success -> {}
|
|
71
72
|
}
|
|
72
73
|
}
|
|
@@ -20,7 +20,7 @@ import vn.momo.kits.const.Spacing
|
|
|
20
20
|
import vn.momo.kits.const.Typography
|
|
21
21
|
|
|
22
22
|
enum class InformationState {
|
|
23
|
-
DEFAULT
|
|
23
|
+
DEFAULT,
|
|
24
24
|
WARNING,
|
|
25
25
|
ERROR
|
|
26
26
|
}
|
|
@@ -31,12 +31,12 @@ fun Information(
|
|
|
31
31
|
description: String = "Description",
|
|
32
32
|
state: InformationState = InformationState.DEFAULT,
|
|
33
33
|
image: String? = null,
|
|
34
|
-
|
|
34
|
+
onPressAction: (() -> Unit)? = null,
|
|
35
35
|
showIcon: Boolean = true,
|
|
36
|
-
|
|
36
|
+
action: String? = null,
|
|
37
37
|
showIconClose: Boolean = true,
|
|
38
|
-
onPressClose: (()->Unit)? = null,
|
|
39
|
-
){
|
|
38
|
+
onPressClose: (() -> Unit)? = null,
|
|
39
|
+
) {
|
|
40
40
|
var borderColor = Colors.blue_07
|
|
41
41
|
var backgroundColor = Colors.blue_10
|
|
42
42
|
var color = Colors.blue_03
|
|
@@ -46,45 +46,64 @@ fun Information(
|
|
|
46
46
|
borderColor = Colors.yellow_06
|
|
47
47
|
backgroundColor = Colors.yellow_09
|
|
48
48
|
color = Colors.orange_03
|
|
49
|
-
iconSource = "24_notifications_alert_triangle"
|
|
49
|
+
iconSource = "24_notifications_alert_triangle"
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
if (state === InformationState.ERROR) {
|
|
53
53
|
borderColor = Colors.red_07
|
|
54
54
|
backgroundColor = Colors.red_10
|
|
55
55
|
color = Colors.red_03
|
|
56
|
-
iconSource = "24_notifications_alert_octagon"
|
|
56
|
+
iconSource = "24_notifications_alert_octagon"
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
Column(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
.
|
|
59
|
+
Column(
|
|
60
|
+
modifier = Modifier.border(
|
|
61
|
+
width = 0.5.dp,
|
|
62
|
+
shape = RoundedCornerShape(Radius.S),
|
|
63
|
+
color = borderColor
|
|
64
|
+
).background(color = backgroundColor)
|
|
65
|
+
.padding(Spacing.M)
|
|
65
66
|
) {
|
|
66
67
|
Row {
|
|
67
68
|
if (image != null) {
|
|
68
|
-
Image(
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
Image(
|
|
70
|
+
source = image,
|
|
71
|
+
modifier = Modifier.padding(end = Spacing.S).width(40.dp).height(40.dp).clip(
|
|
72
|
+
RoundedCornerShape(Radius.S)
|
|
73
|
+
)
|
|
74
|
+
)
|
|
71
75
|
}
|
|
72
76
|
if (image == null && showIcon) {
|
|
73
|
-
Icon(
|
|
77
|
+
Icon(
|
|
78
|
+
source = iconSource,
|
|
79
|
+
size = 16.dp,
|
|
80
|
+
color = color,
|
|
81
|
+
modifier = Modifier.padding(end = Spacing.S)
|
|
82
|
+
)
|
|
74
83
|
}
|
|
75
84
|
Column(modifier = Modifier.weight(1f)) {
|
|
76
85
|
if (title != null) {
|
|
77
|
-
Text(title, style = Typography.
|
|
86
|
+
Text(title, style = Typography.labelDefaultMedium)
|
|
78
87
|
}
|
|
79
|
-
Text(description, style = Typography.
|
|
88
|
+
Text(description, style = Typography.descriptionDefaultRegular)
|
|
80
89
|
}
|
|
81
90
|
if (onPressClose != null && showIconClose) {
|
|
82
|
-
Icon(
|
|
91
|
+
Icon(
|
|
92
|
+
source = "navigation_close",
|
|
93
|
+
size = 16.dp,
|
|
94
|
+
modifier = Modifier.clickable(onClick = onPressClose)
|
|
95
|
+
)
|
|
83
96
|
}
|
|
84
97
|
}
|
|
85
|
-
if (
|
|
98
|
+
if (action != null && onPressAction != null) {
|
|
86
99
|
Row(modifier = Modifier.padding(top = Spacing.S)) {
|
|
87
|
-
Text(
|
|
100
|
+
Text(
|
|
101
|
+
action,
|
|
102
|
+
modifier = Modifier.weight(1f).clickable(onClick = onPressAction),
|
|
103
|
+
textAlign = TextAlign.End,
|
|
104
|
+
style = Typography.actionXsBold,
|
|
105
|
+
color = color
|
|
106
|
+
)
|
|
88
107
|
}
|
|
89
108
|
}
|
|
90
109
|
}
|
|
@@ -21,7 +21,6 @@ import androidx.compose.foundation.text.KeyboardOptions
|
|
|
21
21
|
import androidx.compose.material3.CircularProgressIndicator
|
|
22
22
|
import androidx.compose.runtime.Composable
|
|
23
23
|
import androidx.compose.runtime.MutableState
|
|
24
|
-
import androidx.compose.runtime.SideEffect
|
|
25
24
|
import androidx.compose.runtime.getValue
|
|
26
25
|
import androidx.compose.runtime.mutableStateOf
|
|
27
26
|
import androidx.compose.runtime.remember
|
|
@@ -37,7 +36,6 @@ import androidx.compose.ui.text.TextStyle
|
|
|
37
36
|
import androidx.compose.ui.text.font.FontWeight
|
|
38
37
|
import androidx.compose.ui.text.input.KeyboardType
|
|
39
38
|
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
|
40
|
-
import androidx.compose.ui.text.input.TextFieldValue
|
|
41
39
|
import androidx.compose.ui.text.input.VisualTransformation
|
|
42
40
|
import androidx.compose.ui.unit.Dp
|
|
43
41
|
import androidx.compose.ui.unit.dp
|
|
@@ -144,7 +142,7 @@ fun ErrorView(errorMessage: String, errorSpacing: Boolean, hintText: String) {
|
|
|
144
142
|
)
|
|
145
143
|
Text(
|
|
146
144
|
errorMessage.ifEmpty { hintTextDefault },
|
|
147
|
-
style = Typography.
|
|
145
|
+
style = Typography.descriptionDefaultRegular,
|
|
148
146
|
modifier = Modifier.padding(start = Spacing.XS),
|
|
149
147
|
color = color,
|
|
150
148
|
)
|
|
@@ -156,7 +154,7 @@ fun ErrorView(errorMessage: String, errorSpacing: Boolean, hintText: String) {
|
|
|
156
154
|
|
|
157
155
|
@Composable
|
|
158
156
|
fun Input(
|
|
159
|
-
text: String = "",
|
|
157
|
+
text: MutableState<String> = remember { mutableStateOf("") },
|
|
160
158
|
floatingValue: String = "",
|
|
161
159
|
floatingValueColor: Color = AppTheme.current.colors.text.hint,
|
|
162
160
|
floatingIcon: String = "",
|
|
@@ -183,11 +181,6 @@ fun Input(
|
|
|
183
181
|
keyboardType: KeyboardType = KeyboardType.Text,
|
|
184
182
|
modifier: Modifier = Modifier,
|
|
185
183
|
) {
|
|
186
|
-
// Handling state based on the `BasicTextField` concept
|
|
187
|
-
var textFieldValueState by remember { mutableStateOf(TextFieldValue(text = text)) }
|
|
188
|
-
val textFieldValue = textFieldValueState.copy(text = text)
|
|
189
|
-
var lastTextValue by remember(text) { mutableStateOf(text) }
|
|
190
|
-
|
|
191
184
|
var isFocused by remember { mutableStateOf(false) }
|
|
192
185
|
var passHidden by remember { mutableStateOf(false) }
|
|
193
186
|
var isBlurred = false
|
|
@@ -212,14 +205,14 @@ fun Input(
|
|
|
212
205
|
|
|
213
206
|
val testId = if (disabled) "input_${floatingValue}_disabled" else "input_$floatingValue"
|
|
214
207
|
|
|
215
|
-
Column(
|
|
216
|
-
|
|
208
|
+
Column(
|
|
209
|
+
modifier = modifier.setAutomationId(testId)
|
|
217
210
|
) {
|
|
218
211
|
BasicTextField(
|
|
219
|
-
value = text,
|
|
220
212
|
enabled = !disabled,
|
|
221
213
|
readOnly = readOnly,
|
|
222
214
|
singleLine = true,
|
|
215
|
+
value = text.value,
|
|
223
216
|
textStyle = TextStyle(
|
|
224
217
|
color = textColor,
|
|
225
218
|
fontSize = 16.sp,
|
|
@@ -236,15 +229,7 @@ fun Input(
|
|
|
236
229
|
if (!it.isFocused && isBlurred) onBlur()
|
|
237
230
|
if (it.isFocused && !isBlurred) isBlurred = true
|
|
238
231
|
},
|
|
239
|
-
onValueChange =
|
|
240
|
-
textFieldValueState.copy(text = newValue)
|
|
241
|
-
val stringChangedSinceLastInvocation = lastTextValue != newValue
|
|
242
|
-
lastTextValue = newValue
|
|
243
|
-
|
|
244
|
-
if (stringChangedSinceLastInvocation) {
|
|
245
|
-
onChangeText(newValue)
|
|
246
|
-
}
|
|
247
|
-
},
|
|
232
|
+
onValueChange = onChangeText,
|
|
248
233
|
decorationBox = { innerTextField ->
|
|
249
234
|
// Floating Icon
|
|
250
235
|
if (floatingValue.isNotEmpty() || floatingIcon.isNotEmpty()) {
|
|
@@ -261,13 +246,13 @@ fun Input(
|
|
|
261
246
|
) {
|
|
262
247
|
Text(
|
|
263
248
|
floatingValue,
|
|
264
|
-
style = Typography.
|
|
249
|
+
style = Typography.labelSMedium,
|
|
265
250
|
color = floatingTitleColor
|
|
266
251
|
)
|
|
267
252
|
if (required) {
|
|
268
253
|
Text(
|
|
269
254
|
"*",
|
|
270
|
-
style = Typography.
|
|
255
|
+
style = Typography.labelSMedium,
|
|
271
256
|
color = AppTheme.current.colors.error.primary,
|
|
272
257
|
)
|
|
273
258
|
}
|
|
@@ -306,7 +291,7 @@ fun Input(
|
|
|
306
291
|
)
|
|
307
292
|
}
|
|
308
293
|
Box(Modifier.weight(1f)) {
|
|
309
|
-
if (
|
|
294
|
+
if (text.value.isEmpty()) {
|
|
310
295
|
Text(
|
|
311
296
|
text = placeholder,
|
|
312
297
|
style = TextStyle(
|
|
@@ -319,7 +304,7 @@ fun Input(
|
|
|
319
304
|
}
|
|
320
305
|
innerTextField()
|
|
321
306
|
}
|
|
322
|
-
if (isFocused &&
|
|
307
|
+
if (isFocused && text.value.isNotEmpty()) {
|
|
323
308
|
Row {
|
|
324
309
|
Spacer(Modifier.width(Spacing.XS))
|
|
325
310
|
Icon(
|
|
@@ -327,10 +312,7 @@ fun Input(
|
|
|
327
312
|
size = 16.dp,
|
|
328
313
|
color = AppTheme.current.colors.text.hint,
|
|
329
314
|
modifier = Modifier.clickable(
|
|
330
|
-
onClick = {
|
|
331
|
-
onChangeText("")
|
|
332
|
-
textFieldValueState = TextFieldValue(text = "")
|
|
333
|
-
},
|
|
315
|
+
onClick = { text.value = "" },
|
|
334
316
|
interactionSource = remember { MutableInteractionSource() },
|
|
335
317
|
indication = null
|
|
336
318
|
)
|
|
@@ -338,16 +320,22 @@ fun Input(
|
|
|
338
320
|
}
|
|
339
321
|
}
|
|
340
322
|
if (secureTextEntry && passHidden) {
|
|
341
|
-
val hidePassword = { onRightIconPressed(); passHidden = !passHidden}
|
|
342
|
-
RenderRightIcon(
|
|
343
|
-
|
|
323
|
+
val hidePassword = { onRightIconPressed(); passHidden = !passHidden }
|
|
324
|
+
RenderRightIcon(
|
|
325
|
+
loading, "24_security_eye_open", iconTintColor,
|
|
326
|
+
hidePassword
|
|
327
|
+
)
|
|
344
328
|
} else if (secureTextEntry && !passHidden) {
|
|
345
|
-
val showPassword = { onRightIconPressed(); passHidden = !passHidden}
|
|
346
|
-
RenderRightIcon(
|
|
347
|
-
|
|
329
|
+
val showPassword = { onRightIconPressed(); passHidden = !passHidden }
|
|
330
|
+
RenderRightIcon(
|
|
331
|
+
loading, "24_security_eye_off", iconTintColor,
|
|
332
|
+
showPassword
|
|
333
|
+
)
|
|
348
334
|
} else {
|
|
349
|
-
RenderRightIcon(
|
|
350
|
-
|
|
335
|
+
RenderRightIcon(
|
|
336
|
+
loading, icon, iconTintColor,
|
|
337
|
+
onRightIconPressed
|
|
338
|
+
)
|
|
351
339
|
}
|
|
352
340
|
}
|
|
353
341
|
}
|
|
@@ -94,13 +94,13 @@ fun InputDropDown(
|
|
|
94
94
|
) {
|
|
95
95
|
Text(
|
|
96
96
|
floatingValue,
|
|
97
|
-
style = Typography.
|
|
97
|
+
style = Typography.labelSMedium,
|
|
98
98
|
color = floatingTitleColor
|
|
99
99
|
)
|
|
100
100
|
if (required) {
|
|
101
101
|
Text(
|
|
102
102
|
"*",
|
|
103
|
-
style = Typography.
|
|
103
|
+
style = Typography.labelSMedium,
|
|
104
104
|
color = AppTheme.current.colors.error.primary,
|
|
105
105
|
)
|
|
106
106
|
}
|
|
@@ -109,7 +109,7 @@ fun InputMoney(
|
|
|
109
109
|
|
|
110
110
|
val testId = if (disabled) "input_${floatingValue}_disabled" else "input_$floatingValue"
|
|
111
111
|
|
|
112
|
-
Column(modifier =
|
|
112
|
+
Column(modifier = Modifier.semantics {
|
|
113
113
|
contentDescription = floatingValue; testTag = testId
|
|
114
114
|
}) {
|
|
115
115
|
BasicTextField(
|
|
@@ -150,13 +150,13 @@ fun InputMoney(
|
|
|
150
150
|
) {
|
|
151
151
|
Text(
|
|
152
152
|
floatingValue,
|
|
153
|
-
style = Typography.
|
|
153
|
+
style = Typography.labelSMedium,
|
|
154
154
|
color = floatingTitleColor
|
|
155
155
|
)
|
|
156
156
|
if (required) {
|
|
157
157
|
Text(
|
|
158
158
|
"*",
|
|
159
|
-
style = Typography.
|
|
159
|
+
style = Typography.labelSMedium,
|
|
160
160
|
color = AppTheme.current.colors.error.primary,
|
|
161
161
|
)
|
|
162
162
|
}
|
|
@@ -42,8 +42,8 @@ import vn.momo.kits.const.scaleSize
|
|
|
42
42
|
|
|
43
43
|
@Composable
|
|
44
44
|
fun OTPCaret() {
|
|
45
|
-
val
|
|
46
|
-
|
|
45
|
+
val duration = 500
|
|
46
|
+
val backgroundColor = AppTheme.current.colors.primary
|
|
47
47
|
|
|
48
48
|
val infiniteTransition = rememberInfiniteTransition()
|
|
49
49
|
val alpha by infiniteTransition.animateFloat(
|
|
@@ -51,8 +51,8 @@ fun OTPCaret() {
|
|
|
51
51
|
targetValue = 0f,
|
|
52
52
|
animationSpec = infiniteRepeatable(
|
|
53
53
|
animation = tween(
|
|
54
|
-
durationMillis =
|
|
55
|
-
delayMillis =
|
|
54
|
+
durationMillis = duration,
|
|
55
|
+
delayMillis = duration,
|
|
56
56
|
easing = LinearEasing
|
|
57
57
|
),
|
|
58
58
|
repeatMode = RepeatMode.Reverse
|
|
@@ -68,7 +68,7 @@ fun OTPCaret() {
|
|
|
68
68
|
Text(
|
|
69
69
|
text = "-",
|
|
70
70
|
color = AppTheme.current.colors.text.hint,
|
|
71
|
-
style = Typography.
|
|
71
|
+
style = Typography.descriptionDefaultRegular
|
|
72
72
|
)
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -85,15 +85,14 @@ fun InputOTP(
|
|
|
85
85
|
onFocus: () -> Unit = {},
|
|
86
86
|
onBlur: () -> Unit = {},
|
|
87
87
|
dataType: String = "number",
|
|
88
|
-
accessibilityLabel: String? = null,
|
|
89
88
|
modifier: Modifier = Modifier
|
|
90
89
|
) {
|
|
91
|
-
val
|
|
90
|
+
val maxLength = 10
|
|
92
91
|
var isFocused by remember { mutableStateOf(false) }
|
|
93
92
|
var isBlurred = false
|
|
94
93
|
|
|
95
94
|
val handleChangeText: (String) -> Unit = { text ->
|
|
96
|
-
if (text.length <=
|
|
95
|
+
if (text.length <= maxLength &&
|
|
97
96
|
(dataType != "number" || !text.any { !it.isDigit() }) &&
|
|
98
97
|
(text.length < value.length || value.length < text.length)
|
|
99
98
|
) {
|
|
@@ -116,7 +115,7 @@ fun InputOTP(
|
|
|
116
115
|
if (!it.isFocused && isBlurred) onBlur()
|
|
117
116
|
if (it.isFocused && !isBlurred) isBlurred = true
|
|
118
117
|
},
|
|
119
|
-
decorationBox = {
|
|
118
|
+
decorationBox = { _ ->
|
|
120
119
|
Box {
|
|
121
120
|
if (floatingValue.isNotEmpty()) {
|
|
122
121
|
Box(
|
|
@@ -133,7 +132,7 @@ fun InputOTP(
|
|
|
133
132
|
) {
|
|
134
133
|
Text(
|
|
135
134
|
floatingValue,
|
|
136
|
-
style = Typography.
|
|
135
|
+
style = Typography.labelSMedium,
|
|
137
136
|
color = AppTheme.current.colors.text.hint
|
|
138
137
|
)
|
|
139
138
|
}
|
|
@@ -164,7 +163,7 @@ fun InputOTP(
|
|
|
164
163
|
val textColor =
|
|
165
164
|
if (value.getOrNull(i) != null) AppTheme.current.colors.text.default else AppTheme.current.colors.text.hint
|
|
166
165
|
val typo =
|
|
167
|
-
if (value.getOrNull(i) != null) Typography.
|
|
166
|
+
if (value.getOrNull(i) != null) Typography.headerDefaultBold else Typography.descriptionDefaultRegular
|
|
168
167
|
Text(
|
|
169
168
|
text = value.getOrNull(i)?.toString() ?: "-",
|
|
170
169
|
color = textColor,
|
|
@@ -182,7 +181,7 @@ fun InputOTP(
|
|
|
182
181
|
} else {
|
|
183
182
|
for (i in value.indices) {
|
|
184
183
|
Text(
|
|
185
|
-
style = Typography.
|
|
184
|
+
style = Typography.headerDefaultBold,
|
|
186
185
|
text = value[i].toString()
|
|
187
186
|
)
|
|
188
187
|
if (i != value.length - 1 || (isFocused && value.length != MAX_LENGTH)) {
|
|
@@ -223,7 +223,7 @@ fun InputSearch(
|
|
|
223
223
|
if (inputSearchProps.showButtonText) {
|
|
224
224
|
Text(
|
|
225
225
|
text = inputSearchProps.buttonText,
|
|
226
|
-
style = Typography.
|
|
226
|
+
style = Typography.actionDefaultBold,
|
|
227
227
|
color = AppTheme.current.colors.text.default,
|
|
228
228
|
modifier = Modifier.padding(start = Spacing.L).clickable(
|
|
229
229
|
interactionSource = remember { MutableInteractionSource() },
|
|
@@ -129,13 +129,13 @@ fun InputTextArea(
|
|
|
129
129
|
) {
|
|
130
130
|
Text(
|
|
131
131
|
floatingValue,
|
|
132
|
-
style = Typography.
|
|
132
|
+
style = Typography.labelSMedium,
|
|
133
133
|
color = floatingTitleColor
|
|
134
134
|
)
|
|
135
135
|
if (required) {
|
|
136
136
|
Text(
|
|
137
137
|
"*",
|
|
138
|
-
style = Typography.
|
|
138
|
+
style = Typography.labelSMedium,
|
|
139
139
|
color = AppTheme.current.colors.error.primary,
|
|
140
140
|
)
|
|
141
141
|
}
|
|
@@ -213,7 +213,7 @@ fun InputTextArea(
|
|
|
213
213
|
) {
|
|
214
214
|
Text(
|
|
215
215
|
"${text.value.length}/$maxLength",
|
|
216
|
-
style = Typography.
|
|
216
|
+
style = Typography.descriptionXsRegular,
|
|
217
217
|
color = AppTheme.current.colors.text.hint
|
|
218
218
|
)
|
|
219
219
|
}
|