@momo-kits/native-kits 0.117.1-beta.1 → 0.117.1-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +23 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +208 -0
- package/ios/Popup/PopupDisplay.swift +21 -29
- package/ios/Popup/PopupPromotion.swift +13 -18
- package/local.properties +2 -2
- package/package.json +1 -1
|
@@ -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
|
)
|
|
@@ -17,6 +17,7 @@ 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
|
|
@@ -41,6 +42,7 @@ fun PopupPromotion(
|
|
|
41
42
|
indication = null,
|
|
42
43
|
onClick = onPress
|
|
43
44
|
),
|
|
45
|
+
options = Options(alignment = Alignment.Center, contentScale = ContentScale.Fit)
|
|
44
46
|
)
|
|
45
47
|
}
|
|
46
48
|
Box(
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
package vn.momo.kits.components
|
|
2
|
+
|
|
3
|
+
import androidx.compose.foundation.background
|
|
4
|
+
import androidx.compose.foundation.clickable
|
|
5
|
+
import androidx.compose.foundation.layout.Arrangement
|
|
6
|
+
import androidx.compose.foundation.layout.Box
|
|
7
|
+
import androidx.compose.foundation.layout.Column
|
|
8
|
+
import androidx.compose.foundation.layout.IntrinsicSize
|
|
9
|
+
import androidx.compose.foundation.layout.Row
|
|
10
|
+
import androidx.compose.foundation.layout.Spacer
|
|
11
|
+
import androidx.compose.foundation.layout.fillMaxHeight
|
|
12
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
13
|
+
import androidx.compose.foundation.layout.height
|
|
14
|
+
import androidx.compose.foundation.layout.padding
|
|
15
|
+
import androidx.compose.foundation.layout.size
|
|
16
|
+
import androidx.compose.foundation.layout.width
|
|
17
|
+
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
18
|
+
import androidx.compose.runtime.Composable
|
|
19
|
+
import androidx.compose.ui.Alignment
|
|
20
|
+
import androidx.compose.ui.Modifier
|
|
21
|
+
import androidx.compose.ui.graphics.Color
|
|
22
|
+
import androidx.compose.ui.text.TextStyle
|
|
23
|
+
import androidx.compose.ui.text.font.FontWeight
|
|
24
|
+
import androidx.compose.ui.unit.dp
|
|
25
|
+
import androidx.compose.ui.unit.sp
|
|
26
|
+
import vn.momo.kits.const.AppTheme
|
|
27
|
+
import vn.momo.kits.const.Colors
|
|
28
|
+
import vn.momo.kits.const.Spacing
|
|
29
|
+
import vn.momo.kits.const.Typography
|
|
30
|
+
|
|
31
|
+
enum class TitleType { Card, Section }
|
|
32
|
+
enum class TitleSize { Small, Medium, Large }
|
|
33
|
+
enum class IconAlign { Top, Center, Bottom }
|
|
34
|
+
enum class ButtonSize { Small, Large }
|
|
35
|
+
|
|
36
|
+
@Composable
|
|
37
|
+
fun Title(
|
|
38
|
+
title: String,
|
|
39
|
+
type: TitleType = TitleType.Section,
|
|
40
|
+
size: TitleSize = TitleSize.Medium,
|
|
41
|
+
icon: String? = null,
|
|
42
|
+
iconColor: Color? = null,
|
|
43
|
+
iconAlign: IconAlign = IconAlign.Top,
|
|
44
|
+
showRightAction: Boolean = false,
|
|
45
|
+
showTrailingAction: Boolean = false,
|
|
46
|
+
badgeLabel: String? = null,
|
|
47
|
+
buttonTitle: String? = null,
|
|
48
|
+
buttonSize: ButtonSize = ButtonSize.Small,
|
|
49
|
+
onPressRightAction: () -> Unit = {},
|
|
50
|
+
onPressTrailingAction: () -> Unit = {},
|
|
51
|
+
textOnly: Boolean = false,
|
|
52
|
+
description: String? = null,
|
|
53
|
+
modifier: Modifier = Modifier
|
|
54
|
+
) {
|
|
55
|
+
val theme = AppTheme.current
|
|
56
|
+
val textStyle: TextStyle = when (type) {
|
|
57
|
+
TitleType.Card -> when (size) {
|
|
58
|
+
TitleSize.Small -> TextStyle(fontSize = 14.sp, lineHeight = 20.sp)
|
|
59
|
+
TitleSize.Medium -> TextStyle(fontSize = 16.sp, lineHeight = 22.sp)
|
|
60
|
+
TitleSize.Large -> TextStyle(fontSize = 18.sp, lineHeight = 26.sp)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
TitleType.Section -> when (size) {
|
|
64
|
+
TitleSize.Small -> TextStyle(
|
|
65
|
+
fontSize = 16.sp,
|
|
66
|
+
lineHeight = 24.sp,
|
|
67
|
+
fontWeight = FontWeight.Bold
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
TitleSize.Medium -> TextStyle(
|
|
71
|
+
fontSize = 18.sp,
|
|
72
|
+
lineHeight = 26.sp,
|
|
73
|
+
fontWeight = FontWeight.Bold
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
TitleSize.Large -> TextStyle(
|
|
77
|
+
fontSize = 20.sp,
|
|
78
|
+
lineHeight = 28.sp,
|
|
79
|
+
fontWeight = FontWeight.Bold
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (textOnly) {
|
|
85
|
+
Text(
|
|
86
|
+
text = title,
|
|
87
|
+
style = textStyle,
|
|
88
|
+
modifier = modifier
|
|
89
|
+
)
|
|
90
|
+
return
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
Row(
|
|
94
|
+
modifier = modifier
|
|
95
|
+
.fillMaxWidth()
|
|
96
|
+
.height(IntrinsicSize.Min)
|
|
97
|
+
.padding(8.dp),
|
|
98
|
+
verticalAlignment = Alignment.CenterVertically
|
|
99
|
+
) {
|
|
100
|
+
icon?.let {
|
|
101
|
+
Column(
|
|
102
|
+
modifier = Modifier.fillMaxHeight().padding(end = Spacing.S),
|
|
103
|
+
verticalArrangement = when (iconAlign) {
|
|
104
|
+
IconAlign.Top -> Arrangement.Top
|
|
105
|
+
IconAlign.Center -> Arrangement.Center
|
|
106
|
+
IconAlign.Bottom -> Arrangement.Bottom
|
|
107
|
+
},
|
|
108
|
+
) {
|
|
109
|
+
// Icon
|
|
110
|
+
Icon(
|
|
111
|
+
source = it,
|
|
112
|
+
color = iconColor ?: theme.colors.text.default,
|
|
113
|
+
modifier = Modifier.size(24.dp)
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
Column(
|
|
119
|
+
modifier = Modifier.weight(1f)
|
|
120
|
+
) {
|
|
121
|
+
Row(
|
|
122
|
+
verticalAlignment = Alignment.CenterVertically
|
|
123
|
+
) {
|
|
124
|
+
Row(
|
|
125
|
+
verticalAlignment = Alignment.CenterVertically,
|
|
126
|
+
modifier = if (showTrailingAction) Modifier else Modifier.weight(1f),
|
|
127
|
+
) {
|
|
128
|
+
Text(
|
|
129
|
+
text = title,
|
|
130
|
+
style = textStyle,
|
|
131
|
+
maxLines = if (showTrailingAction || badgeLabel != null) 1 else 2,
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
// Badge
|
|
135
|
+
badgeLabel?.let {
|
|
136
|
+
Spacer(modifier = Modifier.width(4.dp))
|
|
137
|
+
Badge(
|
|
138
|
+
label = it
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Trailing action (icon)
|
|
145
|
+
if (showTrailingAction && !showRightAction) {
|
|
146
|
+
Spacer(modifier = Modifier.width(8.dp))
|
|
147
|
+
Box(
|
|
148
|
+
modifier = Modifier
|
|
149
|
+
.size(24.dp)
|
|
150
|
+
.background(
|
|
151
|
+
color = if (type == TitleType.Section) Colors.black_06.copy(0.6f) else Colors.black_06.copy(
|
|
152
|
+
0.3f
|
|
153
|
+
),
|
|
154
|
+
shape = RoundedCornerShape(12.dp)
|
|
155
|
+
)
|
|
156
|
+
.clickable { onPressTrailingAction() },
|
|
157
|
+
contentAlignment = Alignment.Center
|
|
158
|
+
) {
|
|
159
|
+
Icon(
|
|
160
|
+
source = "arrow_chevron_right_small",
|
|
161
|
+
size = 18.dp
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Description
|
|
168
|
+
description?.let {
|
|
169
|
+
Spacer(modifier = Modifier.height(4.dp))
|
|
170
|
+
Text(
|
|
171
|
+
text = it,
|
|
172
|
+
style = Typography.descriptionDefaultRegular,
|
|
173
|
+
color = theme.colors.text.secondary
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Right action (button or icon)
|
|
179
|
+
if (showRightAction && !showTrailingAction) {
|
|
180
|
+
Spacer(modifier = Modifier.width(8.dp))
|
|
181
|
+
if (buttonTitle != null) {
|
|
182
|
+
Text(
|
|
183
|
+
text = buttonTitle,
|
|
184
|
+
style = if (buttonSize === ButtonSize.Small) Typography.actionXsBold else Typography.actionSBold,
|
|
185
|
+
color = theme.colors.primary,
|
|
186
|
+
modifier = Modifier.clickable { onPressRightAction() }
|
|
187
|
+
)
|
|
188
|
+
} else {
|
|
189
|
+
Box(
|
|
190
|
+
modifier = Modifier
|
|
191
|
+
.size(24.dp)
|
|
192
|
+
.background(
|
|
193
|
+
color = Colors.pink_03.copy(alpha = 0.1f),
|
|
194
|
+
shape = RoundedCornerShape(12.dp)
|
|
195
|
+
)
|
|
196
|
+
.clickable { onPressRightAction() },
|
|
197
|
+
contentAlignment = Alignment.Center
|
|
198
|
+
) {
|
|
199
|
+
Icon(
|
|
200
|
+
source = "arrow_chevron_right_small",
|
|
201
|
+
modifier = Modifier.size(22.dp),
|
|
202
|
+
color = theme.colors.primary
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
@@ -34,21 +34,17 @@ public struct PopupDisplay: View {
|
|
|
34
34
|
self.actionButtonTitle = actionButtonTitle
|
|
35
35
|
self.errorCode = errorCode
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
var placeholder: AnyView?
|
|
39
|
-
|
|
40
|
-
@State var error: Bool = false
|
|
41
37
|
|
|
42
38
|
// MARK: Public
|
|
43
39
|
|
|
44
40
|
public var body: some View {
|
|
45
41
|
VStack(spacing: 12) {
|
|
46
42
|
ZStack(alignment: .topTrailing) {
|
|
47
|
-
SwiftUI.Button(action:
|
|
43
|
+
SwiftUI.Button(action: onClose) {
|
|
48
44
|
Image(systemName: "xmark.circle.fill")
|
|
49
45
|
.resizable()
|
|
50
46
|
.frame(width: 22, height: 22)
|
|
51
|
-
.overlay(RoundedRectangle(cornerRadius: Radius.L).stroke(Colors.black01, lineWidth:
|
|
47
|
+
.overlay(RoundedRectangle(cornerRadius: Radius.L).stroke(Colors.black01, lineWidth: 2))
|
|
52
48
|
}.foregroundColor(Colors.black20)
|
|
53
49
|
.background(Colors.black01.cornerRadius(15))
|
|
54
50
|
.padding(.trailing, -11)
|
|
@@ -56,25 +52,25 @@ public struct PopupDisplay: View {
|
|
|
56
52
|
.zIndex(1)
|
|
57
53
|
.accessibility(identifier: "ic_popup_close")
|
|
58
54
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
55
|
+
VStack {
|
|
56
|
+
if(!url.isEmpty) {
|
|
57
|
+
WebImage(url: URL(string: url), isAnimating: .constant(true))
|
|
58
|
+
.resizable()
|
|
59
|
+
.placeholder {
|
|
60
|
+
Rectangle()
|
|
61
|
+
.fill(Color.gray.opacity(0.3))
|
|
62
|
+
.frame(maxWidth: .infinity, maxHeight: 184)
|
|
63
|
+
}
|
|
64
|
+
.aspectRatio(2, contentMode: .fit)
|
|
65
|
+
.frame(maxWidth: .infinity, alignment: .center)
|
|
66
|
+
.clipShape(RoundedCorner(radius: 15, corners: [.topLeft, .topRight]))
|
|
67
|
+
.clipped()
|
|
68
|
+
}
|
|
73
69
|
VStack(alignment: .leading) {
|
|
74
70
|
Text(title)
|
|
75
71
|
.foregroundColor(.black)
|
|
76
72
|
.font(.header_default_semibold)
|
|
77
|
-
.padding(.top,
|
|
73
|
+
.padding(.top, 24)
|
|
78
74
|
.padding(.bottom, 8)
|
|
79
75
|
.lineLimit(2)
|
|
80
76
|
.accessibility(identifier: "title_popup_permission")
|
|
@@ -85,17 +81,18 @@ public struct PopupDisplay: View {
|
|
|
85
81
|
.opacity(0.6)
|
|
86
82
|
.multilineTextAlignment(.leading)
|
|
87
83
|
.padding(.bottom, 8)
|
|
88
|
-
|
|
84
|
+
|
|
89
85
|
if(!errorCode.isEmpty) {
|
|
90
86
|
Text(errorCode)
|
|
91
87
|
.foregroundColor(Colors.black12)
|
|
92
88
|
.font(.description_xs_regular)
|
|
93
89
|
.lineLimit(1)
|
|
90
|
+
.padding(.bottom, 8)
|
|
94
91
|
}
|
|
95
92
|
}
|
|
96
93
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
97
94
|
.padding(.horizontal, 24)
|
|
98
|
-
.padding(.bottom,
|
|
95
|
+
.padding(.bottom, 16)
|
|
99
96
|
|
|
100
97
|
if buttonDirection == .row {
|
|
101
98
|
if buttonType == .text {
|
|
@@ -134,7 +131,7 @@ public struct PopupDisplay: View {
|
|
|
134
131
|
var actionButtonTitle: String
|
|
135
132
|
var closeButtonTitle: String
|
|
136
133
|
var errorCode: String
|
|
137
|
-
|
|
134
|
+
|
|
138
135
|
var RowTextButtons: some View {
|
|
139
136
|
HStack {
|
|
140
137
|
SwiftUI.Button(action: onPressCloseButton) {
|
|
@@ -195,9 +192,4 @@ public struct PopupDisplay: View {
|
|
|
195
192
|
.padding(.bottom, 24)
|
|
196
193
|
}
|
|
197
194
|
|
|
198
|
-
|
|
199
|
-
func onPressClose(){
|
|
200
|
-
isPresented = false
|
|
201
|
-
onClose()
|
|
202
|
-
}
|
|
203
195
|
}
|
|
@@ -4,20 +4,19 @@ import SDWebImageSwiftUI
|
|
|
4
4
|
public struct PopupPromotion: View {
|
|
5
5
|
var imageUrl: String
|
|
6
6
|
var onIconClose: (() -> Void)?
|
|
7
|
-
var
|
|
7
|
+
var onAction: (() -> Void)?
|
|
8
|
+
|
|
8
9
|
|
|
9
|
-
|
|
10
10
|
public init(
|
|
11
11
|
imageUrl: String,
|
|
12
12
|
onIconClose: (() -> Void)? = nil,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
onAction: (() -> Void)? = nil
|
|
15
14
|
) {
|
|
16
15
|
self.imageUrl = imageUrl
|
|
17
16
|
self.onIconClose = onIconClose
|
|
18
|
-
self.
|
|
17
|
+
self.onAction = onAction
|
|
19
18
|
}
|
|
20
|
-
|
|
19
|
+
|
|
21
20
|
public var body: some View {
|
|
22
21
|
VStack(spacing: 8) {
|
|
23
22
|
WebImage(url: URL(string: imageUrl)!)
|
|
@@ -31,25 +30,28 @@ public struct PopupPromotion: View {
|
|
|
31
30
|
.aspectRatio(0.72, contentMode: .fit)
|
|
32
31
|
.frame(maxWidth: UIScreen.main.bounds.width - Spacing.XL * 2)
|
|
33
32
|
.clipped()
|
|
34
|
-
|
|
33
|
+
.onTapGesture {
|
|
34
|
+
onAction?()
|
|
35
|
+
}
|
|
36
|
+
|
|
35
37
|
buildCloseIcon()
|
|
36
38
|
}
|
|
37
39
|
.accessibility(identifier: "popup_promotion")
|
|
38
40
|
}
|
|
39
|
-
|
|
41
|
+
|
|
40
42
|
@ViewBuilder
|
|
41
43
|
private func buildCloseIcon() -> some View {
|
|
42
44
|
HStack {
|
|
43
45
|
Spacer()
|
|
44
46
|
SwiftUI.Button(action: {
|
|
45
|
-
|
|
47
|
+
onIconClose?()
|
|
46
48
|
}) {
|
|
47
49
|
ZStack {
|
|
48
50
|
Circle()
|
|
49
51
|
.strokeBorder(Colors.black01, lineWidth: 2)
|
|
50
52
|
.background(Circle().fill(Colors.black17))
|
|
51
53
|
.frame(width: 20, height: 20)
|
|
52
|
-
|
|
54
|
+
|
|
53
55
|
Icon(source: "navigation_close", size: 14, color: Colors.black01)
|
|
54
56
|
}
|
|
55
57
|
}
|
|
@@ -57,14 +59,7 @@ public struct PopupPromotion: View {
|
|
|
57
59
|
Spacer()
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
|
-
|
|
61
|
-
private func onAction(callback: (() -> Void)?) {
|
|
62
|
-
if let onRequestClose = onRequestClose {
|
|
63
|
-
onRequestClose(callback)
|
|
64
|
-
} else {
|
|
65
|
-
callback?()
|
|
66
|
-
}
|
|
67
|
-
}
|
|
62
|
+
|
|
68
63
|
}
|
|
69
64
|
|
|
70
65
|
|
package/local.properties
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
# Location of the SDK. This is only used by Gradle.
|
|
5
5
|
# For customization when using a Version Control System, please read the
|
|
6
6
|
# header note.
|
|
7
|
-
#
|
|
8
|
-
sdk.dir=/Users/
|
|
7
|
+
#Tue Apr 08 11:13:31 ICT 2025
|
|
8
|
+
sdk.dir=/Users/sonnguyen/Library/Android/sdk
|