@momo-kits/native-kits 0.152.4-beta.9 → 0.152.4-klib.10

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/README.md +175 -5
  2. package/ios/Badge/Badge.swift +0 -6
  3. package/ios/Badge/BadgeRibbon.swift +77 -9
  4. package/ios/Button/Button.swift +7 -7
  5. package/ios/native-kits.podspec +18 -16
  6. package/package.json +2 -4
  7. package/CODE_OF_CONDUCT.md +0 -133
  8. package/CONTRIBUTING.md +0 -114
  9. package/LICENSE +0 -20
  10. package/build.gradle.kts +0 -32
  11. package/compose/MoMoComposeKits.podspec +0 -54
  12. package/compose/build.gradle.kts +0 -149
  13. package/compose/src/androidMain/AndroidManifest.xml +0 -2
  14. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -105
  15. package/compose/src/commonMain/composeResources/files/lottie_circle_loader.json +0 -1
  16. package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
  17. package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
  18. package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
  19. package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
  20. package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
  21. package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
  22. package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
  23. package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
  24. package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
  25. package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
  26. package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
  27. package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
  28. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
  29. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -57
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -201
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -222
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -48
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -306
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -715
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -214
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -236
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -77
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -27
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -334
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -345
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -90
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -131
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -543
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -23
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -58
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -143
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -179
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -111
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -384
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -160
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -234
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -223
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -232
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -236
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -228
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -364
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -50
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -34
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -85
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -33
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -338
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -95
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -64
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -89
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -91
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -84
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -208
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -172
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -199
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -237
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -191
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -306
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -13
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -191
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -258
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -2
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -35
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -2
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -59
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -68
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -49
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -232
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -111
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -94
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -159
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -232
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScaleSizeScope.kt +0 -17
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -459
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -169
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -216
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -180
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -251
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -80
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -306
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -31
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -385
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -38
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -62
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -88
  113. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -144
  114. package/gradle.properties +0 -19
  115. package/gradlew +0 -240
  116. package/gradlew.bat +0 -91
  117. package/ios/Theme.md +0 -18
  118. package/settings.gradle.kts +0 -25
