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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/.codegraph/.gitignore +5 -0
  2. package/CLAUDE.md +78 -0
  3. package/compose/build.gradle.kts +12 -8
  4. package/compose/build.gradle.kts.backup +11 -7
  5. package/compose/compose.podspec +1 -1
  6. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +2 -7
  7. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +12 -13
  8. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +6 -24
  9. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +4 -19
  10. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +1 -10
  11. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +2 -2
  12. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +1 -1
  13. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +1 -1
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +6 -17
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +1 -1
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +6 -101
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +5 -19
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +8 -33
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +1 -1
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +22 -25
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +27 -29
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +3 -26
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +27 -26
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +3 -13
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -5
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +3 -11
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +3 -18
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +11 -11
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +3 -11
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +69 -26
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +1 -5
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +84 -59
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +13 -71
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +10 -51
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +6 -1
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +4 -21
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +1 -1
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +16 -75
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +5 -26
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +1 -1
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +3 -11
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +16 -40
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +3 -9
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -28
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +2 -13
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +4 -10
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +3 -28
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +8 -47
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +4 -25
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +2 -11
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +1 -17
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +1 -6
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +50 -111
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +1 -5
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +7 -8
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +1 -12
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +4 -96
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +5 -7
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +2 -12
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +9 -21
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +2 -2
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +9 -14
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +8 -11
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +1 -1
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +24 -40
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +1 -1
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -5
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -2
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +94 -4
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -2
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +2 -2
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +3 -7
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +5 -15
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +65 -24
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +48 -33
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +58 -57
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +28 -25
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +13 -31
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +1 -1
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +6 -24
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +11 -6
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +2 -1
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +9 -6
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +1 -1
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +3 -13
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +3 -2
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +1 -40
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -2
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -8
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +2 -17
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +1 -1
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +3 -3
  94. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +2 -3
  95. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -2
  96. package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Example.xcscheme +32 -0
  97. package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  98. package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  99. package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/WorkspaceSettings.xcsettings +16 -0
  100. package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +6 -0
  101. package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +5 -0
  102. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +58 -0
  103. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Pods-Example.xcscheme +58 -0
  104. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImage.xcscheme +58 -0
  105. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +58 -0
  106. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SkeletonUI.xcscheme +58 -0
  107. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios-LottiePrivacyInfo.xcscheme +58 -0
  108. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios.xcscheme +58 -0
  109. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +60 -0
  110. package/gradle/libs.versions.toml +2 -0
  111. package/gradle.properties +1 -1
  112. package/ios/Application/ApplicationEnvironment.swift +1 -0
  113. package/ios/Application/FontScaleStore.swift +59 -0
  114. package/ios/Typography/Text.swift +12 -7
  115. package/ios/Typography/Typography.swift +13 -8
  116. package/local.properties +8 -0
  117. package/package.json +1 -1
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -17
@@ -0,0 +1,269 @@
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,23 +1,11 @@
1
1
  package vn.momo.kits.application
2
2
 
3
3
  import androidx.compose.foundation.layout.Box
4
- import androidx.compose.foundation.layout.fillMaxSize
5
4
  import androidx.compose.foundation.layout.wrapContentSize
6
- import androidx.compose.runtime.Composable
7
- import androidx.compose.runtime.CompositionLocalProvider
8
- import androidx.compose.runtime.LaunchedEffect
9
- import androidx.compose.runtime.getValue
10
- import androidx.compose.runtime.mutableStateOf
11
- import androidx.compose.runtime.remember
12
- import androidx.compose.runtime.setValue
13
- import androidx.compose.runtime.staticCompositionLocalOf
5
+ import androidx.compose.runtime.*
14
6
  import androidx.compose.ui.Modifier
15
7
  import androidx.compose.ui.unit.Dp
16
- import vn.momo.kits.const.AppStatusBar
17
- import vn.momo.kits.const.AppTheme
18
- import vn.momo.kits.const.Theme
19
- import vn.momo.kits.const.ThemeAssets
20
- import vn.momo.kits.const.defaultTheme
8
+ import vn.momo.kits.const.*
21
9
  import vn.momo.kits.modifier.DeprecatedModifier
