@momo-kits/native-kits 0.117.1 → 0.117.2-beta.2
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/Header.kt +8 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +12 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +22 -10
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +24 -10
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +3 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +9 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +23 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +35 -31
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/{PromotionPopup.kt → PopupPromotion.kt} +15 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +30 -19
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +208 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +3 -3
- package/ios/Application/Components.swift +30 -11
- package/ios/Application/HeaderRight.swift +22 -12
- package/ios/Application/Screen.swift +17 -4
- package/ios/Button/Button.swift +4 -4
- package/ios/Image/Image.swift +2 -2
- package/ios/Popup/PopupDisplay.swift +91 -47
- package/ios/Popup/PopupPromotion.swift +55 -36
- package/local.properties +2 -2
- package/package.json +1 -1
|
@@ -23,6 +23,7 @@ import androidx.compose.runtime.setValue
|
|
|
23
23
|
import androidx.compose.runtime.snapshotFlow
|
|
24
24
|
import androidx.compose.ui.Alignment
|
|
25
25
|
import androidx.compose.ui.Modifier
|
|
26
|
+
import androidx.compose.ui.graphics.Color
|
|
26
27
|
import androidx.compose.ui.graphics.graphicsLayer
|
|
27
28
|
import androidx.compose.ui.semantics.semantics
|
|
28
29
|
import androidx.compose.ui.semantics.testTag
|
|
@@ -53,11 +54,13 @@ fun Header(
|
|
|
53
54
|
scrollState: Int = 0,
|
|
54
55
|
inputSearchProps: InputSearchProps? = null,
|
|
55
56
|
headerRightWidth: Dp = 0.dp,
|
|
56
|
-
useAnimationSearch: Boolean = false
|
|
57
|
+
useAnimationSearch: Boolean = false,
|
|
58
|
+
tintColor: Color? = null
|
|
57
59
|
) {
|
|
58
60
|
val statusBarHeight = AppStatusBar.current ?: getStatusBarHeight()
|
|
59
|
-
val tintIconColor = AppTheme.current.colors.text.default
|
|
60
|
-
val backgroundButton = Colors.black_01.copy(alpha = 0.6f)
|
|
61
|
+
val tintIconColor = tintColor ?: AppTheme.current.colors.text.default
|
|
62
|
+
val backgroundButton = if (tintColor == Colors.black_01) Colors.black_20.copy(alpha = 0.6f) else Colors.black_01.copy(alpha = 0.6f)
|
|
63
|
+
val borderColor = if (tintColor == Colors.black_01) Colors.black_01.copy(alpha = 0.2f) else Colors.black_20.copy(alpha = 0.2f)
|
|
61
64
|
|
|
62
65
|
var colorFraction by remember { mutableStateOf(0f) }
|
|
63
66
|
|
|
@@ -105,7 +108,7 @@ fun Header(
|
|
|
105
108
|
.then(
|
|
106
109
|
Modifier.border(
|
|
107
110
|
0.2.dp,
|
|
108
|
-
|
|
111
|
+
borderColor,
|
|
109
112
|
RoundedCornerShape(100)
|
|
110
113
|
)
|
|
111
114
|
)
|
|
@@ -122,7 +125,7 @@ fun Header(
|
|
|
122
125
|
) {
|
|
123
126
|
Icon(
|
|
124
127
|
source = "arrow-back",
|
|
125
|
-
color =
|
|
128
|
+
color = tintIconColor,
|
|
126
129
|
size = 20.dp,
|
|
127
130
|
)
|
|
128
131
|
}
|
|
@@ -34,6 +34,7 @@ fun animateColor(start: Color, stop: Color, fraction: Float): Color {
|
|
|
34
34
|
fun HeaderBackground(
|
|
35
35
|
headerType: HeaderType = HeaderType.DEFAULT,
|
|
36
36
|
scrollState: Int,
|
|
37
|
+
headerTransparent: Boolean = false,
|
|
37
38
|
) {
|
|
38
39
|
val statusBarHeight = AppStatusBar.current ?: getStatusBarHeight()
|
|
39
40
|
|
|
@@ -42,11 +43,15 @@ fun HeaderBackground(
|
|
|
42
43
|
)
|
|
43
44
|
|
|
44
45
|
val backgroundColor by animateColorAsState(
|
|
45
|
-
targetValue =
|
|
46
|
-
Color.Transparent
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
targetValue = if (headerTransparent) {
|
|
47
|
+
Color.Transparent
|
|
48
|
+
} else {
|
|
49
|
+
animateColor(
|
|
50
|
+
Color.Transparent,
|
|
51
|
+
AppTheme.current.colors.background.surface,
|
|
52
|
+
opacityAni
|
|
53
|
+
)
|
|
54
|
+
}
|
|
50
55
|
)
|
|
51
56
|
|
|
52
57
|
when (headerType) {
|
|
@@ -54,6 +59,8 @@ fun HeaderBackground(
|
|
|
54
59
|
HeaderDefault(
|
|
55
60
|
opacityAni = opacityAni,
|
|
56
61
|
statusBarHeight = statusBarHeight,
|
|
62
|
+
backgroundColor = backgroundColor,
|
|
63
|
+
headerTransparent = headerTransparent
|
|
57
64
|
)
|
|
58
65
|
}
|
|
59
66
|
|
|
@@ -23,14 +23,16 @@ import vn.momo.kits.utils.bottomBorder
|
|
|
23
23
|
fun HeaderDefault(
|
|
24
24
|
opacityAni: Float,
|
|
25
25
|
statusBarHeight: Dp,
|
|
26
|
+
backgroundColor: Color?,
|
|
27
|
+
headerTransparent: Boolean = false
|
|
26
28
|
) {
|
|
27
29
|
val height = statusBarHeight + HEADER_HEIGHT.dp
|
|
28
30
|
Box(
|
|
29
31
|
modifier = Modifier.fillMaxWidth().height(height)
|
|
30
|
-
.background(AppTheme.current.colors.background.surface)
|
|
32
|
+
.background(if(headerTransparent && backgroundColor != null) backgroundColor else AppTheme.current.colors.background.surface)
|
|
31
33
|
.bottomBorder(
|
|
32
34
|
strokeWidth = 1.dp,
|
|
33
|
-
color = AppTheme.current.colors.border.default
|
|
35
|
+
color = if(headerTransparent && backgroundColor != null) backgroundColor else AppTheme.current.colors.border.default
|
|
34
36
|
)
|
|
35
37
|
) {
|
|
36
38
|
Box(
|
|
@@ -39,14 +41,24 @@ fun HeaderDefault(
|
|
|
39
41
|
.fillMaxWidth()
|
|
40
42
|
.alpha(opacityAni)
|
|
41
43
|
.background(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
if (headerTransparent)
|
|
45
|
+
Brush.linearGradient(
|
|
46
|
+
colors = listOf(
|
|
47
|
+
Color.Transparent,
|
|
48
|
+
Color.Transparent,
|
|
49
|
+
),
|
|
50
|
+
start = Offset(0f, 0f),
|
|
51
|
+
end = Offset(0f, with(LocalDensity.current) { 154.dp.toPx() })
|
|
52
|
+
)
|
|
53
|
+
else
|
|
54
|
+
Brush.linearGradient(
|
|
55
|
+
colors = listOf(
|
|
56
|
+
Color(0xFFFDCADE),
|
|
57
|
+
Color(0x00FDCADE)
|
|
58
|
+
),
|
|
59
|
+
start = Offset(0f, 0f),
|
|
60
|
+
end = Offset(0f, with(LocalDensity.current) { 154.dp.toPx() })
|
|
61
|
+
)
|
|
50
62
|
)
|
|
51
63
|
)
|
|
52
64
|
if (AppTheme.current.assets.headerBackground != null) {
|
|
@@ -30,6 +30,7 @@ import vn.momo.kits.const.Colors
|
|
|
30
30
|
import kotlinx.serialization.json.Json
|
|
31
31
|
import kotlinx.serialization.json.jsonObject
|
|
32
32
|
import kotlinx.serialization.json.jsonPrimitive
|
|
33
|
+
import vn.momo.kits.const.AppTheme
|
|
33
34
|
|
|
34
35
|
data class HeaderRightData(
|
|
35
36
|
val useShortcut: Boolean = false,
|
|
@@ -80,11 +81,12 @@ object Spacing {
|
|
|
80
81
|
@Composable
|
|
81
82
|
fun HeaderRight(
|
|
82
83
|
headerRight: HeaderRightData? = null,
|
|
84
|
+
tintColor: Color? = null,
|
|
83
85
|
) {
|
|
84
86
|
Row(
|
|
85
87
|
verticalAlignment = Alignment.CenterVertically,
|
|
86
88
|
) {
|
|
87
|
-
ToolkitHeaderRight(headerRight = headerRight)
|
|
89
|
+
ToolkitHeaderRight(headerRight = headerRight, tintColor = tintColor)
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
92
|
|
|
@@ -113,7 +115,7 @@ private fun getNavigationButtonConfig(
|
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
@Composable
|
|
116
|
-
private fun ToolkitHeaderRight(headerRight: HeaderRightData? = null) {
|
|
118
|
+
private fun ToolkitHeaderRight(headerRight: HeaderRightData? = null, tintColor: Color? = null) {
|
|
117
119
|
var isFavorite by remember { mutableStateOf(false) }
|
|
118
120
|
val isLoading by remember { mutableStateOf(false) }
|
|
119
121
|
val api = PlatformApi.current as? ComposeApi
|
|
@@ -191,6 +193,10 @@ private fun ToolkitHeaderRight(headerRight: HeaderRightData? = null) {
|
|
|
191
193
|
isShowShortcut = false
|
|
192
194
|
}
|
|
193
195
|
|
|
196
|
+
val tintIconColor = tintColor ?: AppTheme.current.colors.text.default
|
|
197
|
+
val backgroundButton = if (tintColor == Colors.black_01) Colors.black_20.copy(alpha = 0.6f) else Colors.black_01.copy(alpha = 0.6f)
|
|
198
|
+
val borderColor = if (tintColor == Colors.black_01) Colors.black_01.copy(alpha = 0.2f) else Colors.black_20.copy(alpha = 0.2f)
|
|
199
|
+
|
|
194
200
|
Row(
|
|
195
201
|
verticalAlignment = Alignment.CenterVertically
|
|
196
202
|
) {
|
|
@@ -199,7 +205,8 @@ private fun ToolkitHeaderRight(headerRight: HeaderRightData? = null) {
|
|
|
199
205
|
disabled = isLoading,
|
|
200
206
|
icon = navButtonConfig.icon,
|
|
201
207
|
showBadge = showBadge,
|
|
202
|
-
onClick = navButtonConfig.onPress
|
|
208
|
+
onClick = navButtonConfig.onPress,
|
|
209
|
+
tintColor = tintIconColor
|
|
203
210
|
)
|
|
204
211
|
}
|
|
205
212
|
Row(
|
|
@@ -207,16 +214,17 @@ private fun ToolkitHeaderRight(headerRight: HeaderRightData? = null) {
|
|
|
207
214
|
horizontalArrangement = Arrangement.Center,
|
|
208
215
|
modifier = Modifier
|
|
209
216
|
.padding(start = Spacing.S)
|
|
210
|
-
.border(0.2.dp,
|
|
217
|
+
.border(0.2.dp, borderColor, shape = RoundedCornerShape(14.dp))
|
|
211
218
|
.width(toolkitWidth)
|
|
212
219
|
.height(28.dp)
|
|
213
220
|
.clip(shape = RoundedCornerShape(14.dp))
|
|
214
|
-
.background(
|
|
221
|
+
.background(backgroundButton)
|
|
215
222
|
) {
|
|
216
223
|
if (context != null) {
|
|
217
224
|
Icon(
|
|
218
225
|
source = "help_center",
|
|
219
226
|
size = 20.dp,
|
|
227
|
+
color = tintIconColor,
|
|
220
228
|
modifier = Modifier.padding(4.dp).clickable {
|
|
221
229
|
onPressHelpCenter()
|
|
222
230
|
})
|
|
@@ -224,13 +232,14 @@ private fun ToolkitHeaderRight(headerRight: HeaderRightData? = null) {
|
|
|
224
232
|
modifier = Modifier
|
|
225
233
|
.width(0.5.dp)
|
|
226
234
|
.height(12.dp)
|
|
227
|
-
.background(Colors.black_20)
|
|
235
|
+
.background(tintColor ?: Colors.black_20)
|
|
228
236
|
)
|
|
229
237
|
}
|
|
230
238
|
|
|
231
239
|
Icon(
|
|
232
240
|
source = "16_navigation_close_circle",
|
|
233
241
|
size = 20.dp,
|
|
242
|
+
color = tintIconColor,
|
|
234
243
|
modifier = Modifier.padding(4.dp).clickable { onPressClose() }
|
|
235
244
|
)
|
|
236
245
|
}
|
|
@@ -242,8 +251,12 @@ fun NavigationButton(
|
|
|
242
251
|
disabled: Boolean,
|
|
243
252
|
icon: String,
|
|
244
253
|
showBadge: Boolean? = false,
|
|
245
|
-
onClick: () -> Unit
|
|
254
|
+
onClick: () -> Unit,
|
|
255
|
+
tintColor: Color?
|
|
246
256
|
) {
|
|
257
|
+
val backgroundButton = if (tintColor == Colors.black_01) Colors.black_20.copy(alpha = 0.6f) else Colors.black_01.copy(alpha = 0.6f)
|
|
258
|
+
val borderColor = if (tintColor == Colors.black_01) Colors.black_01.copy(alpha = 0.2f) else Colors.black_20.copy(alpha = 0.2f)
|
|
259
|
+
|
|
247
260
|
Box(
|
|
248
261
|
modifier = Modifier
|
|
249
262
|
.size(28.dp)
|
|
@@ -253,8 +266,8 @@ fun NavigationButton(
|
|
|
253
266
|
modifier = Modifier
|
|
254
267
|
.matchParentSize()
|
|
255
268
|
.clip(CircleShape)
|
|
256
|
-
.background(
|
|
257
|
-
.border(0.2.dp,
|
|
269
|
+
.background(backgroundButton)
|
|
270
|
+
.border(0.2.dp, borderColor, CircleShape)
|
|
258
271
|
)
|
|
259
272
|
Box(
|
|
260
273
|
modifier = Modifier.matchParentSize(),
|
|
@@ -262,7 +275,8 @@ fun NavigationButton(
|
|
|
262
275
|
) {
|
|
263
276
|
Icon(
|
|
264
277
|
source = icon,
|
|
265
|
-
size = 20.dp
|
|
278
|
+
size = 20.dp,
|
|
279
|
+
color = tintColor
|
|
266
280
|
)
|
|
267
281
|
}
|
|
268
282
|
|
|
@@ -4,6 +4,7 @@ import androidx.compose.runtime.Composable
|
|
|
4
4
|
import androidx.compose.ui.Modifier
|
|
5
5
|
import androidx.compose.ui.graphics.Color
|
|
6
6
|
import androidx.compose.ui.text.style.TextAlign
|
|
7
|
+
import androidx.compose.ui.text.style.TextOverflow
|
|
7
8
|
import androidx.compose.ui.unit.sp
|
|
8
9
|
import androidx.compose.ui.zIndex
|
|
9
10
|
import vn.momo.kits.components.Text
|
|
@@ -25,6 +26,7 @@ fun HeaderTitle(
|
|
|
25
26
|
lineHeight = 22.sp,
|
|
26
27
|
),
|
|
27
28
|
color = color,
|
|
28
|
-
maxLines = 1
|
|
29
|
+
maxLines = 1,
|
|
30
|
+
overflow = TextOverflow.Ellipsis,
|
|
29
31
|
)
|
|
30
32
|
}
|
|
@@ -52,6 +52,8 @@ const val HEADER_HEIGHT = 52
|
|
|
52
52
|
@Composable
|
|
53
53
|
fun Screen(
|
|
54
54
|
backgroundColor: Color? = null,
|
|
55
|
+
tintColor: Color? = null,
|
|
56
|
+
headerTransparent: Boolean = false,
|
|
55
57
|
isBack: Boolean = true,
|
|
56
58
|
headerType: HeaderType = HeaderType.DEFAULT,
|
|
57
59
|
verticalArrangement: Arrangement.Vertical = Arrangement.Top,
|
|
@@ -103,7 +105,8 @@ fun Screen(
|
|
|
103
105
|
if (animatedHeader === null) {
|
|
104
106
|
HeaderBackground(
|
|
105
107
|
headerType = headerType,
|
|
106
|
-
scrollState = scrollState.value
|
|
108
|
+
scrollState = scrollState.value,
|
|
109
|
+
headerTransparent = headerTransparent
|
|
107
110
|
)
|
|
108
111
|
} else {
|
|
109
112
|
Box(
|
|
@@ -129,6 +132,7 @@ fun Screen(
|
|
|
129
132
|
inputSearchProps = inputSearchProps,
|
|
130
133
|
scrollState = scrollState.value,
|
|
131
134
|
useAnimationSearch = useAnimationSearch,
|
|
135
|
+
tintColor = tintColor
|
|
132
136
|
)
|
|
133
137
|
|
|
134
138
|
Column(
|
|
@@ -196,9 +200,8 @@ fun Footer(footer: @Composable (() -> Unit)? = null, keyboardSize: Dp = 0.dp, bo
|
|
|
196
200
|
Box(
|
|
197
201
|
Modifier
|
|
198
202
|
.offset(y = -keyboardSize)
|
|
199
|
-
.padding(bottom = bottom)
|
|
200
203
|
.shadow(
|
|
201
|
-
Colors.black_20.copy(alpha = 0.
|
|
204
|
+
Colors.black_20.copy(alpha = 0.2f),
|
|
202
205
|
borderRadius = 0.dp,
|
|
203
206
|
10f,
|
|
204
207
|
offsetX = 0.dp,
|
|
@@ -208,7 +211,9 @@ fun Footer(footer: @Composable (() -> Unit)? = null, keyboardSize: Dp = 0.dp, bo
|
|
|
208
211
|
.background(AppTheme.current.colors.background.surface)
|
|
209
212
|
) {
|
|
210
213
|
Box(
|
|
211
|
-
Modifier.fillMaxWidth()
|
|
214
|
+
Modifier.fillMaxWidth()
|
|
215
|
+
.padding(bottom = bottom)
|
|
216
|
+
.padding(vertical = Spacing.S, horizontal = Spacing.M)
|
|
212
217
|
) {
|
|
213
218
|
footer?.invoke()
|
|
214
219
|
}
|
|
@@ -8,6 +8,7 @@ import androidx.compose.animation.core.rememberInfiniteTransition
|
|
|
8
8
|
import androidx.compose.animation.core.tween
|
|
9
9
|
import androidx.compose.foundation.background
|
|
10
10
|
import androidx.compose.foundation.border
|
|
11
|
+
import androidx.compose.foundation.clickable
|
|
11
12
|
import androidx.compose.foundation.layout.Arrangement
|
|
12
13
|
import androidx.compose.foundation.layout.Box
|
|
13
14
|
import androidx.compose.foundation.layout.Column
|
|
@@ -35,6 +36,7 @@ import androidx.compose.ui.text.input.KeyboardType
|
|
|
35
36
|
import androidx.compose.ui.unit.dp
|
|
36
37
|
import androidx.compose.ui.zIndex
|
|
37
38
|
import vn.momo.kits.const.AppTheme
|
|
39
|
+
import vn.momo.kits.const.Colors
|
|
38
40
|
import vn.momo.kits.const.Radius
|
|
39
41
|
import vn.momo.kits.const.Spacing
|
|
40
42
|
import vn.momo.kits.const.Typography
|
|
@@ -87,7 +89,7 @@ fun InputOTP(
|
|
|
87
89
|
dataType: String = "number",
|
|
88
90
|
modifier: Modifier = Modifier
|
|
89
91
|
) {
|
|
90
|
-
val maxLength = 10
|
|
92
|
+
val maxLength = length ?: 10
|
|
91
93
|
var isFocused by remember { mutableStateOf(false) }
|
|
92
94
|
var isBlurred = false
|
|
93
95
|
|
|
@@ -100,6 +102,10 @@ fun InputOTP(
|
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
104
|
|
|
105
|
+
fun onClearText(){
|
|
106
|
+
handleChangeText("")
|
|
107
|
+
}
|
|
108
|
+
|
|
103
109
|
|
|
104
110
|
Column {
|
|
105
111
|
BasicTextField(
|
|
@@ -193,6 +199,22 @@ fun InputOTP(
|
|
|
193
199
|
}
|
|
194
200
|
}
|
|
195
201
|
}
|
|
202
|
+
Box(
|
|
203
|
+
modifier = Modifier.align(Alignment.Center).zIndex(10f)
|
|
204
|
+
) {
|
|
205
|
+
Row(
|
|
206
|
+
horizontalArrangement = Arrangement.End,
|
|
207
|
+
modifier = Modifier.fillMaxWidth()
|
|
208
|
+
) {
|
|
209
|
+
Icon(
|
|
210
|
+
"24_navigation_close_circle_full",
|
|
211
|
+
size = 12.dp,
|
|
212
|
+
modifier = Modifier.padding(end = 12.dp).clickable {
|
|
213
|
+
onClearText()
|
|
214
|
+
}
|
|
215
|
+
)
|
|
216
|
+
}
|
|
217
|
+
}
|
|
196
218
|
}
|
|
197
219
|
}
|
|
198
220
|
)
|
|
@@ -57,6 +57,7 @@ fun PopupNotify(
|
|
|
57
57
|
secondary: PopupAction? = null,
|
|
58
58
|
buttonDirection: PopupActionDirection = PopupActionDirection.ROW,
|
|
59
59
|
onIconClose: () -> Unit,
|
|
60
|
+
isShowCloseIcon: Boolean = true,
|
|
60
61
|
) {
|
|
61
62
|
var isScroll by remember { mutableStateOf(false) }
|
|
62
63
|
val layoutResult = remember { mutableStateOf<TextLayoutResult?>(null) }
|
|
@@ -107,12 +108,13 @@ fun PopupNotify(
|
|
|
107
108
|
RoundedCornerShape(Radius.L)
|
|
108
109
|
)
|
|
109
110
|
) {
|
|
110
|
-
image.
|
|
111
|
+
if(image.isNotEmpty()) {
|
|
111
112
|
Image(
|
|
112
113
|
source = image,
|
|
113
|
-
modifier = Modifier.fillMaxWidth().aspectRatio(1.777f)
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
modifier = Modifier.fillMaxWidth().aspectRatio(1.777f),
|
|
115
|
+
options = Options(alignment = Alignment.Center)
|
|
116
|
+
)
|
|
117
|
+
}
|
|
116
118
|
|
|
117
119
|
Column(modifier = Modifier.padding(Spacing.XL)) {
|
|
118
120
|
Text(
|
|
@@ -124,7 +126,7 @@ fun PopupNotify(
|
|
|
124
126
|
content(Modifier.padding(top = Spacing.S))
|
|
125
127
|
if (error.isNotEmpty()) {
|
|
126
128
|
Text(
|
|
127
|
-
text = error,
|
|
129
|
+
text = "Mã lỗi: " + error,
|
|
128
130
|
style = Typography.descriptionXsRegular,
|
|
129
131
|
color = AppTheme.current.colors.text.hint,
|
|
130
132
|
maxLines = 1,
|
|
@@ -143,34 +145,36 @@ fun PopupNotify(
|
|
|
143
145
|
}
|
|
144
146
|
}
|
|
145
147
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
148
|
+
if(isShowCloseIcon) {
|
|
149
|
+
Box(
|
|
150
|
+
Modifier
|
|
151
|
+
.width(22.dp)
|
|
152
|
+
.height(22.dp)
|
|
153
|
+
.offset(x = -(1).dp, y = (-11).dp)
|
|
154
|
+
.background(
|
|
155
|
+
color = AppTheme.current.colors.text.default,
|
|
156
|
+
shape = RoundedCornerShape(Radius.M)
|
|
157
|
+
)
|
|
158
|
+
.border(
|
|
159
|
+
width = 2.dp,
|
|
160
|
+
color = AppTheme.current.colors.background.surface,
|
|
161
|
+
shape = RoundedCornerShape(Radius.M)
|
|
162
|
+
)
|
|
163
|
+
.clip(RoundedCornerShape(100))
|
|
164
|
+
.clickable(
|
|
165
|
+
interactionSource = remember { MutableInteractionSource() },
|
|
166
|
+
indication = null,
|
|
167
|
+
onClick = { onClose { onIconClose() } }
|
|
168
|
+
),
|
|
169
|
+
contentAlignment = Alignment.Center
|
|
170
|
+
) {
|
|
171
|
+
Icon(
|
|
172
|
+
source = "navigation_close",
|
|
157
173
|
color = AppTheme.current.colors.background.surface,
|
|
158
|
-
|
|
174
|
+
size = 16.dp,
|
|
175
|
+
modifier = Modifier.setAutomationId("ic_popup_close")
|
|
159
176
|
)
|
|
160
|
-
|
|
161
|
-
.clickable(
|
|
162
|
-
interactionSource = remember { MutableInteractionSource() },
|
|
163
|
-
indication = null,
|
|
164
|
-
onClick = { onClose { onIconClose() } }
|
|
165
|
-
),
|
|
166
|
-
contentAlignment = Alignment.Center
|
|
167
|
-
) {
|
|
168
|
-
Icon(
|
|
169
|
-
source = "navigation_close",
|
|
170
|
-
color = AppTheme.current.colors.background.surface,
|
|
171
|
-
size = 16.dp,
|
|
172
|
-
modifier = Modifier.setAutomationId("ic_popup_close")
|
|
173
|
-
)
|
|
177
|
+
}
|
|
174
178
|
}
|
|
175
179
|
}
|
|
176
180
|
}
|
|
@@ -17,25 +17,35 @@ import androidx.compose.runtime.remember
|
|
|
17
17
|
import androidx.compose.ui.Alignment
|
|
18
18
|
import androidx.compose.ui.Modifier
|
|
19
19
|
import androidx.compose.ui.draw.clip
|
|
20
|
+
import androidx.compose.ui.layout.ContentScale
|
|
20
21
|
import androidx.compose.ui.semantics.semantics
|
|
21
22
|
import androidx.compose.ui.semantics.testTag
|
|
22
23
|
import androidx.compose.ui.unit.dp
|
|
23
24
|
import vn.momo.kits.const.AppTheme
|
|
24
25
|
import vn.momo.kits.const.Radius
|
|
25
26
|
import vn.momo.kits.const.Spacing
|
|
27
|
+
import vn.momo.kits.utils.ifNotNull
|
|
26
28
|
|
|
27
29
|
@Composable
|
|
28
|
-
fun
|
|
30
|
+
fun PopupPromotion(
|
|
29
31
|
source: String = "",
|
|
32
|
+
onPress: (() -> Unit) = {},
|
|
30
33
|
onClose: (() -> Unit) = {},
|
|
31
34
|
) {
|
|
32
35
|
Column(Modifier.semantics { testTag = "popup_notify" }) {
|
|
33
|
-
|
|
36
|
+
source.ifNotNull(
|
|
34
37
|
Image(
|
|
35
38
|
source = source,
|
|
36
|
-
modifier = Modifier.fillMaxWidth()
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
modifier = Modifier.fillMaxWidth()
|
|
40
|
+
.aspectRatio(0.72f)
|
|
41
|
+
.clickable(
|
|
42
|
+
interactionSource = remember { MutableInteractionSource() },
|
|
43
|
+
indication = null,
|
|
44
|
+
onClick = onPress
|
|
45
|
+
),
|
|
46
|
+
options = Options(alignment = Alignment.Center, contentScale = ContentScale.Crop)
|
|
47
|
+
), null
|
|
48
|
+
)
|
|
39
49
|
Box(
|
|
40
50
|
modifier = Modifier
|
|
41
51
|
.padding(top = Spacing.S)
|
|
@@ -17,6 +17,7 @@ import androidx.compose.ui.graphics.Color
|
|
|
17
17
|
import androidx.compose.ui.unit.dp
|
|
18
18
|
import vn.momo.kits.const.Colors
|
|
19
19
|
import vn.momo.kits.const.Spacing
|
|
20
|
+
import vn.momo.kits.modifier.setAutomationId
|
|
20
21
|
import vn.momo.kits.utils.ifTrue
|
|
21
22
|
|
|
22
23
|
@Composable
|
|
@@ -24,6 +25,8 @@ fun Switch(
|
|
|
24
25
|
value: Boolean = false,
|
|
25
26
|
onChange: (Boolean) -> Unit = {},
|
|
26
27
|
disabled: Boolean = false,
|
|
28
|
+
title: String? = "",
|
|
29
|
+
accessibilityId: String? = ""
|
|
27
30
|
) {
|
|
28
31
|
val circleBackgroundColor = value.ifTrue(Colors.black_01, Colors.black_03)
|
|
29
32
|
var backgroundColor = value.ifTrue(Colors.green_03, Colors.black_07)
|
|
@@ -32,27 +35,35 @@ fun Switch(
|
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
Box(
|
|
35
|
-
modifier = Modifier.
|
|
36
|
-
Modifier.width(38.dp).height(20.dp).border(
|
|
37
|
-
0.dp, Color.Unspecified,
|
|
38
|
-
RoundedCornerShape(20.dp)
|
|
39
|
-
).background(backgroundColor, RoundedCornerShape(20.dp)).clip(RoundedCornerShape(20.dp))
|
|
40
|
-
.clickable(
|
|
41
|
-
enabled = !disabled,
|
|
42
|
-
onClick = { onChange(!value) }
|
|
43
|
-
)
|
|
44
|
-
.padding(horizontal = Spacing.XS)
|
|
45
|
-
),
|
|
46
|
-
contentAlignment = value.ifTrue(Alignment.CenterEnd, Alignment.CenterStart)
|
|
38
|
+
modifier = Modifier.setAutomationId( accessibilityId ?: "toggle_${title ?: "unknown"}_${value}")
|
|
47
39
|
) {
|
|
48
40
|
Box(
|
|
49
|
-
modifier = Modifier.
|
|
50
|
-
.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
41
|
+
modifier = Modifier.then(
|
|
42
|
+
Modifier.width(38.dp).height(20.dp).border(
|
|
43
|
+
0.dp, Color.Unspecified,
|
|
44
|
+
RoundedCornerShape(20.dp)
|
|
45
|
+
).background(backgroundColor, RoundedCornerShape(20.dp))
|
|
46
|
+
.clip(RoundedCornerShape(20.dp))
|
|
47
|
+
.clickable(
|
|
48
|
+
enabled = !disabled,
|
|
49
|
+
onClick = { onChange(!value) }
|
|
50
|
+
)
|
|
51
|
+
.padding(horizontal = Spacing.XS)
|
|
52
|
+
),
|
|
53
|
+
contentAlignment = value.ifTrue(Alignment.CenterEnd, Alignment.CenterStart)
|
|
54
|
+
) {
|
|
55
|
+
Box(
|
|
56
|
+
modifier = Modifier.size(14.dp)
|
|
57
|
+
.border(0.dp, Color.Unspecified, RoundedCornerShape(percent = 100))
|
|
58
|
+
.background(circleBackgroundColor, RoundedCornerShape(percent = 100)),
|
|
59
|
+
contentAlignment = Alignment.Center
|
|
60
|
+
)
|
|
61
|
+
{
|
|
62
|
+
Box(
|
|
63
|
+
Modifier.size(6.dp)
|
|
64
|
+
.background(backgroundColor, RoundedCornerShape(percent = 100))
|
|
65
|
+
)
|
|
66
|
+
}
|
|
56
67
|
}
|
|
57
68
|
}
|
|
58
69
|
}
|