@momo-kits/native-kits 0.152.4-beta.9 → 0.152.4-klib.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.
Files changed (118) hide show
  1. package/README.md +175 -5
  2. package/ios/Badge/Badge.swift +0 -6
  3. package/ios/Badge/BadgeRibbon.swift +77 -9
  4. package/ios/Button/Button.swift +7 -7
  5. package/ios/native-kits.podspec +18 -16
  6. package/package.json +2 -4
  7. package/CODE_OF_CONDUCT.md +0 -133
  8. package/CONTRIBUTING.md +0 -114
  9. package/LICENSE +0 -20
  10. package/build.gradle.kts +0 -32
  11. package/compose/MoMoComposeKits.podspec +0 -54
  12. package/compose/build.gradle.kts +0 -149
  13. package/compose/src/androidMain/AndroidManifest.xml +0 -2
  14. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -105
  15. package/compose/src/commonMain/composeResources/files/lottie_circle_loader.json +0 -1
  16. package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
  17. package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
  18. package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
  19. package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
  20. package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
  21. package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
  22. package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
  23. package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
  24. package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
  25. package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
  26. package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
  27. package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
  28. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
  29. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -57
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -201
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -222
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -48
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -306
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -715
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -214
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -236
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -77
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -27
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -334
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -345
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -90
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -131
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -543
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -23
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -58
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -143
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -179
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -111
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -384
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -160
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -234
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -223
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -232
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -236
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -228
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -364
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -50
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -34
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -85
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -33
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -338
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -95
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -64
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -89
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -91
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -84
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -208
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -172
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -199
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -237
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -191
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -306
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -13
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -191
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -258
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -2
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -35
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -2
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -59
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -68
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -49
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -232
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -111
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -94
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -159
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -232
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScaleSizeScope.kt +0 -17
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -459
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -169
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -216
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -180
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -251
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -80
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -306
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -31
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -385
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -38
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -62
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -88
  113. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -144
  114. package/gradle.properties +0 -19
  115. package/gradlew +0 -240
  116. package/gradlew.bat +0 -91
  117. package/ios/Theme.md +0 -18
  118. package/settings.gradle.kts +0 -25