22
10
  import vn.momo.kits.platform.getStatusBarHeight
23
11
 
@@ -81,7 +69,7 @@ fun ApplicationContainer(
81
69
  composeApi: ComposeApi? = null,
82
70
  statusBarHeight: Dp? = AppStatusBar.current,
83
71
  applicationContext: MiniAppContext? = null,
84
- config: KitConfig? = null,
72
+ config: DesignSystemConfig? = null,
85
73
  language: String? = null,
86
74
  isWhiteList: Boolean = false,
87
75
  content: @Composable () -> Unit,
@@ -109,13 +97,11 @@ fun ApplicationContainer(
109
97
  AppTheme provides appTheme,
110
98
  PlatformApi provides composeApi,
111
99
  AppStatusBar provides appStatusBarHeight,
112
- ApplicationContext provides applicationContext,
113
- AppConfig provides config,
114
- AppLanguage provides language,
100
+ LocalContext provides applicationContext,
115
101
  ) {
116
102
  Box(Modifier.wrapContentSize().then(DeprecatedModifier())) {
117
103
  content()
118
104
  }
119
105
  }
120
106
 
121
- }
107
+ }
@@ -6,32 +6,10 @@ import androidx.compose.animation.core.tween
6
6
  import androidx.compose.foundation.ScrollState
7
7
  import androidx.compose.foundation.background
8
8
  import androidx.compose.foundation.gestures.detectTapGestures
9
- import androidx.compose.foundation.layout.Arrangement
10
- import androidx.compose.foundation.layout.Box
11
- import androidx.compose.foundation.layout.Column
12
- import androidx.compose.foundation.layout.Spacer
13
- import androidx.compose.foundation.layout.WindowInsets
14
- import androidx.compose.foundation.layout.asPaddingValues
15
- import androidx.compose.foundation.layout.aspectRatio
16
- import androidx.compose.foundation.layout.fillMaxSize
17
- import androidx.compose.foundation.layout.fillMaxWidth
18
- import androidx.compose.foundation.layout.height
19
- import androidx.compose.foundation.layout.ime
20
- import androidx.compose.foundation.layout.imePadding
21
- import androidx.compose.foundation.layout.navigationBars
22
- import androidx.compose.foundation.layout.offset
23
- import androidx.compose.foundation.layout.padding
9
+ import androidx.compose.foundation.layout.*
24
10
  import androidx.compose.foundation.rememberScrollState
25
11
  import androidx.compose.foundation.verticalScroll
26
- import androidx.compose.runtime.Composable
27
- import androidx.compose.runtime.CompositionLocalProvider
28
- import androidx.compose.runtime.DisposableEffect
29
- import androidx.compose.runtime.LaunchedEffect
30
- import androidx.compose.runtime.getValue
31
- import androidx.compose.runtime.mutableStateOf
32
- import androidx.compose.runtime.remember
33
- import androidx.compose.runtime.setValue
34
- import androidx.compose.runtime.staticCompositionLocalOf
12
+ import androidx.compose.runtime.*
35
13
  import androidx.compose.ui.Alignment
36
14
  import androidx.compose.ui.Modifier
37
15
  import androidx.compose.ui.graphics.Color
@@ -44,24 +22,20 @@ import androidx.compose.ui.unit.Dp
44
22
  import androidx.compose.ui.unit.IntOffset
45
23
  import androidx.compose.ui.unit.dp
46
24
  import androidx.compose.ui.zIndex
47
- import kotlinx.coroutines.CoroutineScope
48
- import kotlinx.coroutines.Dispatchers
49
- import kotlinx.coroutines.SupervisorJob
50
- import kotlinx.coroutines.cancel
51
- import kotlinx.coroutines.delay
52
- import kotlinx.coroutines.launch
25
+ import kotlinx.coroutines.*
53
26
  import vn.momo.kits.components.InputSearchProps
54
27
  import vn.momo.kits.const.AppNavigationBar
55
28
  import vn.momo.kits.const.AppTheme
56
29
  import vn.momo.kits.const.Colors
