@momo-kits/native-kits 0.169.8-beta.6-debug → 0.169.8-beta.7

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