@@ -1,306 +0,0 @@
1
- package vn.momo.kits.application
2
-
3
- import androidx.compose.foundation.background
4
- import androidx.compose.foundation.border
5
- import androidx.compose.foundation.clickable
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.height
10
- import androidx.compose.foundation.layout.offset
11
- import androidx.compose.foundation.layout.padding
12
- import androidx.compose.foundation.layout.size
13
- import androidx.compose.foundation.layout.width
14
- import androidx.compose.foundation.shape.CircleShape
15
- import androidx.compose.foundation.shape.RoundedCornerShape
16
- import androidx.compose.runtime.Composable
17
- import androidx.compose.runtime.getValue
18
- import androidx.compose.runtime.mutableStateOf
19
- import androidx.compose.runtime.remember
20
- import androidx.compose.runtime.setValue
21
- import androidx.compose.ui.Alignment
22
- import androidx.compose.ui.Modifier
23
- import androidx.compose.ui.draw.clip
24
- import androidx.compose.ui.graphics.Color
25
- import androidx.compose.ui.unit.dp
26
- import kotlinx.serialization.json.Json
27
- import kotlinx.serialization.json.jsonObject
28
- import kotlinx.serialization.json.jsonPrimitive
29
- import vn.momo.kits.components.BadgeDot
30
- import vn.momo.kits.components.DotSize
31
- import vn.momo.kits.components.Icon
32
- import vn.momo.kits.const.AppTheme
33
- import vn.momo.kits.const.Colors
34
-
35
- data class HeaderRightData(
36
- val useShortcut: Boolean = false,
37
- val useMore: Boolean = false,
38
- val useSystemTools: Boolean = true,
39
- val tools: List<ToolGroup> = emptyList(),
40
- val toolCallback: ((String) -> Unit)? = { _ -> }
41
- )
42
-
43
- data class Tool(
44
- val key: String,
45
- val icon: String,
46
- val showBadge: Boolean = false,
47
- val name: Map<String, String> = emptyMap(),
48
- val showRightIcon: Boolean = true,
49
- ) {
50
- fun toMap(): Map<String, Any> {
51
- return mapOf(
52
- "key" to key,
53
- "icon" to icon,
54
- "showBadge" to showBadge,
55
- "name" to name,
56
- "showRightIcon" to showRightIcon
57
- )
58
- }
59
- }
60
-
61
- data class ToolGroup(
62
- val title: Map<String, String> = emptyMap(),
63
- val items: List<Tool>
64
- ) {
65
- fun toMap(): Map<String, Any> {
66
- return mapOf(
67
- "title" to title,
68
- "items" to items.map { it.toMap() }
69
- )
70
- }
71
- }
72
-
73
- data class NavigationButtonConfig(
74
- val icon: String,
75
- val onPress: () -> Unit
76
- )
77
-
78
- object Spacing {
79
- val M = 16.dp
80
- val S = 8.dp
81
- val XXS = 2.dp
82
- }
83
-
84
- @Deprecated("Use vn.momo.kits.navigation.component.HeaderRight instead", ReplaceWith("vn.momo.kits.navigation.component.HeaderRight"))
85
- @Composable
86
- fun HeaderRight(
87
- headerRight: HeaderRightData? = null,
88
- opacity: Float = 1f,
89
- animatedHeader: AnimatedHeader? = null,
90
- tintColor: Color? = null,
91
- ) {
92
- Row(
93
- verticalAlignment = Alignment.CenterVertically,
94
- ) {
95
- ToolkitHeaderRight(headerRight = headerRight, opacity = opacity, animatedHeader = animatedHeader, tintColor = tintColor)
96
- }
97
- }
98
-
99
- private fun getNavigationButtonConfig(
100
- headerRight: HeaderRightData? = null,
101
- isFavorite: Boolean = false,
102
- onPressShortcut: () -> Unit,
103
- onPressMore: () -> Unit
104
- ): NavigationButtonConfig {
105
- val totalTools = headerRight?.tools?.sumOf { it.items.size } ?: 0
106
- var icon = if (isFavorite) "pin_star_checked" else "pin_star"
107
- var onClickHandler = onPressShortcut
108
- if (totalTools > 1 || headerRight?.useMore == true) {
109
- icon = "navigation_more_icon"
110
- onClickHandler = onPressMore
111
- } else if (totalTools == 1 && !headerRight?.tools.isNullOrEmpty()) {
112
- val singleTool = headerRight?.tools?.first()?.items?.firstOrNull()
113
- if (singleTool != null) {
114
- icon = singleTool.icon
115
- onClickHandler = {
116
- headerRight.toolCallback?.invoke(singleTool.key)
117
- }
118
- }
119
- }
120
- return NavigationButtonConfig(icon, onClickHandler)
121
- }
122
-
123
- @Composable
124
- private fun ToolkitHeaderRight(
125
- headerRight: HeaderRightData? = null,
126
- opacity: Float = 1f,
127
- animatedHeader: AnimatedHeader? = null,
128
- tintColor: Color? = null
129
- ) {
130
- var isFavorite by remember { mutableStateOf(false) }
131
- val isLoading by remember { mutableStateOf(false) }
132
- val api = PlatformApi.current as? ComposeApi
133
- val context = ApplicationContext.current
134
-
135
- fun onPressShortcut() {
136
- api?.request("onToolAction", mapOf("item" to mapOf("key" to "onFavorite"))) {
137
- isFavorite = !isFavorite
138
- }
139
- }
140
-
141
- fun onPressHelpCenter() {
142
- val paramMap = mapOf(
143
- "appId" to context?.appId,
144
- "code" to context?.appCode,
145
- "name" to context?.appName,
146
- "icon" to context?.appIcon,
147
- "description" to context?.description
148
- )
149
- api?.request("showHelpCenter", paramMap) {
150
-
151
- }
152
- }
153
-
154
- fun onPressClose() {
155
- api?.request("dismissAll", "", { _ -> })
156
- }
157
-
158
- fun onPressMore() {
159
- api?.request(
160
- "showTools",
161
- mapOf(
162
- "useSystemTools" to headerRight?.useSystemTools,
163
- "tools" to headerRight?.tools?.map { it.toMap() },
164
- "context" to mapOf(
165
- "appId" to context?.appId,
166
- "code" to context?.appCode,
167
- "name" to context?.appName,
168
- "icon" to context?.appIcon,
169
- "description" to context?.description,
170
- "support" to context?.support,
171
- "toolkitConfig" to context?.toolkitConfig,
172
- "providerId" to context?.providerId,
173
- "permissions" to context?.permissions
174
- )
175
- )
176
- ) { response ->
177
- try {
178
- val json = Json.parseToJsonElement(response).jsonObject
179
- val toolResponse = json["response"]?.jsonPrimitive?.content
180
- if (toolResponse != null) {
181
- headerRight?.toolCallback?.invoke(toolResponse)
182
- }
183
- } catch (e: Exception) {
184
- println("Error parsing response: $e")
185
- }
186
- }
187
- }
188
-
189
- val navButtonConfig = getNavigationButtonConfig(
190
- headerRight,
191
- isFavorite,
192
- ::onPressShortcut,
193
- ::onPressMore
194
- )
195
-
196
- val showBadge = headerRight?.tools?.any { group ->
197
- group.items.any { it.showBadge }
198
- }
199
-
200
- val toolkitWidth = if (context !== null) 65.dp else 28.dp
201
-
202
- var isShowShortcut = headerRight?.useShortcut == true
203
-
204
- if (headerRight?.useMore == true && context == null) {
205
- isShowShortcut = false
206
- }
207
-
208
- val color = getHeaderColor(animatedHeader, opacity, tintColor, AppTheme.current.colors.text.default)
209
- val tintIconColor = color.tintIconColor
210
- val backgroundButton = color.backgroundButton
211
- val borderColor = color.borderColor
212
-
213
- Row(
214
- verticalAlignment = Alignment.CenterVertically
215
- ) {
216
- if (isShowShortcut) {
217
- NavigationButton(
218
- disabled = isLoading,
219
- icon = navButtonConfig.icon,
220
- showBadge = showBadge,
221
- onClick = navButtonConfig.onPress,
222
- tintColor = tintIconColor
223
- )
224
- }
225
- Row(
226
- verticalAlignment = Alignment.CenterVertically,
227
- horizontalArrangement = Arrangement.Center,
228
- modifier = Modifier
229
- .padding(start = Spacing.S)
230
- .border(0.2.dp, borderColor, shape = RoundedCornerShape(14.dp))
231
- .width(toolkitWidth)
232
- .height(28.dp)
233
- .clip(shape = RoundedCornerShape(14.dp))
234
- .background(backgroundButton)
235
- ) {
236
- if (context != null) {
237
- Icon(
238
- source = "help_center",
239
- size = 20.dp,
240
- color = tintIconColor,
241
- modifier = Modifier.padding(4.dp).clickable {
242
- onPressHelpCenter()
243
- })
244
- Box(
245
- modifier = Modifier
246
- .width(0.5.dp)
247
- .height(12.dp)
248
- .background(tintColor ?: Colors.black_20)
249
- )
250
- }
251
-
252
- Icon(
253
- source = "16_basic_home",
254
- size = 20.dp,
255
- color = tintIconColor,
256
- modifier = Modifier.padding(4.dp).clickable { onPressClose() }
257
- )
258
- }
259
- }
260
- }
261
-
262
- @Deprecated("Use vn.momo.kits.navigation.component instead", ReplaceWith("vn.momo.kits.navigation.component"))
263
- @Composable
264
- fun NavigationButton(
265
- disabled: Boolean,
266
- icon: String,
267
- showBadge: Boolean? = false,
268
- onClick: () -> Unit,
269
- tintColor: Color?
270
- ) {
271
- val backgroundButton = if (tintColor == Colors.black_01) Colors.black_20.copy(alpha = 0.6f) else Colors.black_01.copy(alpha = 0.6f)
272
- val borderColor = if (tintColor == Colors.black_01) Colors.black_01.copy(alpha = 0.2f) else Colors.black_20.copy(alpha = 0.2f)
273
-
274
- Box(
275
- modifier = Modifier
276
- .size(28.dp)
277
- .clickable(enabled = !disabled, onClick = onClick)
278
- ) {
279
- Box(
280
- modifier = Modifier
281
- .matchParentSize()
282
- .clip(CircleShape)
283
- .background(backgroundButton)
284
- .border(0.2.dp, borderColor, CircleShape)
285
- )
286
- Box(
287
- modifier = Modifier.matchParentSize(),
288
- contentAlignment = Alignment.Center
289
- ) {
290
- Icon(
291
- source = icon,
292
- size = 20.dp,
293
- color = tintColor
294
- )
295
- }
296
-
297
- if (showBadge == true) {
298
- BadgeDot(
299
- size = DotSize.Small,
300
- modifier = Modifier
301
- .align(Alignment.TopEnd)
302
- .offset(x = -Spacing.XXS, y = -Spacing.XXS)
303
- )
304
- }
305
- }
306
- }
@@ -1,33 +0,0 @@
1
- package vn.momo.kits.application
2
-
3
- import androidx.compose.runtime.Composable
4
- import androidx.compose.ui.Modifier
5
- import androidx.compose.ui.graphics.Color
6
- import androidx.compose.ui.text.style.TextAlign
7
- import androidx.compose.ui.text.style.TextOverflow
8
- import androidx.compose.ui.unit.sp
9
- import androidx.compose.ui.zIndex
10
- import vn.momo.kits.components.Text
11
- import vn.momo.kits.const.Typography
12
-
13
- @Deprecated("Use vn.momo.kits.navigation.component instead", ReplaceWith("vn.momo.kits.navigation.component"))
14
- @Composable
15
- fun HeaderTitle(
16
- title: String = "",
17
- modifier: Modifier = Modifier,
18
- textAlign: TextAlign = TextAlign.Start,
19
- color: Color? = null,
20
- ) {
21
- Text(
22
- modifier = Modifier.then(modifier).zIndex(1f),
23
- text = title,
24
- textAlign = textAlign,
25
- style = Typography.actionSBold.copy(
26
- fontSize = 15.sp,
27
- lineHeight = 22.sp,
28
- ),
29
- color = color,
30
- maxLines = 1,
31
- overflow = TextOverflow.Ellipsis
32
- )
33
- }