@momo-kits/native-kits 0.162.6-debug → 0.163.1-beta.1-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 (123) hide show
  1. package/CLAUDE.md +78 -0
  2. package/compose/build.gradle.kts +8 -11
  3. package/compose/build.gradle.kts.backup +7 -10
  4. package/compose/compose.podspec +1 -1
  5. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +7 -2
  6. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +5 -12
  7. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +24 -6
  8. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +19 -4
  9. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +10 -1
  10. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +2 -2
  11. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +1 -1
  12. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +1 -1
  13. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +16 -5
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +1 -1
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +101 -6
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +15 -4
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +33 -8
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +1 -1
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +25 -22
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +29 -27
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +26 -3
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +30 -27
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +13 -3
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +5 -0
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +11 -3
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +18 -3
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +11 -11
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +11 -3
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +5 -1
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +59 -84
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +71 -13
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +51 -10
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +1 -6
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +21 -4
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +1 -1
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +75 -16
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +26 -5
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +1 -1
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +11 -3
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +36 -15
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +9 -3
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +28 -0
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +13 -2
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +17 -0
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +10 -4
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +28 -3
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +47 -8
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +25 -4
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +11 -2
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +17 -1
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +6 -1
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +111 -50
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +5 -1
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +8 -7
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +12 -1
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +96 -4
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +12 -2
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +21 -9
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +2 -2
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +14 -9
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +11 -8
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +1 -1
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +40 -24
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +1 -1
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +5 -0
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +2 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +4 -94
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +2 -0
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +5 -1
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +15 -5
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +14 -65
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +33 -48
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +55 -56
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +9 -3
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +31 -13
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +1 -1
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +24 -6
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +6 -11
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +1 -2
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +3 -6
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +1 -1
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +13 -3
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +2 -3
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +40 -1
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +2 -0
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +8 -0
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +17 -2
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +1 -1
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +3 -3
  91. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +3 -2
  92. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +2 -0
  93. package/example/ios/Example.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  94. package/example/ios/Example.xcworkspace/xcuserdata/huynhdung.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  95. package/example/ios/Example.xcworkspace/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +5 -0
  96. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +58 -0
  97. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/Pods-Example.xcscheme +58 -0
  98. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SDWebImage.xcscheme +58 -0
  99. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +58 -0
  100. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SkeletonUI.xcscheme +58 -0
  101. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +46 -0
  102. package/gradle.properties +1 -1
  103. package/ios/Application/ApplicationEnvironment.swift +0 -1
  104. package/ios/Application/Components.swift +0 -1
  105. package/ios/Application/FloatingButton.swift +0 -1
  106. package/ios/Badge/Badge.swift +0 -1
  107. package/ios/Badge/BadgeRibbon.swift +0 -2
  108. package/ios/Button/Button.swift +1 -1
  109. package/ios/Checkbox/Checkbox.swift +0 -1
  110. package/ios/Input/Input.swift +0 -1
  111. package/ios/Input/InputPhoneNumber.swift +0 -1
  112. package/ios/Input/InputSearch.swift +0 -3
  113. package/ios/Input/InputTextArea.swift +0 -1
  114. package/ios/OTPKeyboard/KeyboardButton.swift +1 -1
  115. package/ios/Popup/PopupDisplay.swift +0 -6
  116. package/ios/Popup/PopupInput.swift +0 -2
  117. package/ios/Template/TrustBanner/TrustBanner.swift +0 -2
  118. package/ios/Typography/Text.swift +7 -13
  119. package/ios/Typography/Typography.swift +8 -22
  120. package/local.properties +8 -0
  121. package/package.json +1 -1
  122. package/ios/Application/FontScaleStore.swift +0 -59
  123. package/ios/Information/Information.swift +0 -151
@@ -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() }
@@ -2,10 +2,21 @@ package vn.momo.kits.application
2
2
 
3
3
  import androidx.compose.foundation.layout.Box
4
4
  import androidx.compose.foundation.layout.wrapContentSize
5
- import androidx.compose.runtime.*
5
+ import androidx.compose.runtime.Composable
6
+ import androidx.compose.runtime.CompositionLocalProvider
7
+ import androidx.compose.runtime.LaunchedEffect
8
+ import androidx.compose.runtime.getValue
9
+ import androidx.compose.runtime.mutableStateOf
10
+ import androidx.compose.runtime.remember
11
+ import androidx.compose.runtime.setValue
12
+ import androidx.compose.runtime.staticCompositionLocalOf
6
13
  import androidx.compose.ui.Modifier
7
14
  import androidx.compose.ui.unit.Dp
8
- import vn.momo.kits.const.*
15
+ import vn.momo.kits.const.AppStatusBar
16
+ import vn.momo.kits.const.AppTheme
17
+ import vn.momo.kits.const.Theme
18
+ import vn.momo.kits.const.ThemeAssets
19
+ import vn.momo.kits.const.defaultTheme
9
20
  import vn.momo.kits.modifier.DeprecatedModifier
10
21
  import vn.momo.kits.platform.getStatusBarHeight
