@momo-kits/native-kits 0.168.1-beta.3-debug → 0.168.1-beta.30

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 (179) hide show
  1. package/CLAUDE.md +14 -10
  2. package/README.md +2 -10
  3. package/ios/Application/ApplicationEnvironment.swift +7 -6
  4. package/ios/Application/DesignSystemKits.swift +163 -0
  5. package/ios/Application/DesignSystemKitsPayload.swift +68 -0
  6. package/ios/Badge/BadgeRibbon.swift +8 -1
  7. package/ios/Extensions/Color++.swift +2 -4
  8. package/ios/Input/Input.swift +13 -3
  9. package/ios/Input/InputPhoneNumber.swift +1 -3
  10. package/ios/Input/InputSearch.swift +1 -2
  11. package/ios/Input/InputTextArea.swift +5 -3
  12. package/ios/InputMoney/InputMoney.swift +6 -7
  13. package/ios/Layout/ScreenLayout.swift +65 -10
  14. package/ios/Navigation/BottomSheet.swift +152 -21
  15. package/ios/Navigation/BottomTab/BottomTab.swift +12 -18
  16. package/ios/Navigation/BottomTab/BottomTabBar.swift +255 -114
  17. package/ios/Navigation/BottomTab/CurvedContainer.swift +51 -47
  18. package/ios/Navigation/BottomTab/DuoBarCompression.swift +2 -3
  19. package/ios/Navigation/BottomTab/DuoTabBar.swift +63 -172
  20. package/ios/Navigation/BottomTab/TabBarMetrics.swift +88 -0
  21. package/ios/Navigation/Component/HeaderBackground.swift +22 -1
  22. package/ios/Navigation/Component/SnackBar.swift +4 -0
  23. package/ios/Navigation/ModalScreen.swift +7 -3
  24. package/ios/Navigation/StackScreen.swift +6 -8
  25. package/ios/Popup/PopupDisplay.swift +2 -2
  26. package/ios/Popup/PopupInput.swift +2 -2
  27. package/ios/Popup/PopupLayout.swift +15 -10
  28. package/ios/Popup/PopupNotify.swift +2 -2
  29. package/ios/Stepper/Stepper.swift +1 -2
  30. package/ios/Template/TrustBanner/TrustBanner.swift +4 -2
  31. package/ios/Typography/FontScale.swift +29 -15
  32. package/ios/Typography/Text.swift +86 -12
  33. package/ios/Typography/Typography.swift +2 -2
  34. package/ios/native-kits.podspec +1 -1
  35. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  36. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +224 -59
  37. package/package.json +1 -1
  38. package/publish.sh +2 -7
  39. package/build.gradle.kts +0 -13
  40. package/compose/build.gradle.kts +0 -197
  41. package/compose/build.gradle.kts.backup +0 -197
  42. package/compose/compose.podspec +0 -47
  43. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -19
  44. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
  45. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
  46. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
  47. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -153
  48. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +0 -6
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -124
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -1071
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -269
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -65
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -81
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -357
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -115
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -542
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -86
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -231
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -189
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -478
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -114
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -265
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -235
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -223
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -265
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -185
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -84
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -361
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -108
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -308
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -90
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -330
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -473
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -207
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -92
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -560
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -125
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -207
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -501
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -236
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -180
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -16
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitDesignSystem.kt +0 -18
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +0 -22
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -194
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -283
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -54
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -50
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +0 -309
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -41
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -338
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -137
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -116
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -215
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -404
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
  131. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -732
  132. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
  133. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -40
  134. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -233
  135. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -217
  136. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  137. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +0 -98
  138. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +0 -312
  139. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -169
  140. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -455
  141. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -103
  142. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -106
  143. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -74
  144. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -413
  145. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -39
  146. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -363
  147. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HelpCenterRequest.kt +0 -37
  148. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +0 -192
  149. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -133
  150. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/ToolkitRequests.kt +0 -41
  151. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -135
  152. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
  153. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -91
  154. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
  155. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -74
  156. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +0 -13
  157. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  158. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
  159. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  160. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -118
  161. package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/HelpCenterRequestTest.kt +0 -44
  162. package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/ToolkitRequestsTest.kt +0 -62
  163. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -40
  164. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
  165. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -36
  166. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
  167. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
  168. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -217
  169. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +0 -94
  170. package/gradle/libs.versions.toml +0 -76
  171. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  172. package/gradle/wrapper/gradle-wrapper.properties +0 -10
  173. package/gradle.properties +0 -26
  174. package/gradlew +0 -252
  175. package/gradlew.bat +0 -94
  176. package/ios/Typography/FontScaleStore.swift +0 -58
  177. package/ios/Typography/KitDesignSystem.swift +0 -17
  178. package/ios-demo/README.md +0 -120
  179. package/settings.gradle.kts +0 -64
