@momo-kits/native-kits 0.152.4-beta.3 → 0.152.5
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/package.json +7 -6
- package/shared/build.gradle.kts +74 -0
- package/CODE_OF_CONDUCT.md +0 -133
- package/CONTRIBUTING.md +0 -114
- package/LICENSE +0 -20
- package/README.md +0 -7
- package/build.gradle.kts +0 -32
- package/compose/MoMoComposeKits.podspec +0 -54
- package/compose/build.gradle.kts +0 -149
- package/compose/src/androidMain/AndroidManifest.xml +0 -2
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -105
- package/compose/src/commonMain/composeResources/files/lottie_circle_loader.json +0 -1
- package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
- package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -57
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -201
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -222
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -48
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -306
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -715
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -214
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -236
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -77
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -27
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -334
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -345
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -90
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -131
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -543
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -23
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -69
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -143
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -179
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -111
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -384
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -160
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -234
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -223
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -232
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -236
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -228
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -364
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -50
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -34
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -85
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -33
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -338
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -95
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -64
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -89
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -91
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -84
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -208
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -172
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -199
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -237
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -191
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -306
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -13
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -191
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -258
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -35
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -59
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -68
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -49
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -232
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -111
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -94
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -159
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -232
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScaleSizeScope.kt +0 -17
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -459
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -169
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -216
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -180
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -251
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -80
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -306
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -31
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -385
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -38
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -62
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -88
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -144
- package/gradle.properties +0 -19
- package/gradlew +0 -240
- package/gradlew.bat +0 -91
- package/ios/Application/ApplicationEnvironment.swift +0 -50
- package/ios/Application/Components.swift +0 -263
- package/ios/Application/ComposeApi.swift +0 -22
- package/ios/Application/FloatingButton.swift +0 -172
- package/ios/Application/HeaderRight.swift +0 -271
- package/ios/Application/Screen.swift +0 -249
- package/ios/Badge/BadgeDot.swift +0 -31
- package/ios/Button/Button.swift +0 -211
- package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +0 -126
- package/ios/Checkbox/Checkbox.swift +0 -81
- package/ios/Chip/Chip.swift +0 -96
- package/ios/Colors+Radius+Spacing/Colors.swift +0 -172
- package/ios/Colors+Radius+Spacing/Radius.swift +0 -22
- package/ios/Colors+Radius+Spacing/Spacing.swift +0 -12
- package/ios/Extensions/Color++.swift +0 -25
- package/ios/Icon/Icon.swift +0 -51
- package/ios/Image/Image.swift +0 -70
- package/ios/Input/Input.swift +0 -207
- package/ios/Input/InputPhoneNumber.swift +0 -176
- package/ios/Input/InputSearch.swift +0 -238
- package/ios/Input/InputTextArea.swift +0 -242
- package/ios/Lottie/LottieView.swift +0 -86
- package/ios/OTPKeyboard/KeyboardButton.swift +0 -41
- package/ios/OTPKeyboard/OTPKeyboard.swift +0 -145
- package/ios/Popup/PopupDisplay.swift +0 -284
- package/ios/Popup/PopupInput.swift +0 -96
- package/ios/Popup/PopupPromotion.swift +0 -73
- package/ios/PopupView/FullscreenPopup.swift +0 -251
- package/ios/PopupView/Modifiers.swift +0 -158
- package/ios/PopupView/PopupView.swift +0 -289
- package/ios/PopupView/Utils++.swift +0 -281
- package/ios/ScrollIndicator/ScrollIndicator.swift +0 -110
- package/ios/Swipeable/SwipeCell.swift +0 -278
- package/ios/Swipeable/SwipeCellModel.swift +0 -86
- package/ios/Switch/Switch.swift +0 -44
- package/ios/Template/Logo/Logo.swift +0 -75
- package/ios/Template/TrustBanner/TrustBanner.swift +0 -120
- package/ios/Theme.md +0 -18
- package/ios/Typography/Text.swift +0 -140
- package/ios/Typography/Typography.swift +0 -95
- package/ios/native-kits.podspec +0 -18
- package/settings.gradle.kts +0 -25
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
package vn.momo.kits.components
|
|
2
|
-
|
|
3
|
-
import androidx.compose.foundation.background
|
|
4
|
-
import androidx.compose.foundation.border
|
|
5
|
-
import androidx.compose.foundation.clickable
|
|
6
|
-
import androidx.compose.foundation.interaction.MutableInteractionSource
|
|
7
|
-
import androidx.compose.foundation.layout.Box
|
|
8
|
-
import androidx.compose.foundation.layout.Column
|
|
9
|
-
import androidx.compose.foundation.layout.Row
|
|
10
|
-
import androidx.compose.foundation.layout.Spacer
|
|
11
|
-
import androidx.compose.foundation.layout.fillMaxWidth
|
|
12
|
-
import androidx.compose.foundation.layout.height
|
|
13
|
-
import androidx.compose.foundation.layout.offset
|
|
14
|
-
import androidx.compose.foundation.layout.padding
|
|
15
|
-
import androidx.compose.foundation.layout.width
|
|
16
|
-
import androidx.compose.foundation.layout.wrapContentSize
|
|
17
|
-
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
18
|
-
import androidx.compose.foundation.text.BasicTextField
|
|
19
|
-
import androidx.compose.foundation.text.KeyboardOptions
|
|
20
|
-
import androidx.compose.runtime.Composable
|
|
21
|
-
import androidx.compose.runtime.MutableState
|
|
22
|
-
import androidx.compose.runtime.getValue
|
|
23
|
-
import androidx.compose.runtime.mutableStateOf
|
|
24
|
-
import androidx.compose.runtime.remember
|
|
25
|
-
import androidx.compose.runtime.setValue
|
|
26
|
-
import androidx.compose.ui.Alignment
|
|
27
|
-
import androidx.compose.ui.Modifier
|
|
28
|
-
import androidx.compose.ui.focus.onFocusChanged
|
|
29
|
-
import androidx.compose.ui.graphics.Color
|
|
30
|
-
import androidx.compose.ui.semantics.contentDescription
|
|
31
|
-
import androidx.compose.ui.semantics.semantics
|
|
32
|
-
import androidx.compose.ui.semantics.testTag
|
|
33
|
-
import androidx.compose.ui.text.AnnotatedString
|
|
34
|
-
import androidx.compose.ui.text.TextStyle
|
|
35
|
-
import androidx.compose.ui.text.input.KeyboardType
|
|
36
|
-
import androidx.compose.ui.text.input.OffsetMapping
|
|
37
|
-
import androidx.compose.ui.text.input.TransformedText
|
|
38
|
-
import androidx.compose.ui.text.input.VisualTransformation
|
|
39
|
-
import androidx.compose.ui.unit.dp
|
|
40
|
-
import androidx.compose.ui.unit.sp
|
|
41
|
-
import androidx.compose.ui.zIndex
|
|
42
|
-
import vn.momo.kits.const.AppTheme
|
|
43
|
-
import vn.momo.kits.const.Spacing
|
|
44
|
-
import vn.momo.kits.const.Typography
|
|
45
|
-
import vn.momo.kits.utils.formatNumberToMoney
|
|
46
|
-
|
|
47
|
-
class CustomConverter : VisualTransformation {
|
|
48
|
-
override fun filter(text: AnnotatedString): TransformedText {
|
|
49
|
-
if (text.text.isEmpty() || text.text == "0") {
|
|
50
|
-
return TransformedText(AnnotatedString("0"), OffsetMapping.Identity)
|
|
51
|
-
}
|
|
52
|
-
val formattedText = formatNumberToMoney(text.text.toLong())
|
|
53
|
-
|
|
54
|
-
return TransformedText(
|
|
55
|
-
AnnotatedString(formattedText),
|
|
56
|
-
object : OffsetMapping {
|
|
57
|
-
override fun originalToTransformed(offset: Int): Int = formattedText.length
|
|
58
|
-
override fun transformedToOriginal(offset: Int): Int = text.length
|
|
59
|
-
}
|
|
60
|
-
)
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
@Composable
|
|
65
|
-
fun InputMoney(
|
|
66
|
-
text: MutableState<String> = remember { mutableStateOf("0") },
|
|
67
|
-
floatingValue: String = "",
|
|
68
|
-
floatingValueColor: Color = AppTheme.current.colors.text.hint,
|
|
69
|
-
floatingIcon: String = "",
|
|
70
|
-
floatingIconColor: Color = AppTheme.current.colors.text.default,
|
|
71
|
-
placeholder: String = "0đ",
|
|
72
|
-
size: InputSize = InputSize.SMALL,
|
|
73
|
-
onChangeText: (String) -> Unit = {},
|
|
74
|
-
error: String = "",
|
|
75
|
-
errorSpacing: Boolean = false,
|
|
76
|
-
disabled: Boolean = false,
|
|
77
|
-
icon: String = "",
|
|
78
|
-
iconColor: Color = AppTheme.current.colors.text.default,
|
|
79
|
-
onPressIcon: () -> Unit = {},
|
|
80
|
-
leadingIcon: String = "",
|
|
81
|
-
leadingIconColor: Color = AppTheme.current.colors.text.hint,
|
|
82
|
-
onFocus: () -> Unit = {},
|
|
83
|
-
onBlur: () -> Unit = {},
|
|
84
|
-
loading: Boolean = false,
|
|
85
|
-
required: Boolean = false,
|
|
86
|
-
fontWeight: InputFontWeight = InputFontWeight.BOLD,
|
|
87
|
-
keyboardType: KeyboardType = KeyboardType.Number,
|
|
88
|
-
) {
|
|
89
|
-
var isFocused by remember { mutableStateOf(false) }
|
|
90
|
-
var isBlurred = false
|
|
91
|
-
val disabledColor = AppTheme.current.colors.text.disable
|
|
92
|
-
var textColor = AppTheme.current.colors.text.default
|
|
93
|
-
var placeholderColor = AppTheme.current.colors.text.hint
|
|
94
|
-
var iconTintColor = iconColor
|
|
95
|
-
val floatingTitleColor = when {
|
|
96
|
-
disabled -> AppTheme.current.colors.text.disable
|
|
97
|
-
else -> floatingValueColor
|
|
98
|
-
}
|
|
99
|
-
val floatingIconTintColor = when {
|
|
100
|
-
disabled -> AppTheme.current.colors.text.disable
|
|
101
|
-
else -> floatingIconColor
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (disabled) {
|
|
105
|
-
textColor = disabledColor
|
|
106
|
-
placeholderColor = disabledColor
|
|
107
|
-
iconTintColor = disabledColor
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
val testId = if (disabled) "input_${floatingValue}_disabled" else "input_$floatingValue"
|
|
111
|
-
|
|
112
|
-
Column(modifier = Modifier.semantics {
|
|
113
|
-
contentDescription = floatingValue; testTag = testId
|
|
114
|
-
}) {
|
|
115
|
-
BasicTextField(
|
|
116
|
-
enabled = !disabled,
|
|
117
|
-
singleLine = true,
|
|
118
|
-
value = text.value,
|
|
119
|
-
textStyle = TextStyle(
|
|
120
|
-
color = textColor,
|
|
121
|
-
fontSize = 20.sp,
|
|
122
|
-
lineHeight = 24.sp,
|
|
123
|
-
fontWeight = fontWeight.value
|
|
124
|
-
),
|
|
125
|
-
visualTransformation = CustomConverter(),
|
|
126
|
-
keyboardOptions = KeyboardOptions.Default.copy(keyboardType = keyboardType),
|
|
127
|
-
modifier = Modifier.height(size.values.height).onFocusChanged {
|
|
128
|
-
isFocused = it.isFocused
|
|
129
|
-
if (it.isFocused) {
|
|
130
|
-
onFocus()
|
|
131
|
-
}
|
|
132
|
-
if (!it.isFocused && isBlurred) onBlur()
|
|
133
|
-
if (it.isFocused && !isBlurred) isBlurred = true
|
|
134
|
-
},
|
|
135
|
-
onValueChange = {
|
|
136
|
-
val numericValue = it.filter { char -> char.isDigit() }
|
|
137
|
-
onChangeText(numericValue)
|
|
138
|
-
},
|
|
139
|
-
decorationBox = { innerTextField ->
|
|
140
|
-
// Floating Icon
|
|
141
|
-
if (floatingValue.isNotEmpty() || floatingIcon.isNotEmpty()) {
|
|
142
|
-
Box(
|
|
143
|
-
modifier = Modifier.wrapContentSize()
|
|
144
|
-
.offset(y = (-size.values.height / 2), x = (Spacing.S))
|
|
145
|
-
.background(AppTheme.current.colors.background.surface)
|
|
146
|
-
.zIndex(10f),
|
|
147
|
-
) {
|
|
148
|
-
Row(
|
|
149
|
-
modifier = Modifier.padding(horizontal = Spacing.S),
|
|
150
|
-
) {
|
|
151
|
-
Text(
|
|
152
|
-
floatingValue,
|
|
153
|
-
style = Typography.labelSMedium,
|
|
154
|
-
color = floatingTitleColor
|
|
155
|
-
)
|
|
156
|
-
if (required) {
|
|
157
|
-
Text(
|
|
158
|
-
"*",
|
|
159
|
-
style = Typography.labelSMedium,
|
|
160
|
-
color = AppTheme.current.colors.error.primary,
|
|
161
|
-
)
|
|
162
|
-
}
|
|
163
|
-
if (floatingIcon.isNotEmpty()) {
|
|
164
|
-
Icon(
|
|
165
|
-
source = floatingIcon,
|
|
166
|
-
modifier = Modifier.padding(start = Spacing.XS),
|
|
167
|
-
size = 16.dp,
|
|
168
|
-
color = floatingIconTintColor
|
|
169
|
-
)
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
//input box wrapper
|
|
175
|
-
Box(
|
|
176
|
-
modifier = Modifier.fillMaxWidth()
|
|
177
|
-
.border(
|
|
178
|
-
1.dp,
|
|
179
|
-
getBorderColor(isFocused, error, disabled),
|
|
180
|
-
RoundedCornerShape(size.values.borderRadius)
|
|
181
|
-
),
|
|
182
|
-
contentAlignment = Alignment.CenterStart
|
|
183
|
-
) {
|
|
184
|
-
Row(
|
|
185
|
-
modifier = Modifier.padding(horizontal = Spacing.M),
|
|
186
|
-
verticalAlignment = Alignment.CenterVertically
|
|
187
|
-
) {
|
|
188
|
-
//leading icon
|
|
189
|
-
if (leadingIcon.isNotEmpty()) {
|
|
190
|
-
Icon(
|
|
191
|
-
source = leadingIcon,
|
|
192
|
-
modifier = Modifier.padding(end = Spacing.XS),
|
|
193
|
-
size = if (size.name == InputSize.SMALL.name) 24.dp else 32.dp,
|
|
194
|
-
color = leadingIconColor
|
|
195
|
-
)
|
|
196
|
-
}
|
|
197
|
-
Box(Modifier.weight(9f).padding(start = 0.dp)) {
|
|
198
|
-
if (text.value.isEmpty()) {
|
|
199
|
-
Text(
|
|
200
|
-
text = placeholder,
|
|
201
|
-
style = TextStyle(
|
|
202
|
-
fontSize = 20.sp,
|
|
203
|
-
lineHeight = 24.sp,
|
|
204
|
-
fontWeight = fontWeight.value
|
|
205
|
-
),
|
|
206
|
-
color = placeholderColor
|
|
207
|
-
)
|
|
208
|
-
} else {
|
|
209
|
-
innerTextField()
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
if (isFocused && text.value.isNotEmpty()) {
|
|
213
|
-
Row {
|
|
214
|
-
Spacer(Modifier.width(Spacing.XS))
|
|
215
|
-
Icon(
|
|
216
|
-
source = "24_navigation_close_circle_full",
|
|
217
|
-
size = 16.dp,
|
|
218
|
-
color = AppTheme.current.colors.text.hint,
|
|
219
|
-
modifier = Modifier.clickable(
|
|
220
|
-
onClick = { text.value = "" },
|
|
221
|
-
interactionSource = remember { MutableInteractionSource() },
|
|
222
|
-
indication = null
|
|
223
|
-
)
|
|
224
|
-
)
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
RenderRightIcon(loading, icon, iconTintColor, onPressIcon)
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
|
-
)
|
|
232
|
-
ErrorView(error, errorSpacing, "")
|
|
233
|
-
}
|
|
234
|
-
}
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
package vn.momo.kits.components
|
|
2
|
-
|
|
3
|
-
import androidx.compose.animation.core.LinearEasing
|
|
4
|
-
import androidx.compose.animation.core.RepeatMode
|
|
5
|
-
import androidx.compose.animation.core.animateFloat
|
|
6
|
-
import androidx.compose.animation.core.infiniteRepeatable
|
|
7
|
-
import androidx.compose.animation.core.rememberInfiniteTransition
|
|
8
|
-
import androidx.compose.animation.core.tween
|
|
9
|
-
import androidx.compose.foundation.background
|
|
10
|
-
import androidx.compose.foundation.border
|
|
11
|
-
import androidx.compose.foundation.clickable
|
|
12
|
-
import androidx.compose.foundation.layout.Arrangement
|
|
13
|
-
import androidx.compose.foundation.layout.Box
|
|
14
|
-
import androidx.compose.foundation.layout.Column
|
|
15
|
-
import androidx.compose.foundation.layout.Row
|
|
16
|
-
import androidx.compose.foundation.layout.Spacer
|
|
17
|
-
import androidx.compose.foundation.layout.fillMaxWidth
|
|
18
|
-
import androidx.compose.foundation.layout.height
|
|
19
|
-
import androidx.compose.foundation.layout.offset
|
|
20
|
-
import androidx.compose.foundation.layout.padding
|
|
21
|
-
import androidx.compose.foundation.layout.size
|
|
22
|
-
import androidx.compose.foundation.layout.width
|
|
23
|
-
import androidx.compose.foundation.layout.wrapContentSize
|
|
24
|
-
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
25
|
-
import androidx.compose.foundation.text.BasicTextField
|
|
26
|
-
import androidx.compose.foundation.text.KeyboardOptions
|
|
27
|
-
import androidx.compose.runtime.Composable
|
|
28
|
-
import androidx.compose.runtime.getValue
|
|
29
|
-
import androidx.compose.runtime.mutableStateOf
|
|
30
|
-
import androidx.compose.runtime.remember
|
|
31
|
-
import androidx.compose.runtime.setValue
|
|
32
|
-
import androidx.compose.ui.Alignment
|
|
33
|
-
import androidx.compose.ui.Modifier
|
|
34
|
-
import androidx.compose.ui.focus.onFocusChanged
|
|
35
|
-
import androidx.compose.ui.text.input.KeyboardType
|
|
36
|
-
import androidx.compose.ui.unit.dp
|
|
37
|
-
import androidx.compose.ui.zIndex
|
|
38
|
-
import vn.momo.kits.const.AppTheme
|
|
39
|
-
import vn.momo.kits.const.Colors
|
|
40
|
-
import vn.momo.kits.const.Radius
|
|
41
|
-
import vn.momo.kits.const.Spacing
|
|
42
|
-
import vn.momo.kits.const.Typography
|
|
43
|
-
import vn.momo.kits.const.scaleSize
|
|
44
|
-
|
|
45
|
-
@Composable
|
|
46
|
-
fun OTPCaret() {
|
|
47
|
-
val duration = 500
|
|
48
|
-
val backgroundColor = AppTheme.current.colors.primary
|
|
49
|
-
|
|
50
|
-
val infiniteTransition = rememberInfiniteTransition()
|
|
51
|
-
val alpha by infiniteTransition.animateFloat(
|
|
52
|
-
initialValue = 1f,
|
|
53
|
-
targetValue = 0f,
|
|
54
|
-
animationSpec = infiniteRepeatable(
|
|
55
|
-
animation = tween(
|
|
56
|
-
durationMillis = duration,
|
|
57
|
-
delayMillis = duration,
|
|
58
|
-
easing = LinearEasing
|
|
59
|
-
),
|
|
60
|
-
repeatMode = RepeatMode.Reverse
|
|
61
|
-
)
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
Row(verticalAlignment = Alignment.CenterVertically) {
|
|
65
|
-
Box(
|
|
66
|
-
modifier = Modifier
|
|
67
|
-
.size(1.dp, scaleSize(12f).dp)
|
|
68
|
-
.background(backgroundColor.copy(alpha = alpha))
|
|
69
|
-
)
|
|
70
|
-
Text(
|
|
71
|
-
text = "-",
|
|
72
|
-
color = AppTheme.current.colors.text.hint,
|
|
73
|
-
style = Typography.descriptionDefaultRegular
|
|
74
|
-
)
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
@Composable
|
|
79
|
-
fun InputOTP(
|
|
80
|
-
value: String = "",
|
|
81
|
-
length: Int? = null,
|
|
82
|
-
errorMessage: String = "",
|
|
83
|
-
errorSpacing: Boolean = false,
|
|
84
|
-
floatingValue: String = "Label",
|
|
85
|
-
placeholder: String = "",
|
|
86
|
-
onChangeText: (String) -> Unit,
|
|
87
|
-
onFocus: () -> Unit = {},
|
|
88
|
-
onBlur: () -> Unit = {},
|
|
89
|
-
dataType: String = "number",
|
|
90
|
-
modifier: Modifier = Modifier
|
|
91
|
-
) {
|
|
92
|
-
val maxLength = length ?: 10
|
|
93
|
-
var isFocused by remember { mutableStateOf(false) }
|
|
94
|
-
var isBlurred = false
|
|
95
|
-
|
|
96
|
-
val handleChangeText: (String) -> Unit = { text ->
|
|
97
|
-
if (text.length <= maxLength &&
|
|
98
|
-
(dataType != "number" || !text.any { !it.isDigit() }) &&
|
|
99
|
-
(text.length < value.length || value.length < text.length)
|
|
100
|
-
) {
|
|
101
|
-
onChangeText(text)
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
fun onClearText(){
|
|
106
|
-
handleChangeText("")
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
Column {
|
|
111
|
-
BasicTextField(
|
|
112
|
-
value = value,
|
|
113
|
-
onValueChange = handleChangeText,
|
|
114
|
-
singleLine = true,
|
|
115
|
-
keyboardOptions = KeyboardOptions.Default.copy(keyboardType = if (dataType == "number") KeyboardType.Number else KeyboardType.Ascii),
|
|
116
|
-
modifier = modifier.height(56.dp).onFocusChanged {
|
|
117
|
-
isFocused = it.isFocused
|
|
118
|
-
if (it.isFocused) {
|
|
119
|
-
onFocus()
|
|
120
|
-
}
|
|
121
|
-
if (!it.isFocused && isBlurred) onBlur()
|
|
122
|
-
if (it.isFocused && !isBlurred) isBlurred = true
|
|
123
|
-
},
|
|
124
|
-
decorationBox = { _ ->
|
|
125
|
-
Box {
|
|
126
|
-
if (floatingValue.isNotEmpty()) {
|
|
127
|
-
Box(
|
|
128
|
-
modifier = Modifier.wrapContentSize()
|
|
129
|
-
.offset(y = ((-56).dp / 2))
|
|
130
|
-
.align(Alignment.Center)
|
|
131
|
-
.background(AppTheme.current.colors.background.surface)
|
|
132
|
-
.zIndex(10f),
|
|
133
|
-
) {
|
|
134
|
-
Row(
|
|
135
|
-
modifier = Modifier
|
|
136
|
-
.padding(horizontal = Spacing.S),
|
|
137
|
-
verticalAlignment = Alignment.Bottom
|
|
138
|
-
) {
|
|
139
|
-
Text(
|
|
140
|
-
floatingValue,
|
|
141
|
-
style = Typography.labelSMedium,
|
|
142
|
-
color = AppTheme.current.colors.text.hint
|
|
143
|
-
)
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
Box(
|
|
148
|
-
modifier = Modifier
|
|
149
|
-
.fillMaxWidth()
|
|
150
|
-
.height(56.dp)
|
|
151
|
-
.border(
|
|
152
|
-
1.dp,
|
|
153
|
-
getBorderColor(isFocused, errorMessage, false),
|
|
154
|
-
RoundedCornerShape(
|
|
155
|
-
Radius.S
|
|
156
|
-
)
|
|
157
|
-
), contentAlignment = Alignment.Center
|
|
158
|
-
) {
|
|
159
|
-
Row(
|
|
160
|
-
modifier = Modifier.padding(vertical = 8.dp),
|
|
161
|
-
horizontalArrangement = Arrangement.SpaceBetween,
|
|
162
|
-
verticalAlignment = Alignment.CenterVertically
|
|
163
|
-
) {
|
|
164
|
-
if (length != null) {
|
|
165
|
-
for (i in 0 until length) {
|
|
166
|
-
if (isFocused && value.length == i) {
|
|
167
|
-
OTPCaret()
|
|
168
|
-
} else {
|
|
169
|
-
val textColor =
|
|
170
|
-
if (value.getOrNull(i) != null) AppTheme.current.colors.text.default else AppTheme.current.colors.text.hint
|
|
171
|
-
val typo =
|
|
172
|
-
if (value.getOrNull(i) != null) Typography.headerDefaultBold else Typography.descriptionDefaultRegular
|
|
173
|
-
Text(
|
|
174
|
-
text = value.getOrNull(i)?.toString() ?: "-",
|
|
175
|
-
color = textColor,
|
|
176
|
-
style = typo
|
|
177
|
-
)
|
|
178
|
-
}
|
|
179
|
-
if (i != length - 1) Spacer(Modifier.width(Spacing.L))
|
|
180
|
-
}
|
|
181
|
-
} else {
|
|
182
|
-
if (value.isEmpty() && !isFocused && placeholder.isNotEmpty()) {
|
|
183
|
-
return@BasicTextField Text(
|
|
184
|
-
text = placeholder,
|
|
185
|
-
color = AppTheme.current.colors.text.hint
|
|
186
|
-
)
|
|
187
|
-
} else {
|
|
188
|
-
for (i in value.indices) {
|
|
189
|
-
Text(
|
|
190
|
-
style = Typography.headerDefaultBold,
|
|
191
|
-
text = value[i].toString()
|
|
192
|
-
)
|
|
193
|
-
if (i != value.length - 1 || (isFocused && value.length != MAX_LENGTH)) {
|
|
194
|
-
Spacer(Modifier.width(Spacing.L))
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
if (isFocused && value.length != MAX_LENGTH) OTPCaret()
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
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
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
)
|
|
221
|
-
ErrorView(errorMessage, errorSpacing, "")
|
|
222
|
-
}
|
|
223
|
-
}
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
package vn.momo.kits.components
|
|
2
|
-
|
|
3
|
-
import androidx.compose.foundation.background
|
|
4
|
-
import androidx.compose.foundation.border
|
|
5
|
-
import androidx.compose.foundation.clickable
|
|
6
|
-
import androidx.compose.foundation.interaction.MutableInteractionSource
|
|
7
|
-
import androidx.compose.foundation.layout.Box
|
|
8
|
-
import androidx.compose.foundation.layout.Column
|
|
9
|
-
import androidx.compose.foundation.layout.Row
|
|
10
|
-
import androidx.compose.foundation.layout.fillMaxWidth
|
|
11
|
-
import androidx.compose.foundation.layout.height
|
|
12
|
-
import androidx.compose.foundation.layout.padding
|
|
13
|
-
import androidx.compose.foundation.layout.size
|
|
14
|
-
import androidx.compose.foundation.layout.width
|
|
15
|
-
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
16
|
-
import androidx.compose.foundation.text.BasicTextField
|
|
17
|
-
import androidx.compose.foundation.text.KeyboardOptions
|
|
18
|
-
import androidx.compose.runtime.Composable
|
|
19
|
-
import androidx.compose.runtime.MutableState
|
|
20
|
-
import androidx.compose.runtime.getValue
|
|
21
|
-
import androidx.compose.runtime.mutableStateOf
|
|
22
|
-
import androidx.compose.runtime.remember
|
|
23
|
-
import androidx.compose.runtime.setValue
|
|
24
|
-
import androidx.compose.ui.Alignment
|
|
25
|
-
import androidx.compose.ui.Modifier
|
|
26
|
-
import androidx.compose.ui.focus.onFocusChanged
|
|
27
|
-
import androidx.compose.ui.graphics.Color
|
|
28
|
-
import androidx.compose.ui.graphics.SolidColor
|
|
29
|
-
import androidx.compose.ui.layout.ContentScale
|
|
30
|
-
import androidx.compose.ui.text.TextStyle
|
|
31
|
-
import androidx.compose.ui.text.input.KeyboardType
|
|
32
|
-
import androidx.compose.ui.unit.Dp
|
|
33
|
-
import androidx.compose.ui.unit.dp
|
|
34
|
-
import vn.momo.kits.const.AppTheme
|
|
35
|
-
import vn.momo.kits.const.Colors
|
|
36
|
-
import vn.momo.kits.const.Radius
|
|
37
|
-
import vn.momo.kits.const.Spacing
|
|
38
|
-
import vn.momo.kits.const.Typography
|
|
39
|
-
import vn.momo.kits.modifier.setAutomationId
|
|
40
|
-
|
|
41
|
-
data class InputPhoneNumberSizeDetail(
|
|
42
|
-
val borderWidth: Dp,
|
|
43
|
-
val borderRadius: Dp,
|
|
44
|
-
val height: Dp,
|
|
45
|
-
val textStyle: TextStyle,
|
|
46
|
-
val dividerHeight: Dp,
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
enum class InputPhoneNumberSize(val values: InputPhoneNumberSizeDetail) {
|
|
50
|
-
SMALL(
|
|
51
|
-
InputPhoneNumberSizeDetail(
|
|
52
|
-
borderWidth = 1.dp,
|
|
53
|
-
borderRadius = Radius.S,
|
|
54
|
-
height = 48.dp,
|
|
55
|
-
textStyle = Typography.headerSSemibold,
|
|
56
|
-
dividerHeight = 24.dp
|
|
57
|
-
)
|
|
58
|
-
),
|
|
59
|
-
LARGE(
|
|
60
|
-
InputPhoneNumberSizeDetail(
|
|
61
|
-
borderWidth = 1.dp,
|
|
62
|
-
borderRadius = Radius.S,
|
|
63
|
-
height = 56.dp,
|
|
64
|
-
textStyle = Typography.headerMBold,
|
|
65
|
-
dividerHeight = 32.dp
|
|
66
|
-
)
|
|
67
|
-
)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
@Composable
|
|
71
|
-
fun getBorderColor(isFocused: Boolean, error: String): Color {
|
|
72
|
-
val theme = AppTheme.current
|
|
73
|
-
return remember(isFocused, error, theme) {
|
|
74
|
-
when {
|
|
75
|
-
error.isNotEmpty() -> theme.colors.error.primary
|
|
76
|
-
isFocused -> theme.colors.primary
|
|
77
|
-
else -> theme.colors.border.default
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
@Composable
|
|
83
|
-
fun InputPhoneNumber(
|
|
84
|
-
text: MutableState<String> = remember { mutableStateOf("") },
|
|
85
|
-
placeholder: String = "0123456789",
|
|
86
|
-
size: InputPhoneNumberSize = InputPhoneNumberSize.SMALL,
|
|
87
|
-
onChangeText: (String) -> Unit = {},
|
|
88
|
-
hintText: String = "",
|
|
89
|
-
error: String = "",
|
|
90
|
-
errorSpacing: Boolean = false,
|
|
91
|
-
icon: String = "",
|
|
92
|
-
iconColor: Color = AppTheme.current.colors.text.default,
|
|
93
|
-
onRightIconPressed: () -> Unit = {},
|
|
94
|
-
onFocus: () -> Unit = {},
|
|
95
|
-
onBlur: () -> Unit = {},
|
|
96
|
-
loading: Boolean = false,
|
|
97
|
-
modifier: Modifier = Modifier,
|
|
98
|
-
) {
|
|
99
|
-
// Consolidated state management
|
|
100
|
-
var inputState by remember { mutableStateOf(InputState()) }
|
|
101
|
-
|
|
102
|
-
// Memoized color calculations
|
|
103
|
-
val theme = AppTheme.current
|
|
104
|
-
val colors = remember( theme) {
|
|
105
|
-
Triple(
|
|
106
|
-
theme.colors.text.default, // textColor
|
|
107
|
-
theme.colors.text.hint, // placeholderColor
|
|
108
|
-
iconColor // iconTintColor
|
|
109
|
-
)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
val (textColor, placeholderColor, iconTintColor) = colors
|
|
113
|
-
|
|
114
|
-
val testId = "input_phone_number"
|
|
115
|
-
|
|
116
|
-
val textStyle = remember(textColor) {
|
|
117
|
-
size.values.textStyle.merge(TextStyle(
|
|
118
|
-
color = textColor,
|
|
119
|
-
))
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
val placeholderStyle = remember(placeholderColor) {
|
|
123
|
-
|
|
124
|
-
size.values.textStyle.merge(TextStyle(
|
|
125
|
-
color = placeholderColor
|
|
126
|
-
))
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
Column(modifier = modifier.setAutomationId(testId)) {
|
|
130
|
-
BasicTextField(
|
|
131
|
-
singleLine = true,
|
|
132
|
-
value = text.value,
|
|
133
|
-
textStyle = textStyle,
|
|
134
|
-
keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Number),
|
|
135
|
-
cursorBrush = SolidColor(AppTheme.current.colors.primary),
|
|
136
|
-
modifier = Modifier
|
|
137
|
-
.height(size.values.height)
|
|
138
|
-
.onFocusChanged { focusState ->
|
|
139
|
-
val wasFocused = inputState.isFocused
|
|
140
|
-
inputState = inputState.copy(
|
|
141
|
-
isFocused = focusState.isFocused,
|
|
142
|
-
hasBeenBlurred = inputState.hasBeenBlurred || wasFocused
|
|
143
|
-
)
|
|
144
|
-
|
|
145
|
-
if (focusState.isFocused) {
|
|
146
|
-
onFocus()
|
|
147
|
-
} else if (inputState.hasBeenBlurred) {
|
|
148
|
-
onBlur()
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
onValueChange = onChangeText,
|
|
152
|
-
decorationBox = { innerTextField ->
|
|
153
|
-
// Input container
|
|
154
|
-
Box(
|
|
155
|
-
modifier = Modifier
|
|
156
|
-
.fillMaxWidth()
|
|
157
|
-
.border(
|
|
158
|
-
if(inputState.isFocused) 1.5.dp else 1.dp,
|
|
159
|
-
getBorderColor(inputState.isFocused, error),
|
|
160
|
-
RoundedCornerShape(size.values.borderRadius)
|
|
161
|
-
),
|
|
162
|
-
contentAlignment = Alignment.CenterStart
|
|
163
|
-
) {
|
|
164
|
-
Row(
|
|
165
|
-
modifier = Modifier.padding(horizontal = Spacing.M),
|
|
166
|
-
verticalAlignment = Alignment.CenterVertically
|
|
167
|
-
) {
|
|
168
|
-
// Leading icon
|
|
169
|
-
Image(
|
|
170
|
-
source = "https://static.momocdn.net/app/img/icon/ic-qrcode-package/ic_vn_flag.png",
|
|
171
|
-
modifier = Modifier.size(24.dp).padding(end = Spacing.XS),
|
|
172
|
-
options = Options(
|
|
173
|
-
contentScale = ContentScale.Fit,
|
|
174
|
-
alignment = Alignment.Center
|
|
175
|
-
)
|
|
176
|
-
)
|
|
177
|
-
|
|
178
|
-
Text(
|
|
179
|
-
"+84",
|
|
180
|
-
color = textColor,
|
|
181
|
-
style = textStyle,
|
|
182
|
-
)
|
|
183
|
-
|
|
184
|
-
// Divider
|
|
185
|
-
Box(modifier = Modifier.padding(horizontal = Spacing.M)) {
|
|
186
|
-
Box(
|
|
187
|
-
modifier = Modifier.width(1.dp)
|
|
188
|
-
.height(size.values.dividerHeight)
|
|
189
|
-
.background(Colors.black_04)
|
|
190
|
-
)
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
Box(Modifier.weight(1f)) {
|
|
195
|
-
if (text.value.isEmpty()) {
|
|
196
|
-
Text(
|
|
197
|
-
text = placeholder,
|
|
198
|
-
style = placeholderStyle,
|
|
199
|
-
color = placeholderColor,
|
|
200
|
-
modifier = Modifier.align(Alignment.CenterStart)
|
|
201
|
-
)
|
|
202
|
-
}
|
|
203
|
-
innerTextField()
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
// Clear button
|
|
207
|
-
if (inputState.isFocused && text.value.isNotEmpty()) {
|
|
208
|
-
Row {
|
|
209
|
-
Icon(
|
|
210
|
-
source = "24_navigation_close_circle_full",
|
|
211
|
-
size = 16.dp,
|
|
212
|
-
color = theme.colors.text.hint,
|
|
213
|
-
modifier = Modifier.clickable(
|
|
214
|
-
onClick = { text.value = "" },
|
|
215
|
-
interactionSource = remember { MutableInteractionSource() },
|
|
216
|
-
indication = null
|
|
217
|
-
)
|
|
218
|
-
.padding(horizontal = Spacing.S)
|
|
219
|
-
)
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// Right icon (password toggle or custom icon)
|
|
224
|
-
RenderRightIcon(loading, icon, iconTintColor, onRightIconPressed)
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
)
|
|
229
|
-
// Error/hint display
|
|
230
|
-
ErrorView(error, errorSpacing, hintText)
|
|
231
|
-
}
|
|
232
|
-
}
|