57
30
  import vn.momo.kits.const.Spacing
58
- import vn.momo.kits.modifier.DeprecatedModifier
59
31
  import vn.momo.kits.modifier.conditional
32
+ import vn.momo.kits.modifier.DeprecatedModifier
60
33
  import vn.momo.kits.modifier.shadow
61
34
  import vn.momo.kits.navigation.component.SnackBar
62
35
  import vn.momo.kits.platform.supportsImePadding
63
36
  import vn.momo.kits.utils.getAppStatusBarHeight
64
37
  import vn.momo.kits.utils.getNavigationBarHeight
38
+ import kotlin.time.Duration.Companion.milliseconds
65
39
 
66
40
  enum class HeaderType {
67
41
  DEFAULT,
@@ -281,6 +255,7 @@ fun Footer(
281
255
  .onGloballyPositioned {
282
256
  onFooterMeasured?.invoke(it.size.height)
283
257
  }
258
+
284
259
  ) {
285
260
  Box(
286
261
  Modifier.fillMaxWidth()
@@ -333,7 +308,7 @@ val LocalScreenHelper = staticCompositionLocalOf<ScreenHelper> {
333
308
  }
334
309
 
335
310
  @Composable
336
- fun ScreenSnackBarHost(footerHeightPx: Int) {
311
+ internal fun ScreenSnackBarHost(footerHeightPx: Int) {
337
312
  val helper = LocalScreenHelper.current
338
313
  val snackBarData = helper.snackBarState ?: return
339
314
  val density = LocalDensity.current
@@ -370,7 +345,7 @@ fun ScreenSnackBarHost(footerHeightPx: Int) {
370
345
  LaunchedEffect(snackBarData.type.duration) {
371
346
  val duration = snackBarData.type.duration
372
347
  if (duration != null) {
373
- delay(duration)
348
+ delay(duration.milliseconds)
374
349
  helper.hideSnackBar()
375
350
  }
376
351
  }
@@ -24,7 +24,7 @@ private const val BACK_WIDTH = 28
24
24
 
25
25
  @Deprecated("Use vn.momo.kits.navigation.component.Header instead", ReplaceWith("vn.momo.kits.navigation.component.Header"))
26
26
  @Composable
27
- fun useHeaderSearchAnimation(
27
+ internal fun useHeaderSearchAnimation(
28
28
  opacityAni: Float,
29
29
  scrollState: Int,
30
30
  headerRightWidth: Dp,
@@ -11,19 +11,15 @@ import androidx.compose.runtime.Composable
11
11
  import androidx.compose.ui.Alignment
12
12
  import androidx.compose.ui.Modifier
13
13
  import androidx.compose.ui.graphics.Color
14
+ import androidx.compose.ui.text.style.TextOverflow
14
15
  import androidx.compose.ui.unit.dp
15
16
  import vn.momo.kits.application.IsShowBaseLineDebug
16
- import vn.momo.kits.const.AppTheme
17
- import vn.momo.kits.const.Colors
18
- import vn.momo.kits.const.Radius
19
- import vn.momo.kits.const.Spacing
20
- import vn.momo.kits.const.Typography
21
- import vn.momo.kits.const.scaleSize
17
+ import vn.momo.kits.const.*
22
18
  import vn.momo.kits.modifier.conditional
23
19
 
24
20
 
25
21
  @Composable
26
- fun Badge(label: String = "Label", backgroundColor: Color? = null, modifier: Modifier? = null) {
22
+ fun Badge(label: String = "Label", backgroundColor: Color? = null, modifier: Modifier = Modifier) {
27
23
  val primaryColors = listOf(
28
24
  Color(0xFFF0F0F0),
29
25
  Color(0xFFEB2F96),
@@ -63,23 +59,24 @@ fun Badge(label: String = "Label", backgroundColor: Color? = null, modifier: Mod
63
59
  }
64
60
  val scaleSize = scaleSize(16f)
65
61
 
66
- if (modifier != null) {
67
- Box(
68
- modifier = modifier
69
- .height(scaleSize.dp)
70
- .widthIn(min = scaleSize.dp)
71
- .background(color = badgeColor, shape = RoundedCornerShape(Radius.M))
72
- .border(width = 1.dp, shape = RoundedCornerShape(Radius.M), color = Colors.black_01)
73
- .conditional(IsShowBaseLineDebug) {
74
- border(1.dp, Colors.blue_03)
75
- }
76
- .padding(horizontal = Spacing.XS), contentAlignment = Alignment.Center
77
- ) {
78
- Text(
79
- text = formatTitle(label),
80
- color = Colors.black_01,
81
- style = Typography.actionXxsBold
82
- )
83
- }
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
+ )
84
81
  }
85
82
  }
@@ -70,15 +70,15 @@ fun BadgeRibbon(
70
70
  }
71
71
 
72
72
  if (isRound) {
73
- renderRoundContent(label, rotate, theme.colors.warning.primary)
73
+ RenderRoundContent(label, rotate, theme.colors.warning.primary)
74
74
  } else {
75
- renderSkewContent(label, rotate, theme.colors.warning.primary)
75
+ RenderSkewContent(label, rotate, theme.colors.warning.primary)
76
76
  }
77
77
  }
78
78
  }
79
79
 
80
80
  @Composable
81
- fun renderRoundContent(label: String, rotate: Float, backgroundColor: Color){
81
+ internal fun RenderRoundContent(label: String, rotate: Float, backgroundColor: Color){
82
82
  Box(
83
83
  modifier = Modifier
84
84
  .height(roundHeight)
@@ -97,7 +97,7 @@ fun renderRoundContent(label: String, rotate: Float, backgroundColor: Color){
97
97
  }
98
98
 
99
99
  @Composable
100
- fun renderSkewContent(label: String, rotate: Float, backgroundColor: Color){
100
+ internal fun RenderSkewContent(label: String, rotate: Float, backgroundColor: Color){
101
101
  Box(
102
102
  modifier = Modifier
103
103
  .height(skewBodyHeight)
@@ -110,7 +110,7 @@ fun renderSkewContent(label: String, rotate: Float, backgroundColor: Color){
110
110
  }
111
111
 
112
112
  @Composable
113
- fun Label(label: String, rotate: Float){
113
+ internal fun Label(label: String, rotate: Float){
114
114
  Text(
115
115
  text = label,
116
116
  color = Colors.black_01,
@@ -122,7 +122,7 @@ fun Label(label: String, rotate: Float){
122
122
  }
123
123
 
124
124
  @Composable
125
- fun UpTail() {
125
+ internal fun UpTail() {
126
126
  Image(
127
127
  source = "https://static.momocdn.net/app/img/kits/utils/Head_down_4x.png",
128
128
  modifier = Modifier
@@ -136,7 +136,7 @@ fun UpTail() {
136
136
  }
137
137
 
138
138
  @Composable
139
- fun DownTail() {
139
+ internal fun DownTail() {
140
140
  Image(
141
141
  source = "https://static.momocdn.net/app/img/kits/utils/Head_4x.png",
142
142
  modifier = Modifier
@@ -149,7 +149,7 @@ fun DownTail() {
149
149
  }
150
150
 
151
151
  @Composable
152
- fun RightTail() {
152
+ internal fun RightTail() {
153
153
  Image(
154
154
  source = "https://static.momocdn.net/app/img/kits/utils/Tail_4x.png",
155
155
  modifier = Modifier
@@ -190,10 +190,9 @@ fun RoundedBadgeRibbon(
190
190
  val textHeight = with(density) { textLayoutResult.size.height.toDp() }
191
191
 
192
192
  val minRibbonHeight = (textHeight * 1.2f).coerceAtLeast(16.dp)
193
- val paddingBottom = minRibbonHeight / 4f
194
- val badgeHeight = minRibbonHeight + paddingBottom
195
- val horizontalPadding = paddingBottom
196
- val badgeWidth = (textWidth + horizontalPadding * 2).coerceAtLeast(28.dp)
193
+ val padding = minRibbonHeight / 4f
194
+ val badgeHeight = minRibbonHeight + padding
195
+ val badgeWidth = (textWidth + padding * 2).coerceAtLeast(28.dp)
197
196
 
198
197
  val (rotateZ, scaleY, scaleX) = when (position) {
199
198
  RibbonPosition.TopLeft -> Triple(0f, 1f, -1f)
@@ -211,12 +210,12 @@ fun RoundedBadgeRibbon(
211
210
  this.scaleX = scaleX
212
211
  }
213
212
  ) {
214
- val roundedRect = (badgeHeight - paddingBottom) / 2f
213
+ val roundedRect = (badgeHeight - padding) / 2f
215
214
 
216
215
  Canvas(modifier = Modifier.matchParentSize()) {
217
216
  val width = size.width
218
217
  val height = size.height
219
- val ribbonHeight = height - paddingBottom.toPx()
218
+ val ribbonHeight = height - padding.toPx()
220
219
  val cornerRadius = roundedRect.toPx()
221
220
 
222
221
  val mainColor = Color(0xFFFA541C)
@@ -273,7 +272,7 @@ fun RoundedBadgeRibbon(
273
272
 
274
273
  // Draw bottom tail section
275
274
  val tailY = ribbonHeight
276
- val tailHeight = paddingBottom.toPx()
275
+ val tailHeight = padding.toPx()
277
276
  val halfHeadWidth = headWidth / 2f
278
277
  val tailStartX = rightX + headWidth - halfHeadWidth
279
278
 
@@ -284,7 +283,6 @@ fun RoundedBadgeRibbon(
284
283
  size = Size(halfHeadWidth, halfHeadWidth)
285
284
  )
286
285
 
287
- val tailRoundRadius = tailHeight
288
286
  val tailRightPath = Path().apply {
289
287
  addRoundRect(
290
288
  RoundRect(
@@ -295,8 +293,8 @@ fun RoundedBadgeRibbon(
295
293
  bottom = tailY + tailHeight
296
294
  ),
297
295
  topLeft = CornerRadius.Zero,
298
- topRight = CornerRadius(tailRoundRadius, tailRoundRadius),
299
- bottomRight = CornerRadius(tailRoundRadius, tailRoundRadius),
296
+ topRight = CornerRadius(tailHeight, tailHeight),
297
+ bottomRight = CornerRadius(tailHeight, tailHeight),
300
298
  bottomLeft = CornerRadius.Zero
301
299
  )
302
300
  )
@@ -310,8 +308,8 @@ fun RoundedBadgeRibbon(
310
308
  Text(
311
309
  text = text,
312
310
  modifier = Modifier
313
- .padding(bottom = paddingBottom)
314
- .padding(horizontal = paddingBottom / 2)
311
+ .padding(bottom = padding)
312
+ .padding(horizontal = padding / 2)
315
313
  .align(Alignment.Center)
316
314
  .graphicsLayer {
317
315
  rotationZ = rotateZ
@@ -327,14 +325,14 @@ fun RoundedBadgeRibbon(
327
325
  }
328
326
  }
329
327
 
330
- val ribbonHeight: Dp = 20.dp
331
- val roundHeight: Dp = 16.dp
332
- val skewBodyHeight: Dp = 16.dp
333
- val roundRightRadius: Dp = 12.dp
334
- val roundPaddingEnd: Dp = 6.dp
335
- val skewTailWidth: Dp = 8.dp
336
- val skewTailHeight: Dp = 16.dp
337
- val headTailWidth: Dp = 5.dp
338
- val headTailHeight: Dp = 20.dp
328
+ private val ribbonHeight: Dp = 20.dp
329
+ private val roundHeight: Dp = 16.dp
330
+ private val skewBodyHeight: Dp = 16.dp
331
+ private val roundRightRadius: Dp = 12.dp
332
+ private val roundPaddingEnd: Dp = 6.dp
333
+ private val skewTailWidth: Dp = 8.dp
334
+ private val skewTailHeight: Dp = 16.dp
335
+ private val headTailWidth: Dp = 5.dp
336
+ private val headTailHeight: Dp = 20.dp
339
337
 
340
338
  enum class RibbonPosition {TopLeft, TopRight, BottomLeft, BottomRight}