11
22
 
@@ -69,7 +80,7 @@ fun ApplicationContainer(
69
80
  composeApi: ComposeApi? = null,
70
81
  statusBarHeight: Dp? = AppStatusBar.current,
71
82
  applicationContext: MiniAppContext? = null,
72
- config: KitConfig? = null,
83
+ config: DesignSystemConfig? = null,
73
84
  language: String? = null,
74
85
  isWhiteList: Boolean = false,
75
86
  content: @Composable () -> Unit,
@@ -106,4 +117,4 @@ fun ApplicationContainer(
106
117
  }
107
118
  }
108
119
 
109
- }
120
+ }
@@ -6,10 +6,32 @@ 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.*
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
10
24
  import androidx.compose.foundation.rememberScrollState
11
25
  import androidx.compose.foundation.verticalScroll
12
- import androidx.compose.runtime.*
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
13
35
  import androidx.compose.ui.Alignment
14
36
  import androidx.compose.ui.Modifier
15
37
  import androidx.compose.ui.graphics.Color
@@ -22,20 +44,24 @@ import androidx.compose.ui.unit.Dp
22
44
  import androidx.compose.ui.unit.IntOffset
23
45
  import androidx.compose.ui.unit.dp
24
46
  import androidx.compose.ui.zIndex
25
- import kotlinx.coroutines.*
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
26
53
  import vn.momo.kits.components.InputSearchProps
27
54
  import vn.momo.kits.const.AppNavigationBar
28
55
  import vn.momo.kits.const.AppTheme
29
56
  import vn.momo.kits.const.Colors
30
57
  import vn.momo.kits.const.Spacing
31
- import vn.momo.kits.modifier.conditional
32
58
  import vn.momo.kits.modifier.DeprecatedModifier
59
+ import vn.momo.kits.modifier.conditional
33
60
  import vn.momo.kits.modifier.shadow
34
61
  import vn.momo.kits.navigation.component.SnackBar
35
62
  import vn.momo.kits.platform.supportsImePadding
36
63
  import vn.momo.kits.utils.getAppStatusBarHeight
37
64
  import vn.momo.kits.utils.getNavigationBarHeight
38
- import kotlin.time.Duration.Companion.milliseconds
39
65
 