package/README.md CHANGED
@@ -1,7 +1,177 @@
1
- ## 🛠 Installation
2
- ### Using Cocoapods
3
- Add it inside your `Podfile`.
4
- ```ruby
5
- pod 'MoMoUIKits', '../node_modules/@momo-platform/native-kits/ios'
1
+ ## ComposeKit (Kotlin Multiplatform)
2
+
3
+ ComposeKit bộ UI Kit đa nền tảng phục vụ Mini App/SDK của MoMo. Toàn bộ giao diện, điều hướng, token thiết kế và layer tích hợp với MaxAPI đều được viết bằng Kotlin Multiplatform để tái sử dụng cho Android, iOS (qua Compose Multiplatform) cũng như các host native.
4
+
5
+ ### Mục tiêu & phạm vi
6
+ - Chuẩn hoá visual language của MoMo với kho component Compose đã mang sẵn màu sắc, typography, spacing, radius trong `vn.momo.compose.kit.const`.
7
+ - Cung cấp navigation stack thống nhất (`NavigationContainer`, `Navigator`, bottom tabs, modal/bottom sheet) hỗ trợ dynamic screen registry và MaxAPI dismiss/present.
8
+ - Cho phép host nhận context Mini App (`MiniAppContext`, `KitConfig`, `ApplicationContext`, `AppLanguage`) để tự động render Trust Banner, header assets, tracking.
9
+ - Đồng bộ hoá với native SwiftUI kit (`nativeSDK/ios`) nhằm cover các màn đang viết Swift/Objective‑C.
10
+
11
+ ---
12
+
13
+ ### Cấu trúc thư mục
14
+ - `shared/`: module KMP chính. Chứa toàn bộ source `vn.momo.compose.kit.*`, compose resources (font SF Pro), logic publish Maven và podspec.
15
+ - `composeApp/`: sample Compose Multiplatform Android dùng để thử nhanh component, navigator, trust banner.
16
+ - `iosApp/`: project SwiftUI + CocoaPods để test framework iOS sinh ra từ `shared`.
17
+ - `nativeSDK/ios/`: Swift package + podspec `MoMoUIKits` (phụ thuộc `SDWebImageSwiftUI`, `SkeletonUI`) cho các màn hoàn toàn native.
18
+ - `publish_release.sh`, `.gitlab-ci.yml`: script tự bump patch version, chạy `:compose:publish...` khi commit có `[ci build]`.
19
+ - `build-output/`, `build/`: output tạm thời (không commit).
20
+
21
+ ---
22
+
23
+ ### Thành phần chính trong `shared`
24
+
25
+ **Design tokens & theming**
26
+ - `const/Colors.kt`, `Radius.kt`, `Spacing.kt`, `Typography.kt` định nghĩa token thống nhất.
27
+ - `const/Theme.kt` cung cấp `Theme`, `ColorScheme`, `AppTheme`, `AppThemeController`. Có sẵn `defaultTheme` & `darkTheme`, hỗ trợ inject assets (vd. header background từ `KitConfig`).
28
+
29
+ **Layout primitives & modifier**
30
+ - `layout/Card.kt`, `Section.kt`, `Item.kt` chứa khung section theo guideline Super App.
31
+ - `modifier/AutomationId`, `Conditional`, `Shadow`, `Size` giúp thêm accessibility id, điều kiện hoá modifier, shadow blur tuỳ nền.
32
+
33
+ **UI components**
34
+ - Buttons (`Button.kt`, `IconButton.kt`), typography helper (`Text.kt`, `Title.kt`), badge/tag (`Badge*`, `Tag.kt`), chip & switch (`Chip.kt`, `Switch.kt`), checkbox/radio.
35
+ - Input stack: `Input*` (OTP, PhoneNumber, Money, Search, DropDown, TextArea) với keyboard helpers.
36
+ - Pagination indicator (`PaginationDot/Number/Scroll/WhiteDot.kt`), skeleton loading (`Skeleton.kt`), trust UI (`TrustBanner.kt`).
37
+ - Popup/notify (`PopupNotify`, `PopupPromotion`), floating button, `LazyColumnWithBouncing`, Cupertino overscroll, `DateTimePicker` (Wheel UI + utils).
38
+ - Lottie animation (`components/animation/LottieAnimation`) dựng trên [Compottie](https://github.com/alexzhirkevich/compottie) để chạy animation JSON đồng nhất trên Android/iOS/Desktop.
39
+
40
+ **Navigation & application layer**
41
+ - `navigation/NavigationContainer`, `Navigation.kt`, `Navigator.kt`, `StackScreen.kt`, `BottomSheet.kt`, bottom tab helpers.
42
+ - `Navigator` hỗ trợ `push`, `replace`, `present`, `reset`, `pop(count)`, `showModal`, `showBottomSheet` với overlay registry (`OverplayComponentRegistry`).
43
+ - `application/NavigationContainer.kt`, `MiniAppContext`, `KitConfig`, `ApplicationContext`, `AppConfig`, `AppLanguage` cung cấp context cho header/trust banner, mapping sang map để gửi qua MaxAPI.
44
+ - `application/Screen.kt`, `Header*`, `Footer`, `FloatingButton` tạo template screen (đang deprecate, khuyến nghị dùng `NavigationContainer + StackScreen`).
45
+
46
+ **Platform utilities**
47
+ - `platform/Platform.kt` định nghĩa expect/actual cho `getPlatformName`, `BackHandler`, `getScreenHeight`, `NativePaint` mask filter. Android actual đi kèm `getAndroidBuildVersion`.
48
+ - `utils/Icons.kt`, `Resources.kt`, `getAppStatusBarHeight()` giúp truy xuất resource Compose đa nền tảng.
49
+
50
+ **Native bridge**
51
+ - `shared/shared.podspec` và `nativeSDK/ios/MoMoUIKits.podspec` cho phép embed vào iOS app via CocoaPods (deployment target 15.0, Swift 5). Phần native duy trì các SwiftUI component tương đương Compose (Button, Input, Popup, Trust Banner, Badge...).
52
+
53
+ ---
54
+
55
+ ### Yêu cầu môi trường
56
+ - JDK 17+, Gradle 8, Android Studio Hedgehog+ với Android SDK (compileSdk xem `libs.versions.toml`).
57
+ - Kotlin Multiplatform plugin + Compose Multiplatform (JetBrains 1.6.1+).
58
+ - Xcode 15, CocoaPods 1.12+ để build `iosApp` hoặc publish Pod.
59
+ - Truy cập mạng nội bộ GitLab Packages nếu cần publish/consume Maven repo `https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven`.
60
+
61
+ ---
62
+
63
+ ### Build & kiểm thử nhanh
64
+
65
+ | Tác vụ | Lệnh |
66
+ | --- | --- |
67
+ | Build thư viện KMP (AAR + klib + framework) | `./gradlew :compose:assembleRelease` |
68
+ | Publish local maven (nếu cần thử) | `./gradlew :compose:publishAllPublicationsToMavenLocal` |
69
+ | Sample Android | `./gradlew :composeApp:assembleDebug` |
70
+ | Sample iOS | mở `iosApp/iosApp.xcworkspace` rồi build trên Xcode |
71
+
72
+ Output Compose nằm trong `shared/build/outputs` và `shared/build/publications/*`. Debug fonts/resources ở `shared/src/commonMain/composeResources`.
73
+
74
+ ---
75
+
76
+ ### Publish nội bộ (GitLab Packages)
77
+ 1. Cập nhật `gradle.properties` nếu thay đổi group/artifact/version. Mặc định:
78
+ ```
79
+ name=ComposeKit
80
+ group=vn.momo.kits
81
+ artifact.id=kits
82
+ version=0.1.2
83
+ url=https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven
84
+ gitlab.user=upload_packages
85
+ gitlab.password=<token>
86
+ ```
87
+ 2. Chạy `./publish_release.sh`. Script sẽ:
88
+ - Đọc version hiện tại, query các version đã publish qua GitLab API.
89
+ - Bump patch (`X.Y.Z+1`) đến khi không trùng.
90
+ - Ghi lại `gradle.properties`, export `VERSION`, chạy `./gradlew clean` + `:compose:publishAllPublicationsToGitLabPackagesRepository`.
91
+ 3. CI (`.gitlab-ci.yml`) tự động thực thi script này khi push với commit message chứa `[ci build]` (trừ khi branch khớp `engine/w*`).
92
+
93
+ ---
94
+
95
+ ### Tích hợp ComposeKit trong dự án KMP/Android
96
+
97
+ **Thêm dependency**
98
+ ```kotlin
99
+ repositories {
100
+ maven { url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven") }
101
+ }
102
+
103
+ commonMain.dependencies {
104
+ implementation("vn.momo.kits:kits:<version>")
105
+ }
106
+ ```
107
+
108
+ **Khởi tạo navigation container**
109
+ ```kotlin
110
+ val miniAppContext = MiniAppContext(appId = "...", appCode = "...", appIcon = "...", toolkitConfig = ...)
111
+
112
+ NavigationContainer(
113
+ initialScreen = { StackScreenExample() },
114
+ options = NavigationOptions(headerTitle = HeaderTitle.Default("Home")),
115
+ applicationContext = miniAppContext,
116
+ config = KitConfig(trustBanner = defaultBanner),
117
+ maxApi = maxApi, // IMaxApi implementation từ host
118
+ setNavigator = { navigator = it }
119
+ )
120
+ ```
121
+
122
+ Bên trong screen, truy cập `LocalNavigator.current` để:
123
+ ```kotlin
124
+ val navigator = LocalNavigator.current
125
+ navigator.push { DetailScreen() }
126
+ navigator.showBottomSheet(content = { BottomSheetContent() })
127
+ ```
128
+
129
+ Tuỳ biến theme bằng `AppThemeController`:
130
+ ```kotlin
131
+ val themeController = AppThemeController.current
132
+ themeController(defaultTheme.copy(colors = defaultTheme.colors.copy(primary = Colors.pink_04)))
133
+ ```
134
+
135
+ `ApplicationContext.current`, `AppConfig.current`, `AppLanguage.current` giúp component (ví dụ `TrustBanner`) tự lấy dữ liệu trust banner và tracking `service_component_clicked`.
136
+
137
+ ---
138
+
139
+ ### Tích hợp iOS / Native SDK
140
+ - `shared/shared.podspec` sinh framework Compose (static) mang tên theo `artifact.id` (`kits`). Add vào Podfile:
141
+ ```ruby
142
+ pod 'kits', :path => '../shared'
143
+ ```
144
+ - Với màn SwiftUI thuần native, dùng `nativeSDK/ios`:
145
+ ```ruby
146
+ pod 'MoMoUIKits', :path => 'nativeSDK/ios'
147
+ ```
148
+ Bộ này mirror hầu hết component Compose (Button, Input, Popup, TrustBanner...). `ApplicationEnvironment` chấp nhận `MiniAppContext`, `KitConfig` tương tự Kotlin.
149
+
150
+ ---
151
+
152
+ ### Lưu ý khác
153
+ - `Screen` composable cũ được đánh dấu `@Deprecated`; sử dụng `NavigationContainer + StackScreen` để hưởng lợi dynamic route và animation.
154
+ - `DesignSystemWhiteList` trong `application/ApplicationContainer.kt` hỗ trợ fallback cho host cũ; đừng kích hoạt nếu không cần.
155
+ - Khi thêm tài nguyên mới, đặt trong `shared/src/commonMain/composeResources` để Compose Multiplatform plugin sinh accessor tự động.
156
+ - Repo không bundle SDK bên thứ ba ngoại trừ `vn.momo.corex.maxapi`, Compose/Coil/Ktor **và Compottie** cho animation.
157
+
158
+ ---
159
+
160
+ ### Animation Lottie đa nền tảng với Compottie
161
+
162
+ ```kotlin
163
+ import io.github.alexzhirkevich.compottie.LottieCompositionSpec
164
+ import vn.momo.kits.components.animation.LottieAnimation
165
+
166
+ @Composable
167
+ fun SuccessState() {
168
+ LottieAnimation(
169
+ spec = LottieCompositionSpec.Url(
170
+ "https://assets10.lottiefiles.com/packages/lf20_jcikwtux.json"
171
+ )
172
+ )
173
+ }
6
174
  ```
7
175
 
176
+ - `shared/build.gradle.kts` đã bật `coreLibraryDesugaringEnabled` để tương thích `compottie-dot`/`compottie-network` với `minSdk = 24`.
177
+ - Nếu animation dùng asset/font nội bộ, kết hợp `compottie-resources` (`rememberResourcesAssetsManager`, `rememberResourcesFontManager`) để trỏ về `composeResources`.
@@ -64,12 +64,6 @@ public struct Badge: View {
64
64
  .stroke(Colors.black01, lineWidth: 1)
65
65
  )
66
66
  }
67
-
68
- // Helper function for scaling sizes
69
- // TODO: Implement proper scaling logic based on your design system
70
- private func scaleSize(_ size: CGFloat) -> CGFloat {
71
- return size
72
- }
73
67
  }
74
68
 
75
69
  // MARK: - Preview
@@ -1,5 +1,74 @@
1
1
  import SwiftUI
2
2
 
3
+ // MARK: - Custom Shape for Rounded Corners
4
+ struct RoundedCorners: Shape {
5
+ var topLeft: CGFloat = 0.0
6
+ var topRight: CGFloat = 0.0
7
+ var bottomLeft: CGFloat = 0.0
8
+ var bottomRight: CGFloat = 0.0
9
+
10
+ func path(in rect: CGRect) -> Path {
11
+ var path = Path()
12
+
13
+ let width = rect.size.width
14
+ let height = rect.size.height
15
+
16
+ // Start from top left
17
+ path.move(to: CGPoint(x: topLeft, y: 0))
18
+
19
+ // Top edge and top right corner
20
+ path.addLine(to: CGPoint(x: width - topRight, y: 0))
21
+ if topRight > 0 {
22
+ path.addArc(
23
+ center: CGPoint(x: width - topRight, y: topRight),
24
+ radius: topRight,
25
+ startAngle: Angle(degrees: -90),
26
+ endAngle: Angle(degrees: 0),
27
+ clockwise: false
28
+ )
29
+ }
30
+
31
+ // Right edge and bottom right corner
32
+ path.addLine(to: CGPoint(x: width, y: height - bottomRight))
33
+ if bottomRight > 0 {
34
+ path.addArc(
35
+ center: CGPoint(x: width - bottomRight, y: height - bottomRight),
36
+ radius: bottomRight,
37
+ startAngle: Angle(degrees: 0),
38
+ endAngle: Angle(degrees: 90),
39
+ clockwise: false
40
+ )
41
+ }
42
+
43
+ // Bottom edge and bottom left corner
44
+ path.addLine(to: CGPoint(x: bottomLeft, y: height))
45
+ if bottomLeft > 0 {
46
+ path.addArc(
47
+ center: CGPoint(x: bottomLeft, y: height - bottomLeft),
48
+ radius: bottomLeft,
49
+ startAngle: Angle(degrees: 90),
50
+ endAngle: Angle(degrees: 180),
51
+ clockwise: false
52
+ )
53
+ }
54
+
55
+ // Left edge and top left corner
56
+ path.addLine(to: CGPoint(x: 0, y: topLeft))
57
+ if topLeft > 0 {
58
+ path.addArc(
59
+ center: CGPoint(x: topLeft, y: topLeft),
60
+ radius: topLeft,
61
+ startAngle: Angle(degrees: 180),
62
+ endAngle: Angle(degrees: 270),
63
+ clockwise: false
64
+ )
65
+ }
66
+
67
+ path.closeSubpath()
68
+ return path
69
+ }
70
+ }
71
+
3
72
  public enum RibbonPosition {
4
73
  case topLeft
5
74
  case topRight
@@ -76,14 +145,13 @@ public struct BadgeRibbon: View {
76
145
  .frame(height: RibbonConstants.roundHeight)
77
146
  .padding(.trailing, RibbonConstants.roundPaddingEnd)
78
147
  .background(
79
- RoundedRectangle(cornerRadius: Radius.M)
80
- .fill(backgroundColor)
81
- .mask(
82
- HStack(spacing: 0) {
83
- Rectangle()
84
- RoundedRectangle(cornerRadius: Radius.M)
85
- }
86
- )
148
+ RoundedCorners(
149
+ topLeft: 0,
150
+ topRight: RibbonConstants.roundRightRadius,
151
+ bottomLeft: 0,
152
+ bottomRight: RibbonConstants.roundRightRadius
153
+ )
154
+ .fill(backgroundColor)
87
155
  )
88
156
  }
89
157
 
@@ -139,7 +207,7 @@ private struct RibbonConstants {
139
207
  static let ribbonHeight: CGFloat = 20
140
208
  static let roundHeight: CGFloat = 16
141
209
  static let skewBodyHeight: CGFloat = 16
142
- static let roundRightRadius: CGFloat = 12
210
+ static let roundRightRadius: CGFloat = 8
143
211
  static let roundPaddingEnd: CGFloat = 6
144
212
  static let skewTailWidth: CGFloat = 8
145
213
  static let skewTailHeight: CGFloat = 16
@@ -1,6 +1,6 @@
1
1
  import Foundation
2
- import SwiftUI
3
2
  import Lottie
3
+ import SwiftUI
4
4
 
5
5
  // MARK: - ButtonType
6
6
 
@@ -33,7 +33,7 @@ public extension ButtonType {
33
33
  func backgroundColor(loading: Bool) -> Color {
34
34
  switch self {
35
35
  case .disabled: return Colors.black05.opacity(loading ? 0.75 : 1)
36
- case .primary: return Colors.primary.opacity(loading ? 0.75 : 1)
36
+ case .primary: return Colors.primary.opacity(loading ? 0.75 : 1)
37
37
  case .secondary: return Colors.card.opacity(loading ? 0.75 : 1)
38
38
  case .outline: return Colors.card.opacity(loading ? 0.75 : 1)
39
39
  case .tonal: return Colors.primaryLight.opacity(loading ? 0.75 : 1)
@@ -116,13 +116,13 @@ extension ButtonSize {
116
116
  }
117
117
 
118
118
  public struct Button: View {
119
-
120
119
  var title: String
121
120
  var action: () -> Void
122
121
  var type: ButtonType
123
122
  var size: ButtonSize
124
123
  var iconLeft: AnyView?
125
124
  var iconRight: AnyView?
125
+ var isFull: Bool
126
126
  var loading: Bool
127
127
 
128
128
  public init(
@@ -132,6 +132,7 @@ public struct Button: View {
132
132
  size: ButtonSize = .large,
133
133
  iconLeft: AnyView? = nil,
134
134
  iconRight: AnyView? = nil,
135
+ isFull: Bool = true,
135
136
  loading: Bool = false
136
137
  ) {
137
138
  self.title = title
@@ -140,6 +141,7 @@ public struct Button: View {
140
141
  self.size = size
141
142
  self.iconLeft = iconLeft
142
143
  self.iconRight = iconRight
144
+ self.isFull = isFull
143
145
  self.loading = loading
144
146
  }
145
147
 
@@ -156,7 +158,6 @@ public struct Button: View {
156
158
  }
157
159
 
158
160
  public var body: some View {
159
-
160
161
  let loadingOnLeft = shouldLoadingOnLeft(iconLeft, iconRight)
161
162
 
162
163
  let bg = type.backgroundColor(loading: loading)
@@ -165,12 +166,11 @@ public struct Button: View {
165
166
  let borderWidth = type.borderWidth
166
167
 
167
168
  SwiftUI.Button(action: {
168
- if !loading && type != .disabled {
169
+ if !loading, type != .disabled {
169
170
  action()
170
171
  }
171
172
  }) {
172
173
  HStack(spacing: size.iconSpacing) {
173
-
174
174
  if loading && loadingOnLeft {
175
175
  LottieView(name: "lottie_circle_loader", loopMode: .loop)
176
176
  .frame(width: size.iconSize, height: size.iconSize)
@@ -195,7 +195,7 @@ public struct Button: View {
195
195
  iconRight.frame(width: size.iconSize, height: size.iconSize)
196
196
  }
197
197
  }
198
- .frame(maxWidth: .infinity)
198
+ .frame(maxWidth: isFull ? .infinity : nil)
199
199
  .padding(.horizontal, size.padding)
200
200
  .frame(height: size.height)
201
201
  .background(bg)
@@ -1,18 +1,20 @@
1
- Pod::Spec.new do |spec|
2
- spec.name = 'MoMoUIKits'
3
- spec.version = '1.0.0'
4
- spec.license = { :type => 'MIT', :file => 'LICENSE' }
5
- spec.homepage = 'https://gitlab.com'
6
- spec.authors = { 'Developer' => 'momo@mservice.com.vn' }
7
- spec.summary = 'Components for SwiftUI'
8
- spec.source = { :git => 'https://gitlab.com', :tag => 'v1.0.0' }
9
- spec.swift_versions = ['5.0']
10
- spec.ios.deployment_target = '13.0'
1
+ Pod::Spec.new do |s|
2
+ s.name = 'MoMoUIKits'
3
+ s.version = '1.0.0'
4
+ s.summary = 'MoMoUIKits for iOS'
5
+ s.homepage = 'https://momo.vn'
6
+ s.license = { :type => 'MIT', :file => 'LICENSE' }
7
+ s.author = { 'MoMo' => 'dev@momo.vn' }
8
+ s.source = { :path => '.' }
9
+
10
+ s.ios.deployment_target = '15.0'
11
+ s.swift_version = '5.0'
12
+
13
+ s.source_files = "**/*.swift"
14
+ s.framework = 'SwiftUI', 'Combine'
15
+ s.dependency 'SDWebImageSwiftUI'
16
+ s.dependency 'lottie-ios'
17
+ s.dependency 'SkeletonUI', '1.0.11'
18
+ end
11
19
 
