@momo-kits/native-kits 0.152.4-scale.4 → 0.152.5-klib.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.
Files changed (117) hide show
  1. package/README.md +175 -5
  2. package/ios/native-kits.podspec +18 -16
  3. package/package.json +2 -4
  4. package/CODE_OF_CONDUCT.md +0 -133
  5. package/CONTRIBUTING.md +0 -114
  6. package/LICENSE +0 -20
  7. package/build.gradle.kts +0 -32
  8. package/compose/MoMoComposeKits.podspec +0 -54
  9. package/compose/build.gradle.kts +0 -149
  10. package/compose/src/androidMain/AndroidManifest.xml +0 -2
  11. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -105
  12. package/compose/src/commonMain/composeResources/files/lottie_circle_loader.json +0 -1
  13. package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
  14. package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
  15. package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
  16. package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
  17. package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
  18. package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
  19. package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
  20. package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
  21. package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
  22. package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
  23. package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
  24. package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
  25. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
  26. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -57
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -201
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -222
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -48
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -308
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -715
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -214
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -404
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -78
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -27
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -334
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -345
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -90
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -133
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -543
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -23
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -69
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -143
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -179
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -111
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -395
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -164
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -234
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -226
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -227
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -241
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -235
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -364
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -50
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -34
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -85
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -33
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -338
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -95
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -64
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -89
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -91
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -91
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -208
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -172
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -199
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -237
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -191
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -306
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -13
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -189
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -293
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -2
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -35
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -2
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -59
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -68
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -49
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -232
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -111
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -94
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -159
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -302
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScaleSizeScope.kt +0 -22
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -483
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -169
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -217
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -180
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -251
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -80
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -306
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -31
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -385
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -125
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -38
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -62
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -88
  111. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -144
  112. package/gradle.properties +0 -19
  113. package/gradlew +0 -240
  114. package/gradlew.bat +0 -91
  115. package/ios/Theme.md +0 -18
  116. package/local.properties +0 -8
  117. package/settings.gradle.kts +0 -25