40
66
  enum class HeaderType {
41
67
  DEFAULT,
@@ -255,7 +281,6 @@ fun Footer(
255
281
  .onGloballyPositioned {
256
282
  onFooterMeasured?.invoke(it.size.height)
257
283
  }
258
-
259
284
  ) {
260
285
  Box(
261
286
  Modifier.fillMaxWidth()
@@ -308,7 +333,7 @@ val LocalScreenHelper = staticCompositionLocalOf<ScreenHelper> {
308
333
  }
309
334
 
310
335
  @Composable
311
- internal fun ScreenSnackBarHost(footerHeightPx: Int) {
336
+ fun ScreenSnackBarHost(footerHeightPx: Int) {
312
337
  val helper = LocalScreenHelper.current
313
338
  val snackBarData = helper.snackBarState ?: return
314
339
  val density = LocalDensity.current
@@ -345,7 +370,7 @@ internal fun ScreenSnackBarHost(footerHeightPx: Int) {
345
370
  LaunchedEffect(snackBarData.type.duration) {
346
371
  val duration = snackBarData.type.duration
347
372
  if (duration != null) {
348
- delay(duration.milliseconds)
373
+ delay(duration)
349
374
  helper.hideSnackBar()
350
375
  }
351
376
  }
@@ -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
- internal fun useHeaderSearchAnimation(
27
+ fun useHeaderSearchAnimation(
28
28
  opacityAni: Float,
29
29
  scrollState: Int,
30
30
  headerRightWidth: Dp,
@@ -11,15 +11,19 @@ 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
15
14
  import androidx.compose.ui.unit.dp
16
15
  import vn.momo.kits.application.IsShowBaseLineDebug
17
- import vn.momo.kits.const.*
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
18
22
  import vn.momo.kits.modifier.conditional
19
23
 
20
24
 
21
25
  @Composable
22
- fun Badge(label: String = "Label", backgroundColor: Color? = null, modifier: Modifier = Modifier) {
26
+ fun Badge(label: String = "Label", backgroundColor: Color? = null, modifier: Modifier? = null) {
23
27
  val primaryColors = listOf(
24
28
  Color(0xFFF0F0F0),
25
29
  Color(0xFFEB2F96),
@@ -59,24 +63,23 @@ fun Badge(label: String = "Label", backgroundColor: Color? = null, modifier: Mod
59
63
  }
60
64
  val scaleSize = scaleSize(16f)
61
65
 
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
- )
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
+ }
81
84
  }
82
85
  }
@@ -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
- internal fun RenderRoundContent(label: String, rotate: Float, backgroundColor: Color){
81
+ fun renderRoundContent(label: String, rotate: Float, backgroundColor: Color){
82
82
  Box(
83
83
  modifier = Modifier
84
84
  .height(roundHeight)
@@ -97,7 +97,7 @@ internal fun RenderRoundContent(label: String, rotate: Float, backgroundColor: C
97
97
  }
98
98
 
99
99
  @Composable
100
- internal fun RenderSkewContent(label: String, rotate: Float, backgroundColor: Color){
100
+ fun renderSkewContent(label: String, rotate: Float, backgroundColor: Color){
101
101
  Box(
102
102
  modifier = Modifier
103
103
  .height(skewBodyHeight)
@@ -110,7 +110,7 @@ internal fun RenderSkewContent(label: String, rotate: Float, backgroundColor: Co
110
110
  }
111
111
 
112
112
  @Composable
113
- internal fun Label(label: String, rotate: Float){
113
+ fun Label(label: String, rotate: Float){
114
114
  Text(
115
115
  text = label,
116
116
  color = Colors.black_01,
@@ -122,7 +122,7 @@ internal fun Label(label: String, rotate: Float){
122
122
  }
123
123
 
124
124
  @Composable
125
- internal fun UpTail() {
125
+ 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 @@ internal fun UpTail() {
136
136
  }
137
137
 
138
138
  @Composable
139
- internal fun DownTail() {
139
+ 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 @@ internal fun DownTail() {
149
149
  }
150
150
 
151
151
  @Composable
152
- internal fun RightTail() {
152
+ fun RightTail() {
153
153
  Image(
154
154
  source = "https://static.momocdn.net/app/img/kits/utils/Tail_4x.png",
155
155
  modifier = Modifier
@@ -190,9 +190,10 @@ 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 padding = minRibbonHeight / 4f
194
- val badgeHeight = minRibbonHeight + padding
195
- val badgeWidth = (textWidth + padding * 2).coerceAtLeast(28.dp)
193
+ val paddingBottom = minRibbonHeight / 4f
194
+ val badgeHeight = minRibbonHeight + paddingBottom
195
+ val horizontalPadding = paddingBottom
196
+ val badgeWidth = (textWidth + horizontalPadding * 2).coerceAtLeast(28.dp)
196
197
 
197
198
  val (rotateZ, scaleY, scaleX) = when (position) {
198
199
  RibbonPosition.TopLeft -> Triple(0f, 1f, -1f)
@@ -210,12 +211,12 @@ fun RoundedBadgeRibbon(
210
211
  this.scaleX = scaleX
211
212
  }
212
213
  ) {
213
- val roundedRect = (badgeHeight - padding) / 2f
214
+ val roundedRect = (badgeHeight - paddingBottom) / 2f
214
215
 
215
216
  Canvas(modifier = Modifier.matchParentSize()) {
216
217
  val width = size.width
217
218
  val height = size.height
218
- val ribbonHeight = height - padding.toPx()
219
+ val ribbonHeight = height - paddingBottom.toPx()
219
220
  val cornerRadius = roundedRect.toPx()
220
221
 
221
222
  val mainColor = Color(0xFFFA541C)
@@ -272,7 +273,7 @@ fun RoundedBadgeRibbon(
272
273
 
273
274
  // Draw bottom tail section
274
275
  val tailY = ribbonHeight
275
- val tailHeight = padding.toPx()
276
+ val tailHeight = paddingBottom.toPx()
276
277
  val halfHeadWidth = headWidth / 2f
277
278
  val tailStartX = rightX + headWidth - halfHeadWidth
278
279
 
@@ -283,6 +284,7 @@ fun RoundedBadgeRibbon(
283
284
  size = Size(halfHeadWidth, halfHeadWidth)
284
285
  )
285
286
 
287
+ val tailRoundRadius = tailHeight
286
288
  val tailRightPath = Path().apply {
287
289
  addRoundRect(
288
290
  RoundRect(
@@ -293,8 +295,8 @@ fun RoundedBadgeRibbon(
293
295
  bottom = tailY + tailHeight
294
296
  ),
295
297
  topLeft = CornerRadius.Zero,
296
- topRight = CornerRadius(tailHeight, tailHeight),
297
- bottomRight = CornerRadius(tailHeight, tailHeight),
298
+ topRight = CornerRadius(tailRoundRadius, tailRoundRadius),
299
+ bottomRight = CornerRadius(tailRoundRadius, tailRoundRadius),
298
300
  bottomLeft = CornerRadius.Zero
299
301
  )
300
302
  )
@@ -308,8 +310,8 @@ fun RoundedBadgeRibbon(
308
310
  Text(
309
311
  text = text,
310
312
  modifier = Modifier
311
- .padding(bottom = padding)
312
- .padding(horizontal = padding / 2)
313
+ .padding(bottom = paddingBottom)
314
+ .padding(horizontal = paddingBottom / 2)
313
315
  .align(Alignment.Center)
314
316
  .graphicsLayer {
315
317
  rotationZ = rotateZ
@@ -325,14 +327,14 @@ fun RoundedBadgeRibbon(
325
327
  }
326
328
  }
327
329
 
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
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
337
339
 
338
340
  enum class RibbonPosition {TopLeft, TopRight, BottomLeft, BottomRight}