12
- spec.source_files = "**/*.swift"
13
20
 
14
- spec.framework = 'SwiftUI', 'Combine'
15
- spec.dependency 'SDWebImageSwiftUI'
16
- spec.dependency 'lottie-ios'
17
- spec.dependency 'SkeletonUI', '1.0.11'
18
- end
package/package.json CHANGED
@@ -1,10 +1,8 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.152.4-beta.9",
3
+ "version": "0.152.4-klib.10",
4
4
  "private": false,
5
- "dependencies": {
6
- "@momo-platform/native-max-api": "1.0.18"
7
- },
5
+ "dependencies": {},
8
6
  "devDependencies": {},
9
7
  "license": "MoMo"
10
8
  }
@@ -1,133 +0,0 @@
1
-
2
- # Contributor Covenant Code of Conduct
3
-
4
- ## Our Pledge
5
-
6
- We as members, contributors, and leaders pledge to make participation in our
7
- community a harassment-free experience for everyone, regardless of age, body
8
- size, visible or invisible disability, ethnicity, sex characteristics, gender
9
- identity and expression, level of experience, education, socio-economic status,
10
- nationality, personal appearance, race, caste, color, religion, or sexual
11
- identity and orientation.
12
-
13
- We pledge to act and interact in ways that contribute to an open, welcoming,
14
- diverse, inclusive, and healthy community.
15
-
16
- ## Our Standards
17
-
18
- Examples of behavior that contributes to a positive environment for our
19
- community include:
20
-
21
- * Demonstrating empathy and kindness toward other people
22
- * Being respectful of differing opinions, viewpoints, and experiences
23
- * Giving and gracefully accepting constructive feedback
24
- * Accepting responsibility and apologizing to those affected by our mistakes,
25
- and learning from the experience
26
- * Focusing on what is best not just for us as individuals, but for the overall
27
- community
28
-
29
- Examples of unacceptable behavior include:
30
-
31
- * The use of sexualized language or imagery, and sexual attention or advances of
32
- any kind
33
- * Trolling, insulting or derogatory comments, and personal or political attacks
34
- * Public or private harassment
35
- * Publishing others' private information, such as a physical or email address,
36
- without their explicit permission
37
- * Other conduct which could reasonably be considered inappropriate in a
38
- professional setting
39
-
40
- ## Enforcement Responsibilities
41
-
42
- Community leaders are responsible for clarifying and enforcing our standards of
43
- acceptable behavior and will take appropriate and fair corrective action in
44
- response to any behavior that they deem inappropriate, threatening, offensive,
45
- or harmful.
46
-
47
- Community leaders have the right and responsibility to remove, edit, or reject
48
- comments, commits, code, wiki edits, issues, and other contributions that are
49
- not aligned to this Code of Conduct, and will communicate reasons for moderation
50
- decisions when appropriate.
51
-
52
- ## Scope
53
-
54
- This Code of Conduct applies within all community spaces, and also applies when
55
- an individual is officially representing the community in public spaces.
56
- Examples of representing our community include using an official e-mail address,
57
- posting via an official social media account, or acting as an appointed
58
- representative at an online or offline event.
59
-
60
- ## Enforcement
61
-
62
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
63
- reported to the community leaders responsible for enforcement at
64
- [INSERT CONTACT METHOD].
65
- All complaints will be reviewed and investigated promptly and fairly.
66
-
67
- All community leaders are obligated to respect the privacy and security of the
68
- reporter of any incident.
69
-
70
- ## Enforcement Guidelines
71
-
72
- Community leaders will follow these Community Impact Guidelines in determining
73
- the consequences for any action they deem in violation of this Code of Conduct:
74
-
75
- ### 1. Correction
76
-
77
- **Community Impact**: Use of inappropriate language or other behavior deemed
78
- unprofessional or unwelcome in the community.
79
-
80
- **Consequence**: A private, written warning from community leaders, providing
81
- clarity around the nature of the violation and an explanation of why the
82
- behavior was inappropriate. A public apology may be requested.
83
-
84
- ### 2. Warning
85
-
86
- **Community Impact**: A violation through a single incident or series of
87
- actions.
88
-
89
- **Consequence**: A warning with consequences for continued behavior. No
90
- interaction with the people involved, including unsolicited interaction with
91
- those enforcing the Code of Conduct, for a specified period of time. This
92
- includes avoiding interactions in community spaces as well as external channels
93
- like social media. Violating these terms may lead to a temporary or permanent
94
- ban.
95
-
96
- ### 3. Temporary Ban
97
-
98
- **Community Impact**: A serious violation of community standards, including
99
- sustained inappropriate behavior.
100
-
101
- **Consequence**: A temporary ban from any sort of interaction or public
102
- communication with the community for a specified period of time. No public or
103
- private interaction with the people involved, including unsolicited interaction
104
- with those enforcing the Code of Conduct, is allowed during this period.
105
- Violating these terms may lead to a permanent ban.
106
-
107
- ### 4. Permanent Ban
108
-
109
- **Community Impact**: Demonstrating a pattern of violation of community
110
- standards, including sustained inappropriate behavior, harassment of an
111
- individual, or aggression toward or disparagement of classes of individuals.
112
-
113
- **Consequence**: A permanent ban from any sort of public interaction within the
114
- community.
115
-
116
- ## Attribution
117
-
118
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119
- version 2.1, available at
120
- [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
121
-
122
- Community Impact Guidelines were inspired by
123
- [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124
-
125
- For answers to common questions about this code of conduct, see the FAQ at
126
- [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
127
- [https://www.contributor-covenant.org/translations][translations].
128
-
129
- [homepage]: https://www.contributor-covenant.org
130
- [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
131
- [Mozilla CoC]: https://github.com/mozilla/diversity
132
- [FAQ]: https://www.contributor-covenant.org/faq
133
- [translations]: https://www.contributor-covenant.org/translations
package/CONTRIBUTING.md DELETED
@@ -1,114 +0,0 @@
1
- # Contributing
2
-
3
- Contributions are always welcome, no matter how large or small!
4
-
5
- We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. Before contributing, please read the [code of conduct](./CODE_OF_CONDUCT.md).
6
-
7
- ## Development workflow
8
-
9
- To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:
10
-
11
- ```sh
12
- yarn
13
- ```
14
-
15
- > While it's possible to use [`npm`](https://github.com/npm/cli), the tooling is built around [`yarn`](https://classic.yarnpkg.com/), so you'll have an easier time if you use `yarn` for development.
16
-
17
- While developing, you can run the [example app](/example/) to test your changes. Any changes you make in your library's JavaScript code will be reflected in the example app without a rebuild. If you change any native code, then you'll need to rebuild the example app.
18
-
19
- To start the packager:
20
-
21
- ```sh
22
- yarn example start
23
- ```
24
-
25
- To run the example app on Android:
26
-
27
- ```sh
28
- yarn example android
29
- ```
30
-
31
- To run the example app on iOS:
32
-
33
- ```sh
34
- yarn example ios
35
- ```
36
-
37
- Make sure your code passes TypeScript and ESLint. Run the following to verify:
38
-
39
- ```sh
40
- yarn typecheck
41
- yarn lint
42
- ```
43
-
44
- To fix formatting errors, run the following:
45
-
46
- ```sh
47
- yarn lint --fix
48
- ```
49
-
50
- Remember to add tests for your change if possible. Run the unit tests by:
51
-
52
- ```sh
53
- yarn test
54
- ```
55
-
56
- To edit the Objective-C or Swift files, open `example/ios/NativeKitsExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > @momo-platform/native-kits`.
57
-
58
- To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `momo-platform-native-kits` under `Android`.
59
-
60
-
61
- ### Commit message convention
62
-
63
- We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages:
64
-
65
- - `fix`: bug fixes, e.g. fix crash due to deprecated method.
66
- - `feat`: new features, e.g. add new method to the module.
67
- - `refactor`: code refactor, e.g. migrate from class components to hooks.
68
- - `docs`: changes into documentation, e.g. add usage example for the module..
69
- - `test`: adding or updating tests, e.g. add integration tests using detox.
70
- - `chore`: tooling changes, e.g. change CI config.
71
-
72
- Our pre-commit hooks verify that your commit message matches this format when committing.
73
-
74
- ### Linting and tests
75
-
76
- [ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/)
77
-
78
- We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing.
79
-
80
- Our pre-commit hooks verify that the linter and tests pass when committing.
81
-
82
- ### Publishing to npm
83
-
84
- We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc.
85
-
86
- To publish new versions, run the following:
87
-
88
- ```sh
89
- yarn release
90
- ```
91
-
92
- ### Scripts
93
-
94
- The `package.json` file contains various scripts for common tasks:
95
-
96
- - `yarn bootstrap`: setup project by installing all dependencies and pods.
97
- - `yarn typecheck`: type-check files with TypeScript.
98
- - `yarn lint`: lint files with ESLint.
99
- - `yarn test`: run unit tests with Jest.
100
- - `yarn example start`: start the Metro server for the example app.
101
- - `yarn example android`: run the example app on Android.
102
- - `yarn example ios`: run the example app on iOS.
103
-
104
- ### Sending a pull request
105
-
106
- > **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github).
107
-
108
- When you're sending a pull request:
109
-
110
- - Prefer small pull requests focused on one change.
111
- - Verify that linters and tests are passing.
112
- - Review the documentation to make sure it looks good.
113
- - Follow the pull request template when opening a pull request.
114
- - For pull requests that change the API or implementation, discuss with maintainers first by opening an issue.