@@ -1,241 +0,0 @@
1
- package vn.momo.kits.components
2
-
3
- import androidx.compose.foundation.background
4
- import androidx.compose.foundation.clickable
5
- import androidx.compose.foundation.interaction.MutableInteractionSource
6
- import androidx.compose.foundation.layout.Arrangement
7
- import androidx.compose.foundation.layout.Box
8
- import androidx.compose.foundation.layout.Row
9
- import androidx.compose.foundation.layout.Spacer
10
- import androidx.compose.foundation.layout.fillMaxHeight
11
- import androidx.compose.foundation.layout.fillMaxWidth
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.layout.wrapContentHeight
16
- import androidx.compose.foundation.shape.RoundedCornerShape
17
- import androidx.compose.foundation.text.BasicTextField
18
- import androidx.compose.foundation.text.KeyboardActions
19
- import androidx.compose.foundation.text.KeyboardOptions
20
- import androidx.compose.material3.CircularProgressIndicator
21
- import androidx.compose.runtime.Composable
22
- import androidx.compose.runtime.MutableState
23
- import androidx.compose.runtime.getValue
24
- import androidx.compose.runtime.mutableStateOf
25
- import androidx.compose.runtime.remember
26
- import androidx.compose.runtime.setValue
27
- import androidx.compose.ui.Alignment
28
- import androidx.compose.ui.Modifier
29
- import androidx.compose.ui.focus.onFocusChanged
30
- import androidx.compose.ui.graphics.Color
31
- import androidx.compose.ui.text.TextStyle
32
- import androidx.compose.ui.text.input.KeyboardType
33
- import androidx.compose.ui.text.style.TextOverflow
34
- import androidx.compose.ui.unit.Dp
35
- import androidx.compose.ui.unit.dp
36
- import androidx.compose.ui.unit.sp
37
- import vn.momo.kits.const.AppTheme
38
- import vn.momo.kits.const.Colors
39
- import vn.momo.kits.const.Radius
40
- import vn.momo.kits.const.Spacing
41
- import vn.momo.kits.const.Typography
42
- import vn.momo.kits.const.scaleSize
43
- import vn.momo.kits.navigation.ScaleSizeScope
44
- import vn.momo.kits.utils.ifTrue
45
-
46
- @Composable
47
- fun RenderRightIconSearch(
48
- loading: Boolean,
49
- icon: String,
50
- color: Color,
51
- onClick: () -> Unit,
52
- iconModifier: Modifier = Modifier
53
- ) {
54
- if (loading) {
55
- Box(Modifier.padding(horizontal = Spacing.S)) {
56
- CircularProgressIndicator(
57
- modifier = Modifier.size(16.dp),
58
- color = color,
59
- trackColor = Color.Transparent,
60
- strokeWidth = 2.dp
61
- )
62
- }
63
- }
64
- if (icon.isNotEmpty()) {
65
- Spacer(
66
- Modifier.padding(start = Spacing.S).width(1.dp).fillMaxHeight()
67
- .background(AppTheme.current.colors.primary)
68
- )
69
- Icon(
70
- source = icon,
71
- color = color,
72
- size = 24.dp,
73
- modifier = iconModifier.padding(start = Spacing.S, end = 0.dp).clickable(
74
- onClick = onClick,
75
- interactionSource = remember { MutableInteractionSource() },
76
- indication = null
77
- )
78
- )
79
- }
80
- }
81
-
82
- data class InputSearchProps(
83
- val text: MutableState<String>,
84
- val buttonText: String = "",
85
- val showButtonText: Boolean = false,
86
- val placeholder: String = "",
87
- val onChangeText: (String) -> Unit = {},
88
- val onPressButtonText: () -> Unit = {},
89
- val disabled: Boolean = false,
90
- val icon: String = "",
91
- val iconColor: Color = Color(0xff),
92
- val onRightIconPressed: () -> Unit = {},
93
- val onFocus: () -> Unit = {},
94
- val onBlur: () -> Unit = {},
95
- val loading: Boolean = false,
96
- val fontWeight: InputFontWeight = InputFontWeight.REGULAR,
97
- val keyboardType: KeyboardType = KeyboardType.Text,
98
- val backgroundColor: Color = Colors.black_01,
99
- val clearCondition: (() -> Boolean)? = null,
100
- val keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
101
- val keyboardActions: KeyboardActions = KeyboardActions.Default,
102
- val modifier: Modifier = Modifier,
103
- val iconModifier: Modifier = Modifier,
104
- val onClearPress: () -> Unit = {},
105
- val leftPosition: Dp? = null,
106
- )
107
-
108
- @Composable
109
- fun InputSearch(
110
- inputSearchProps: InputSearchProps = InputSearchProps(
111
- text = remember { mutableStateOf("") },
112
- iconColor = AppTheme.current.colors.text.default
113
- ),
114
- ) {
115
- var isFocused by remember { mutableStateOf(false) }
116
- var isBlurred = false
117
- val disabledColor = AppTheme.current.colors.text.disable
118
- var textColor = AppTheme.current.colors.text.default
119
- var placeholderColor = AppTheme.current.colors.text.hint
120
- var iconTintColor = inputSearchProps.iconColor
121
-
122
- if (inputSearchProps.disabled) {
123
- textColor = disabledColor
124
- placeholderColor = disabledColor
125
- iconTintColor = disabledColor
126
- }
127
-
128
- val fontSize = scaleSize(14.sp)
129
-
130
- val textStyle = remember(textColor, inputSearchProps.fontWeight.value) {
131
- TextStyle(
132
- color = textColor,
133
- fontSize = fontSize,
134
- fontWeight = inputSearchProps.fontWeight.value
135
- )
136
- }
137
-
138
- Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth()) {
139
- BasicTextField(
140
- enabled = !inputSearchProps.disabled,
141
- singleLine = true,
142
- value = inputSearchProps.text.value,
143
- textStyle = textStyle,
144
- keyboardOptions = inputSearchProps.keyboardOptions.copy(keyboardType = inputSearchProps.keyboardType),
145
- keyboardActions = inputSearchProps.keyboardActions,
146
- modifier = inputSearchProps.modifier.weight(1f).wrapContentHeight().onFocusChanged {
147
- isFocused = it.isFocused
148
- if (it.isFocused) {
149
- inputSearchProps.onFocus()
150
- }
151
- if (!it.isFocused && isBlurred) inputSearchProps.onBlur()
152
- if (it.isFocused && !isBlurred) isBlurred = true
153
- },
154
- onValueChange = inputSearchProps.onChangeText,
155
- decorationBox = { innerTextField ->
156
- Row(verticalAlignment = Alignment.CenterVertically) {
157
- Row(
158
- modifier = Modifier.weight(
159
- inputSearchProps.showButtonText.ifTrue(
160
- 8f,
161
- 1f
162
- )
163
- )
164
- .background(
165
- inputSearchProps.backgroundColor,
166
- RoundedCornerShape(Radius.XL)
167
- ),
168
- horizontalArrangement = Arrangement.Start,
169
- verticalAlignment = Alignment.CenterVertically
170
- ) {
171
- Row(
172
- modifier = Modifier.padding(
173
- horizontal = Spacing.M,
174
- vertical = Spacing.S
175
- ),
176
- verticalAlignment = Alignment.CenterVertically
177
- ) {
178
- Icon(
179
- source = "navigation_search",
180
- modifier = Modifier.padding(end = Spacing.XS),
181
- size = 24.dp,
182
- color = AppTheme.current.colors.text.hint
183
- )
184
- Box(Modifier.weight(1f)) {
185
- if (inputSearchProps.text.value.isEmpty()) {
186
- ScaleSizeScope(disableScale = true) {
187
- Text(
188
- text = inputSearchProps.placeholder,
189
- style = textStyle,
190
- maxLines = 1,
191
- color = placeholderColor,
192
- overflow = TextOverflow.Ellipsis
193
- )
194
- }
195
- }
196
- innerTextField()
197
- }
198
- if (inputSearchProps.clearCondition?.invoke() == true || (isFocused && inputSearchProps.text.value.isNotEmpty())) {
199
- Row {
200
- Spacer(Modifier.width(Spacing.XS))
201
- Icon(
202
- source = "24_navigation_close_circle_full",
203
- size = 16.dp,
204
- color = AppTheme.current.colors.text.hint,
205
- modifier = Modifier.clickable(
206
- onClick = {
207
- inputSearchProps.text.value = ""
208
- inputSearchProps.onClearPress.invoke()
209
- },
210
- interactionSource = remember { MutableInteractionSource() },
211
- indication = null
212
- )
213
- )
214
- }
215
- }
216
- RenderRightIconSearch(
217
- inputSearchProps.loading,
218
- inputSearchProps.icon,
219
- iconTintColor,
220
- inputSearchProps.onRightIconPressed,
221
- iconModifier = inputSearchProps.iconModifier
222
- )
223
- }
224
- }
225
- }
226
- },
227
- )
228
- if (inputSearchProps.showButtonText) {
229
- Text(
230
- text = inputSearchProps.buttonText,
231
- style = Typography.actionDefaultBold,
232
- color = AppTheme.current.colors.text.default,
233
- modifier = Modifier.padding(start = Spacing.L).clickable(
234
- interactionSource = remember { MutableInteractionSource() },
235
- indication = null,
236
- onClick = inputSearchProps.onPressButtonText
237
- )
238
- )
239
- }
240
- }
241
- }
@@ -1,235 +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.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 androidx.compose.ui.unit.sp
35
- import androidx.compose.ui.zIndex
36
- import vn.momo.kits.const.AppTheme
37
- import vn.momo.kits.const.Spacing
38
- import vn.momo.kits.const.Typography
39
- import vn.momo.kits.const.scaleSize
40
- import vn.momo.kits.navigation.ScaleSizeScope
41
-
42
- const val MAX_LENGTH = 300
43
- val DEFAULT_HEIGHT = 104.dp
44
-
45
- @Composable
46
- fun InputTextArea(
47
- text: MutableState<String> = remember { mutableStateOf("") },
48
- maxLength: Int = MAX_LENGTH,
49
- height: Dp = DEFAULT_HEIGHT,
50
- floatingValue: String = "",
51
- floatingValueColor: Color = AppTheme.current.colors.text.hint,
52
- floatingIcon: String = "",
53
- floatingIconColor: Color = AppTheme.current.colors.text.default,
54
- placeholder: String = "",
55
- size: InputSize = InputSize.SMALL,
56
- onChangeText: (String) -> Unit = {},
57
- error: String = "",
58
- errorSpacing: Boolean = false,
59
- disabled: Boolean = false,
60
- icon: String = "",
61
- iconColor: Color = AppTheme.current.colors.text.default,
62
- onRightIconPressed: () -> Unit = {},
63
- onFocus: () -> Unit = {},
64
- onBlur: () -> Unit = {},
65
- loading: Boolean = false,
66
- required: Boolean = false,
67
- fontWeight: InputFontWeight = InputFontWeight.REGULAR,
68
- keyboardType: KeyboardType = KeyboardType.Text,
69
- ) {
70
- var isFocused by remember { mutableStateOf(false) }
71
- var isBlurred = false
72
- val disabledColor = AppTheme.current.colors.text.disable
73
- var textColor = AppTheme.current.colors.text.default
74
- var placeholderColor = AppTheme.current.colors.text.hint
75
- var iconTintColor = iconColor
76
- val floatingTitleColor = when {
77
- disabled -> AppTheme.current.colors.text.disable
78
- else -> floatingValueColor
79
- }
80
- val floatingIconTintColor = when {
81
- disabled -> AppTheme.current.colors.text.disable
82
- else -> floatingIconColor
83
- }
84
-
85
- if (disabled) {
86
- textColor = disabledColor
87
- placeholderColor = disabledColor
88
- iconTintColor = disabledColor
89
- }
90
-
91
- val fontSize = scaleSize(16.sp)
92
- val lineHeight = scaleSize(24.sp)
93
- val scaleHeight = scaleSize(height)
94
-
95
- Column {
96
- BasicTextField(
97
- enabled = !disabled,
98
- singleLine = false,
99
- value = text.value,
100
- textStyle = TextStyle(
101
- color = textColor,
102
- fontSize = fontSize,
103
- lineHeight = lineHeight,
104
- fontWeight = fontWeight.value
105
- ),
106
- keyboardOptions = KeyboardOptions.Default.copy(keyboardType = keyboardType),
107
- modifier = Modifier.height(scaleHeight).onFocusChanged {
108
- isFocused = it.isFocused
109
- if (it.isFocused) {
110
- onFocus()
111
- }
112
- if (!it.isFocused && isBlurred) onBlur()
113
- if (it.isFocused && !isBlurred) isBlurred = true
114
- },
115
- onValueChange = {
116
- if (it.length <= maxLength) {
117
- onChangeText(it)
118
- }
119
- },
120
- decorationBox = { innerTextField ->
121
- // Floating Icon
122
- if (floatingValue.isNotEmpty() || floatingIcon.isNotEmpty()) {
123
- Box(
124
- modifier = Modifier.wrapContentSize()
125
- .offset(y = (-scaleHeight / 2), x = (Spacing.S))
126
- .background(AppTheme.current.colors.background.surface)
127
- .zIndex(10f),
128
- ) {
129
- Row(
130
- modifier = Modifier
131
- .padding(horizontal = Spacing.S),
132
- verticalAlignment = Alignment.Bottom
133
- ) {
134
- Text(
135
- floatingValue,
136
- style = Typography.labelSMedium,
137
- color = floatingTitleColor
138
- )
139
- if (required) {
140
- Text(
141
- "*",
142
- style = Typography.labelSMedium,
143
- color = AppTheme.current.colors.error.primary,
144
- )
145
- }
146
- if (floatingIcon.isNotEmpty()) {
147
- Icon(
148
- source = floatingIcon,
149
- modifier = Modifier.padding(start = Spacing.XS),
150
- size = 16.dp,
151
- color = floatingIconTintColor
152
- )
153
- }
154
- }
155
- }
156
- }
157
- //input box wrapper
158
- Box(
159
- modifier = Modifier.fillMaxWidth()
160
- .background(
161
- AppTheme.current.colors.background.surface,
162
- RoundedCornerShape(size.values.borderRadius)
163
- )
164
- .border(
165
- 1.dp,
166
- getBorderColor(isFocused, error, disabled),
167
- RoundedCornerShape(size.values.borderRadius)
168
- ),
169
- contentAlignment = Alignment.TopStart
170
- ) {
171
- Column {
172
- Row(
173
- modifier = Modifier.weight(1f).padding(
174
- start = Spacing.M,
175
- end = Spacing.M,
176
- top = Spacing.M
177
- ),
178
- verticalAlignment = Alignment.Top
179
- ) {
180
- Box(Modifier.weight(1f)) {
181
- if (text.value.isEmpty()) {
182
- ScaleSizeScope(disableScale = true) {
183
- Text(
184
- text = placeholder,
185
- style = TextStyle(
186
- fontSize = fontSize,
187
- lineHeight = lineHeight,
188
- fontWeight = fontWeight.value
189
- ),
190
- color = placeholderColor
191
- )
192
- }
193
-
194
- }
195
- innerTextField()
196
- }
197
- if (isFocused && text.value.isNotEmpty()) {
198
- Row {
199
- Spacer(Modifier.width(Spacing.XS))
200
- Icon(
201
- source = "24_navigation_close_circle_full",
202
- size = 16.dp,
203
- color = AppTheme.current.colors.text.hint,
204
- modifier = Modifier.clickable(
205
- onClick = { text.value = "" },
206
- interactionSource = remember { MutableInteractionSource() },
207
- indication = null
208
- )
209
- )
210
- }
211
- }
212
- RenderRightIcon(loading, icon, iconTintColor, onRightIconPressed)
213
- }
214
-
215
- Box(
216
- modifier = Modifier
217
- .fillMaxWidth()
218
- .padding(end = Spacing.M),
219
- contentAlignment = Alignment.CenterEnd
220
- ) {
221
- Text(
222
- "${text.value.length}/$maxLength",
223
- style = Typography.descriptionXsRegular,
224
- color = AppTheme.current.colors.text.hint
225
- )
226
- }
227
- Spacer(Modifier.height(Spacing.M))
228
- }
229
- }
230
- },
231
- )
232
- // show error
233
- ErrorView(error, errorSpacing, "")
234
- }
235
- }