@@ -1,269 +0,0 @@
1
- package vn.momo.kits.application
2
-
3
- import androidx.compose.runtime.Immutable
4
- import androidx.compose.runtime.Stable
5
- import androidx.compose.runtime.getValue
6
- import androidx.compose.runtime.mutableStateOf
7
- import androidx.compose.runtime.setValue
8
- import androidx.compose.runtime.staticCompositionLocalOf
9
-
10
- /** Translation dictionary keyed by language; both `vi` and `en` are required. */
11
- @Immutable
12
- data class LocalizationObject(
13
- val vi: Map<String, String> = emptyMap(),
14
- val en: Map<String, String> = emptyMap(),
15
- )
16
-
17
- /**
18
- * Translation gateway, ported from momo-kits React Native (`Application/Localize.ts`).
19
- * Holds the merged dictionary (kit defaults + host overrides) and the active language,
20
- * switched at runtime via [changeLanguage]. Language is snapshot-backed, so a switch
21
- * recomposes consumers of [translate]/[translateData].
22
- */
23
- @Stable
24
- class Localize(translations: LocalizationObject = LocalizationObject()) {
25
-
26
- private var assets by mutableStateOf(merge(defaultLanguage, translations))
27
-
28
- private var language by mutableStateOf(VI)
29
-
30
- val currentLanguage: String get() = language
31
-
32
- fun changeLanguage(language: String?) {
33
- this.language = if (language == EN) EN else VI
34
- }
35
-
36
- fun translate(key: String): String {
37
- val dictionary = if (language == EN) assets.en else assets.vi
38
- return dictionary[key]?.takeIf { it.isNotEmpty() } ?: key
39
- }
40
-
41
- fun translateData(data: Map<String, String>): String =
42
- data[language] ?: data.entries.joinToString(prefix = "{", postfix = "}") {
43
- "\"${it.key}\":\"${it.value}\""
44
- }
45
-
46
- fun translateData(vi: String, en: String): String = if (language == EN) en else vi
47
-
48
- fun addTranslations(translations: LocalizationObject) {
49
- assets = merge(translations, assets)
50
- }
51
-
52
- companion object {
53
- const val VI = "vi"
54
- const val EN = "en"
55
-
56
- private fun merge(base: LocalizationObject, override: LocalizationObject) = LocalizationObject(vi = base.vi + override.vi, en = base.en + override.en)
57
-
58
- private val defaultLanguage = LocalizationObject(
59
- vi = mapOf(
60
- "errorCode" to "Mã lỗi: ",
61
- "seeMore" to "Xem thêm",
62
- "cancel" to "Huỷ",
63
- "done" to "Xong",
64
- "confirm" to "Xác nhận",
65
- "month" to "tháng",
66
- "day" to "ngày",
67
- "choose" to "Chọn",
68
- "sent" to "Đã gửi",
69
- "received" to "Đã tiếp nhận",
70
- "processing" to "Đang xử lý",
71
- "processed" to "Đã xử lý",
72
- "addImg" to "Thêm hình",
73
- "chooseBtn" to "Chọn button",
74
- "imgEg" to "Hình ảnh tham khảo",
75
- "filter" to "Sắp xếp",
76
- "shipping" to "Đang giao hàng",
77
- "men" to "Nam",
78
- "women" to "Nữ",
79
- "more" to "Khác",
80
- "expDate" to "Ngày hết hạn",
81
- "exp" to "HSD",
82
- "inActive" to "Chưa kích hoạt",
83
- "voucherRemindHour" to "Hết hạn sau {hours} giờ",
84
- "voucherRemindMinute" to "Hết hạn sau {minutes} phút",
85
- "voucherRemindSecond" to "Hết hạn sau {seconds} giây",
86
- "voucherRemindDay" to "Hết hạn sau {days} ngày",
87
- "chooseRoundtrip" to "Chọn vé khứ hồi",
88
- "depart" to "Ngày đi",
89
- "return" to "Ngày về",
90
- "departing" to "Đi",
91
- "returning" to "Về",
92
- "jan" to "Tháng 1",
93
- "feb" to "Tháng 2",
94
- "mar" to "Tháng 3",
95
- "apr" to "Tháng 4",
96
- "may" to "Tháng 5",
97
- "jun" to "Tháng 6",
98
- "jul" to "Tháng 7",
99
- "aug" to "Tháng 8",
100
- "sep" to "Tháng 9",
101
- "oct" to "Tháng 10",
102
- "nov" to "Tháng 11",
103
- "dec" to "Tháng 12",
104
- "mon" to "T2",
105
- "tue" to "T3",
106
- "wed" to "T4",
107
- "thu" to "T5",
108
- "fri" to "T6",
109
- "sat" to "T7",
110
- "sun" to "CN",
111
- "showLunar" to "Hiển thị lịch âm",
112
- "newYear" to "Tết Dương lịch",
113
- "valentine" to "Ngày Lễ Tình nhân",
114
- "womenDay" to "Ngày Quốc tế Phụ nữ",
115
- "liberationDay" to "Ngày giải phóng Miền Nam thống nhất đất nước",
116
- "laborDay" to "Ngày Quốc tế Lao động",
117
- "childrenDay" to "Ngày Quốc tế Thiếu nhi",
118
- "nationalDay" to "Quốc khánh nước CHXHCN Việt Nam",
119
- "womenDayVN" to "Ngày Phụ nữ Việt Nam",
120
- "teacherDay" to "Ngày Nhà giáo Việt Nam",
121
- "christmasEve" to "Ngày Lễ Giáng Sinh",
122
- "christmas" to "Ngày Lễ Giáng Sinh",
123
- "lunarNewYear" to "Tết Nguyên Đán",
124
- "hungKingDay" to "Giỗ Tổ Hùng Vương",
125
- "balance" to "Số dư trong ví",
126
- "chooseDate" to "Chọn ngày tháng năm",
127
- "year" to "năm",
128
- "hour" to "giờ",
129
- "minute" to "phút",
130
- "from" to "Từ",
131
- "to" to "Đến",
132
- "connected" to "Đã kết nối",
133
- "disconnected" to "Mất kết nối",
134
- "hide" to "Ẩn",
135
- "viewAllTitle" to "Xem tất cả",
136
- "headerTitle" to "Lịch sử thanh toán",
137
- "SHORTEN" to "THU GỌN",
138
- "viewMoreBank" to "XEM THÊM (\${otherItemCount} ngân hàng)",
139
- "transaction_success" to "Thành công",
140
- "transaction_fail" to "Thất bại",
141
- "transaction_processing" to "Đang xử lý",
142
- "viewMore" to "Xem thêm",
143
- "shorten" to "Thu gọn",
144
- "Payment" to "Thanh toán \${serviceName}",
145
- "currencyUnit" to "đ",
146
- "Month" to "Tháng",
147
- "save" to "Lưu",
148
- "favoriteIn" to "Thêm dịch vụ yêu thích",
149
- "favoriteOut" to "Xóa dịch vụ yêu thích",
150
- "deviceIn" to "Thêm vào thiết bị",
151
- "setting" to "Cài đặt",
152
- "transaction" to "Lịch sử giao dịch",
153
- "share" to "Chia sẽ dịch vụ",
154
- "information" to "Thông tin chung",
155
- "tutorial" to "Hướng dẫn sử dụng",
156
- "question" to "Câu hỏi thường gặp",
157
- "support" to "Trung tâm hỗ trợ",
158
- "skip" to "Bỏ qua",
159
- "enterPhoneNumber" to "Vui lòng nhập số điện thoại",
160
- "invalidPhoneNumber" to "Số điện thoại không đúng",
161
- ),
162
- en = mapOf(
163
- "seeMore" to "See more",
164
- "cancel" to "Cancel",
165
- "done" to "Done",
166
- "confirm" to "Confirm",
167
- "month" to "month",
168
- "day" to "day",
169
- "choose" to "Choose",
170
- "sent" to "Sent",
171
- "received" to "Received",
172
- "processing" to "Processing",
173
- "processed" to "Done",
174
- "addImg" to "Add image",
175
- "chooseBtn" to "Choose button",
176
- "imgEg" to "Example images",
177
- "filter" to "Filter",
178
- "shipping" to "Shipping",
179
- "men" to "Men",
180
- "women" to "Women",
181
- "more" to "More",
182
- "expDate" to "Expiration date",
183
- "exp" to "EXP",
184
- "inActive" to "Not Activated",
185
- "voucherRemindHour" to "Revoke after {hours} hours",
186
- "voucherRemindMinute" to "Revoke after {minutes} minutes",
187
- "voucherRemindSecond" to "Revoke after {seconds} seconds",
188
- "voucherRemindDay" to "Revoke after {days} days",
189
- "chooseRoundtrip" to "Choose roundtrip ticket",
190
- "depart" to "Departing",
191
- "return" to "Returning",
192
- "departing" to "De",
193
- "returning" to "Re",
194
- "jan" to "January",
195
- "feb" to "February",
196
- "mar" to "March",
197
- "apr" to "April",
198
- "may" to "May",
199
- "jun" to "June",
200
- "jul" to "July",
201
- "aug" to "August",
202
- "sep" to "September",
203
- "oct" to "October",
204
- "nov" to "November",
205
- "dec" to "December",
206
- "mon" to "Mon",
207
- "tue" to "Tue",
208
- "wed" to "Wed",
209
- "thu" to "Thu",
210
- "fri" to "Fri",
211
- "sat" to "Sat",
212
- "sun" to "Sun",
213
- "showLunar" to "Show Lunar Calendar",
214
- "newYear" to "New Year's Day",
215
- "valentine" to "Valentine's Day",
216
- "womenDay" to "International Women's Day",
217
- "liberationDay" to "Liberation Day",
218
- "laborDay" to "Internation Labor's Day",
219
- "childrenDay" to "International Labor's Day",
220
- "nationalDay" to "National Day",
221
- "womenDayVN" to "Vietnamese Women's Day",
222
- "teacherDay" to "Teacher's Day",
223
- "christmasEve" to "Christmas Eve",
224
- "christmas" to "Christmas Day",
225
- "lunarNewYear" to "Lunar New Year",
226
- "hungKingDay" to "Hung Kings' Festival",
227
- "balance" to "Wallet Balance",
228
- "chooseDate" to "Choose date",
229
- "year" to "year",
230
- "hour" to "hour",
231
- "minute" to "minute",
232
- "from" to "From",
233
- "to" to "To",
234
- "connected" to "Connected",
235
- "disconnected" to "Disconnected",
236
- "hide" to "Hide",
237
- "viewAllTitle" to "View all",
238
- "headerTitle" to "Transaction history",
239
- "SHORTEN" to "SHORTEN",
240
- "viewMoreBank" to "VIEW MORE (\${otherItemCount} banks)",
241
- "transaction_success" to "Success",
242
- "transaction_fail" to "Fail",
243
- "transaction_processing" to "Processing",
244
- "viewMore" to "View more",
245
- "shorten" to "Shorten",
246
- "Payment" to "\${serviceName} payment",
247
- "currencyUnit" to "VND",
248
- "Month" to "Month",
249
- "save" to "Save",
250
- "favoriteIn" to "Add to favorite services",
251
- "favoriteOut" to "Remove to favorite services",
252
- "deviceIn" to "Add to device",
253
- "setting" to "Settings",
254
- "transaction" to "Transaction History",
255
- "share" to "Share",
256
- "information" to "Information",
257
- "tutorial" to "Instruction",
258
- "question" to "FAQ",
259
- "support" to "Support center",
260
- "errorCode" to "Error code: ",
261
- "skip" to "Skip",
262
- "enterPhoneNumber" to "Please enter your phone number",
263
- "invalidPhoneNumber" to "Invalid phone number",
264
- ),
265
- )
266
- }
267
- }
268
-
269
- val LocalLocalize = staticCompositionLocalOf { Localize() }
@@ -1,65 +0,0 @@
1
- package vn.momo.kits.application
2
-
3
- import androidx.compose.runtime.Composable
4
- import androidx.compose.runtime.CompositionLocalProvider
5
- // AI-GENERATED START: own the typed language request
6
- import androidx.compose.runtime.DisposableEffect
7
- // AI-GENERATED END: own the typed language request
8
- import androidx.compose.runtime.remember
9
- import vn.momo.kits.const.AppTheme
10
- import vn.momo.kits.const.Theme
11
- import vn.momo.kits.navigation.LocalMaxApi
12
- import vn.momo.kits.platform.ProvideOsFontScale
13
- // AI-GENERATED START: consume typed NativeMaxApi results
14
- import vn.momo.maxapi.IMaxApi
15
- import vn.momo.maxapi.runtime.ApiResult
16
- // AI-GENERATED END: consume typed NativeMaxApi results
17
-
18
-
19
- @Composable
20
- fun WidgetContainer(
21
- theme: Theme? = null,
22
- miniAppContext: MiniAppContext? = null,
23
- maxApi: IMaxApi? = null,
24
- localize: Localize? = null,
25
- content: @Composable () -> Unit,
26
- ) {
27
- val parentContext = LocalContext.current
28
- val mergedContext = remember(parentContext, miniAppContext) {
29
- MiniAppContext.merge(parentContext, miniAppContext)
30
- }
31
- val resolvedTheme = theme ?: AppTheme.current
32
- val resolvedLocalize = localize ?: LocalLocalize.current
33
- val resolvedMaxApi = maxApi ?: LocalMaxApi.current
34
-
35
- // AI-GENERATED START: cancel language delivery when its composition owner changes
36
- DisposableEffect(resolvedMaxApi, localize) {
37
- val api = resolvedMaxApi
38
- val target = localize
39
- var active = true
40
- val handle = runCatching {
41
- api?.getLanguage { result ->
42
- if (active && target != null && result is ApiResult.Success &&
43
- result.value.trim().lowercase().startsWith(Localize.EN)) {
44
- target.changeLanguage(Localize.EN)
45
- }
46
- }
47
- }.getOrNull()
48
- onDispose {
49
- active = false
50
- handle?.cancel()
51
- }
52
- }
53
- // AI-GENERATED END: cancel language delivery when its composition owner changes
54
-
55
- ProvideOsFontScale {
56
- CompositionLocalProvider(
57
- AppTheme provides resolvedTheme,
58
- LocalContext provides mergedContext,
59
- LocalLocalize provides resolvedLocalize,
60
- LocalMaxApi provides resolvedMaxApi,
61
- ) {
62
- content()
63
- }
64
- }
65
- }
@@ -1,157 +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.layout.Box
6
- import androidx.compose.foundation.layout.fillMaxSize
7
- import androidx.compose.foundation.layout.offset
8
- import androidx.compose.foundation.layout.size
9
- import androidx.compose.foundation.shape.RoundedCornerShape
10
- import androidx.compose.runtime.Composable
11
- import androidx.compose.runtime.remember
12
- import androidx.compose.ui.Alignment
13
- import androidx.compose.ui.Modifier
14
- import androidx.compose.ui.draw.clip
15
- import androidx.compose.ui.semantics.contentDescription
16
- import androidx.compose.ui.semantics.semantics
17
- import androidx.compose.ui.unit.dp
18
- import androidx.compose.ui.zIndex
19
- import vn.momo.kits.application.IsShowBaseLineDebug
20
- import vn.momo.kits.const.AppTheme
21
- import vn.momo.kits.const.Colors
22
- import vn.momo.kits.const.Spacing
23
- import vn.momo.kits.const.Typography
24
- import vn.momo.kits.modifier.conditional
25
- import vn.momo.kits.modifier.setAutomationId
26
-
27
- private const val LOGO_MOMO_URL =
28
- "https://static.momocdn.net/app/img/kits/logo_momo_circle.png"
29
- private const val ICON_SUPPORT_DEFAULT_URL =
30
- "https://static.momocdn.net/app/img/kits/_indicator.png"
31
-
32
- enum class AvatarSize(val sizeDp: Int, val iconSizeDp: Int) {
33
- SIZE_24(24, 16),
34
- SIZE_32(32, 16),
35
- SIZE_40(40, 24),
36
- SIZE_48(48, 32),
37
- SIZE_56(56, 32),
38
- SIZE_72(72, 40),
39
- }
40
-
41
- @Composable
42
- fun Avatar(
43
- modifier: Modifier = Modifier,
44
- size: AvatarSize = AvatarSize.SIZE_32,
45
- rounded: Boolean = true,
46
- name: String? = null,
47
- image: String? = null,
48
- showIconMomo: Boolean = false,
49
- showIconSupport: Boolean = false,
50
- iconSupport: String = ICON_SUPPORT_DEFAULT_URL,
51
- accessibilityLabel: String? = null,
52
- ) {
53
- val theme = AppTheme.current
54
-
55
- val cornerRadius = remember(rounded, size) {
56
- if (rounded) (size.sizeDp / 2).dp else Spacing.XS
57
- }
58
- val shape = remember(cornerRadius) { RoundedCornerShape(cornerRadius) }
59
-
60
- val badgeSizeDp = remember(size) { (size.iconSizeDp / 2).dp }
61
- val badgeShape = remember(size) {
62
- RoundedCornerShape((size.iconSizeDp / 4).dp)
63
- }
64
-
65
- val shouldShowIconTop = showIconMomo && rounded
66
- val shouldShowIconBottom = showIconSupport && rounded
67
-
68
- val initials = remember(name) {
69
- name?.let { avatarInitials(it) }
70
- }
71
-
72
- val automationId = remember(accessibilityLabel, name) {
73
- accessibilityLabel ?: "Avatar${if (name != null) "/$name" else ""}"
74
- }
75
-
76
- Box(
77
- modifier = modifier
78
- .size(size.sizeDp.dp)
79
- .conditional(IsShowBaseLineDebug) { border(1.dp, Colors.blue_03) }
80
- .setAutomationId(automationId)
81
- .semantics { contentDescription = automationId },
82
- ) {
83
- // Inner box with clip — holds avatar content
84
- Box(
85
- modifier = Modifier
86
- .fillMaxSize()
87
- .clip(shape)
88
- .background(color = Colors.pink_09)
89
- .border(width = 1.dp, color = theme.colors.border.default, shape = shape),
90
- contentAlignment = Alignment.Center,
91
- ) {
92
- when {
93
- image != null -> {
94
- Image(
95
- source = image,
96
- modifier = Modifier
97
- .fillMaxSize()
98
- .clip(shape)
99
- .semantics { contentDescription = "$automationId|img" },
100
- )
101
- }
102
-
103
- name != null -> {
104
- Text(
105
- text = initials ?: "",
106
- style = Typography.descriptionXsRegular,
107
- color = Colors.pink_03,
108
- modifier = Modifier
109
- .semantics { contentDescription = "$automationId|text" },
110
- )
111
- }
112
-
113
- else -> {
114
- Icon(
115
- source = "basic_person",
116
- size = size.iconSizeDp.dp,
117
- color = Colors.pink_03,
118
- modifier = Modifier
119
- .semantics { contentDescription = "$automationId|icon" },
120
- )
121
- }
122
- }
123
- }
124
-
125
- // Badge icons — outside clip so they are not cut by border
126
- if (shouldShowIconTop) {
127
- Image(
128
- source = LOGO_MOMO_URL,
129
- modifier = Modifier
130
- .zIndex(1f)
131
- .align(Alignment.TopEnd)
132
- .offset(x = 1.dp, y = (-1).dp)
133
- .size(badgeSizeDp)
134
- .clip(badgeShape)
135
- .semantics { contentDescription = "$automationId|top-icon" },
136
- )
137
- }
138
-
139
- if (shouldShowIconBottom) {
140
- Image(
141
- source = iconSupport,
142
- modifier = Modifier
143
- .zIndex(1f)
144
- .align(Alignment.BottomEnd)
145
- .offset(x = 1.dp, y = 1.dp)
146
- .size(badgeSizeDp)
147
- .clip(badgeShape)
148
- .semantics { contentDescription = "$automationId|bottom-icon" },
149
- )
150
- }
151
- }
152
- }
153
-
154
- private fun avatarInitials(name: String): String {
155
- val words = name.trim().split(" ").filter { it.isNotEmpty() }
156
- return words.takeLast(2).joinToString("") { it.first().uppercaseChar().toString() }
157
- }
@@ -1,81 +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.layout.Box
6
- import androidx.compose.foundation.layout.height
7
- import androidx.compose.foundation.layout.padding
8
- import androidx.compose.foundation.layout.widthIn
9
- import androidx.compose.foundation.shape.RoundedCornerShape
10
- import androidx.compose.runtime.Composable
11
- import androidx.compose.ui.Alignment
12
- import androidx.compose.ui.Modifier
13
- import androidx.compose.ui.graphics.Color
14
- import androidx.compose.ui.text.style.TextOverflow
15
- import androidx.compose.ui.unit.dp
16
- import vn.momo.kits.application.IsShowBaseLineDebug
17
- import vn.momo.kits.const.*
18
- import vn.momo.kits.modifier.conditional
19
-
20
- private val badgePrimaryColors = listOf(
21
- Color(0xFFF0F0F0),
22
- Color(0xFFEB2F96),
23
- Color(0xFF962AF0),
24
- Color(0xFF4E4BFF),
25
- Color(0xFF007AFF),
26
- Color(0xFF13C2C2),
27
- Color(0xFF34C759),
28
- Color(0xFFA0D911),
29
- Color(0xFFFFCC00),
30
- Color(0xFFFA8C16),
31
- Color(0xFFFA541C),
32
- Color(0xFFF5222D)
33
- )
34
-
35
- private val badgeNumberRegex = "^\\d+$".toRegex()
36
-
37
- @Composable
38
- fun Badge(label: String = "Label", backgroundColor: Color? = null, modifier: Modifier = Modifier) {
39
- fun isNumber(label: String): Boolean = badgeNumberRegex.matches(label)
40
-
41
- fun formatTitle(label: String): String {
42
- // Digits too long for Int are well over 99; toInt() would throw.
43
- if (isNumber(label) && (label.toIntOrNull() ?: Int.MAX_VALUE) > 99) {
44
- return "99+"
45
- }
46
- return label
47
- }
48
-
49
- var badgeColor =
50
- if (isNumber(label)) {
51
- AppTheme.current.colors.error.primary
52
- } else {
53
- AppTheme.current.colors.warning.primary
54
- }
55
-
56
- if (backgroundColor != null && badgePrimaryColors.contains(backgroundColor)) {
57
- badgeColor = backgroundColor
58
- }
59
- val scaleSize = scaleSize(16f)
60
-
61
- Box(
62
- modifier = modifier
63
- .height(scaleSize.dp)
64
- .widthIn(min = scaleSize.dp)
65
- .background(color = badgeColor, shape = RoundedCornerShape(Radius.M))
66
- .border(width = 1.dp, shape = RoundedCornerShape(Radius.M), color = Colors.black_01)
67
- .conditional(IsShowBaseLineDebug) {
68
- border(1.dp, Colors.blue_03)
69
- }
70
- .padding(horizontal = Spacing.XS),
71
- contentAlignment = Alignment.Center
72
- ) {
73
- Text(
74
- text = formatTitle(label),
75
- color = Colors.black_01,
76
- style = Typography.actionXxsBold,
77
- maxLines = 1,
78
- overflow = TextOverflow.Ellipsis
79
- )
80
- }
81
- }
@@ -1,32 +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.layout.Box
6
- import androidx.compose.foundation.layout.size
7
- import androidx.compose.foundation.shape.RoundedCornerShape
8
- import androidx.compose.runtime.Composable
9
- import androidx.compose.ui.Modifier
10
- import androidx.compose.ui.unit.dp
11
- import vn.momo.kits.application.IsShowBaseLineDebug
12
- import vn.momo.kits.const.Colors
13
- import vn.momo.kits.const.Radius
14
- import vn.momo.kits.modifier.conditional
15
-
16
- enum class DotSize(val size: Int) {
17
- Small(10),
18
- Large(16)
19
- }
20
-
21
- @Composable
22
- fun BadgeDot(size: DotSize = DotSize.Large, modifier: Modifier = Modifier) {
23
- Box(
24
- modifier = modifier
25
- .size(size.size.dp)
26
- .border(width = 1.dp, color = Colors.black_01, shape = RoundedCornerShape(Radius.S))
27
- .background(color = Colors.red_03, shape = RoundedCornerShape(Radius.S))
28
- .conditional(IsShowBaseLineDebug) {
29
- border(1.dp, Colors.blue_03)
30
- }
31
- )
32
- }