@momo-kits/native-kits 0.169.12-beta.2-debug → 0.169.12-beta.3

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