@momo-kits/native-kits 0.152.4-beta.6 → 0.152.4-maxapi

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 (155) hide show
  1. package/CODE_OF_CONDUCT.md +133 -0
  2. package/CONTRIBUTING.md +114 -0
  3. package/LICENSE +20 -0
  4. package/README.md +7 -0
  5. package/build.gradle.kts +32 -0
  6. package/compose/MoMoComposeKits.podspec +54 -0
  7. package/compose/build.gradle.kts +149 -0
  8. package/compose/src/androidMain/AndroidManifest.xml +2 -0
  9. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +105 -0
  10. package/compose/src/commonMain/composeResources/files/lottie_circle_loader.json +1 -0
  11. package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
  12. package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
  13. package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
  14. package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
  15. package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
  16. package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
  17. package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
  18. package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
  19. package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
  20. package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
  21. package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
  22. package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
  23. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
  24. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +57 -0
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +201 -0
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +222 -0
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +48 -0
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +86 -0
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +76 -0
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +76 -0
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +306 -0
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +33 -0
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +715 -0
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +214 -0
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +236 -0
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +69 -0
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +77 -0
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +27 -0
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +334 -0
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +345 -0
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +90 -0
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +131 -0
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +543 -0
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +23 -0
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +58 -0
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +143 -0
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +179 -0
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +111 -0
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +384 -0
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +160 -0
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +234 -0
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +223 -0
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +232 -0
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +236 -0
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +228 -0
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +364 -0
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +50 -0
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +34 -0
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +85 -0
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +33 -0
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +338 -0
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +95 -0
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +64 -0
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +89 -0
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +91 -0
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +86 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +84 -0
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +208 -0
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +172 -0
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +199 -0
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +237 -0
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +191 -0
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +306 -0
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +13 -0
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +191 -0
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +258 -0
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +2 -0
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +35 -0
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +2 -0
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +59 -0
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +68 -0
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +49 -0
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +232 -0
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +111 -0
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +94 -0
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +159 -0
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +232 -0
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScaleSizeScope.kt +17 -0
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +459 -0
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +169 -0
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +216 -0
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +180 -0
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +251 -0
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +80 -0
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +306 -0
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +31 -0
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +385 -0
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +38 -0
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +62 -0
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +88 -0
  108. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +144 -0
  109. package/gradle.properties +19 -0
  110. package/gradlew +240 -0
  111. package/gradlew.bat +91 -0
  112. package/ios/Application/ApplicationEnvironment.swift +50 -0
  113. package/ios/Application/Components.swift +263 -0
  114. package/ios/Application/ComposeApi.swift +22 -0
  115. package/ios/Application/FloatingButton.swift +172 -0
  116. package/ios/Application/HeaderRight.swift +271 -0
  117. package/ios/Application/Screen.swift +249 -0
  118. package/ios/Badge/BadgeDot.swift +31 -0
  119. package/ios/Button/Button.swift +211 -0
  120. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +126 -0
  121. package/ios/Checkbox/Checkbox.swift +81 -0
  122. package/ios/Chip/Chip.swift +96 -0
  123. package/ios/Colors+Radius+Spacing/Colors.swift +172 -0
  124. package/ios/Colors+Radius+Spacing/Radius.swift +22 -0
  125. package/ios/Colors+Radius+Spacing/Spacing.swift +12 -0
  126. package/ios/Extensions/Color++.swift +25 -0
  127. package/ios/Icon/Icon.swift +51 -0
  128. package/ios/Image/Image.swift +70 -0
  129. package/ios/Input/Input.swift +207 -0
  130. package/ios/Input/InputPhoneNumber.swift +176 -0
  131. package/ios/Input/InputSearch.swift +238 -0
  132. package/ios/Input/InputTextArea.swift +242 -0
  133. package/ios/Lottie/LottieView.swift +86 -0
  134. package/ios/OTPKeyboard/KeyboardButton.swift +41 -0
  135. package/ios/OTPKeyboard/OTPKeyboard.swift +145 -0
  136. package/ios/Popup/PopupDisplay.swift +284 -0
  137. package/ios/Popup/PopupInput.swift +96 -0
  138. package/ios/Popup/PopupPromotion.swift +73 -0
  139. package/ios/PopupView/FullscreenPopup.swift +251 -0
  140. package/ios/PopupView/Modifiers.swift +158 -0
  141. package/ios/PopupView/PopupView.swift +289 -0
  142. package/ios/PopupView/Utils++.swift +281 -0
  143. package/ios/ScrollIndicator/ScrollIndicator.swift +110 -0
  144. package/ios/Swipeable/SwipeCell.swift +278 -0
  145. package/ios/Swipeable/SwipeCellModel.swift +86 -0
  146. package/ios/Switch/Switch.swift +44 -0
  147. package/ios/Template/Logo/Logo.swift +75 -0
  148. package/ios/Template/TrustBanner/TrustBanner.swift +120 -0
  149. package/ios/Theme.md +18 -0
  150. package/ios/Typography/Text.swift +140 -0
  151. package/ios/Typography/Typography.swift +95 -0
  152. package/ios/native-kits.podspec +18 -0
  153. package/package.json +6 -7
  154. package/settings.gradle.kts +25 -0
  155. package/shared/build.gradle.kts +0 -74
@@ -0,0 +1,86 @@
1
+
2
+
3
+ import Foundation
4
+ import SwiftUI
5
+
6
+ // MARK: - SwipeGroupSide
7
+
8
+ public enum SwipeGroupSide {
9
+ case leading
10
+ case trailing
11
+
12
+ // MARK: Internal
13
+
14
+ var sideFactor: CGFloat {
15
+ switch self {
16
+ case .leading:
17
+ return 1
18
+
19
+ case .trailing:
20
+ return -1
21
+ }
22
+ }
23
+ }
24
+
25
+ // MARK: - SwipeCellActionItem
26
+
27
+ public struct SwipeCellActionItem: Identifiable {
28
+ // MARK: Lifecycle
29
+
30
+ /// Initializer
31
+ /// - Parameter id: Required to identify each buttin in the side menu. Default is a random uuid string.
32
+ /// - Parameter buttonView: The view in the foreground of the menu button. Make sure to set a maximum frame height less than the cell height!
33
+ /// - Parameter swipeOutButtonView: Alternative button view that is displayed only when the offset during swipe is beyond the swipe out trigger value.
34
+ /// - Parameter buttonWidth: Width of the button. The the open side menu width is calculated from the sum of all button widths. Default is 75.
35
+ /// - Parameter backgroundColor: The background colour of the the menu button.
36
+ /// - Parameter swipeOutAction: A Boolean that determines if a swipe out action is activated or not. Default is false.
37
+ /// - Parameter swipeOutHapticFeedbackType: If a swipeOutAction is activated, a haptic feedback will occur after the swipe out threshold is passed. Default is nil.
38
+ /// - Parameter swipeOutIsDestructive: A Boolean that determines if the swipe out is destructive. If true, the content cell view will be "move out of sight" once the swipe out is triggered.
39
+ public init(id: String = UUID().uuidString, buttonView: @escaping ()->AnyView, swipeOutButtonView: (()->AnyView)? = nil, buttonWidth: CGFloat = 75, backgroundColor: Color, swipeOutAction: Bool = false, swipeOutHapticFeedbackType: UINotificationFeedbackGenerator.FeedbackType? = nil, swipeOutIsDestructive: Bool = true, actionCallback: @escaping ()->()) {
40
+ self.id = id
41
+ self.buttonView = buttonView
42
+ self.swipeOutButtonView = swipeOutButtonView
43
+ self.buttonWidth = buttonWidth
44
+ self.backgroundColor = backgroundColor
45
+ self.swipeOutAction = swipeOutAction
46
+ self.swipeOutHapticFeedbackType = swipeOutHapticFeedbackType
47
+ self.swipeOutIsDestructive = swipeOutIsDestructive
48
+ self.actionCallback = actionCallback
49
+ }
50
+
51
+ // MARK: Public
52
+
53
+ public var id: String
54
+ public var buttonView: ()->AnyView
55
+ public var swipeOutButtonView: (()->AnyView)?
56
+ public var buttonWidth: CGFloat
57
+ public var backgroundColor: Color
58
+ public var swipeOutAction: Bool
59
+ public var swipeOutHapticFeedbackType: UINotificationFeedbackGenerator.FeedbackType?
60
+ public var swipeOutIsDestructive: Bool
61
+ /// public var swipeOutButtonViewScaleFactor: CGFloat
62
+ public var actionCallback: ()->()
63
+ }
64
+
65
+ // MARK: - SwipeCellSettings
66
+
67
+ /// Swipe Cell Settings
68
+ public struct SwipeCellSettings {
69
+ // MARK: Lifecycle
70
+
71
+ /// initializer
72
+ public init(openTriggerValue: CGFloat = 60, swipeOutTriggerRatio: CGFloat = 0.7, addWidthMargin: CGFloat = 5) {
73
+ self.openTriggerValue = openTriggerValue
74
+ self.swipeOutTriggerRatio = swipeOutTriggerRatio
75
+ self.addWidthMargin = addWidthMargin
76
+ }
77
+
78
+ // MARK: Public
79
+
80
+ /// minimum horizontal translation value necessary to open the side menu
81
+ public var openTriggerValue: CGFloat
82
+ /// the ratio of the total cell width that triggers a swipe out action (provided one action has swipe out activated)
83
+ public var swipeOutTriggerRatio: CGFloat = 0.7
84
+ /// An additional value to add to the open menu width. This is useful if the cell has rounded corners.
85
+ public var addWidthMargin: CGFloat = 5
86
+ }
@@ -0,0 +1,44 @@
1
+ import Foundation
2
+ import SwiftUI
3
+
4
+ public struct Switch: View{
5
+ @Binding var value: Bool
6
+ var disabled: Bool
7
+ var onChange: ((Bool)->Void)?
8
+
9
+ public init(_ value: Binding<Bool>,disabled: Bool = false, onChange: ((Bool)->Void)? = nil){
10
+ self._value = value
11
+ self.disabled = disabled
12
+ self.onChange = onChange
13
+ }
14
+
15
+
16
+ public var body: some View {
17
+ SwiftUI.Button(action: {
18
+ withAnimation{
19
+ value.toggle()
20
+ onChange?(value)
21
+ }
22
+ }){
23
+ HStack{
24
+ HStack {
25
+ }
26
+ .frame(width: 6, height: 6)
27
+ .background(value ? Colors.pink03 : Colors.black07)
28
+ .clipShape(Circle())
29
+ .opacity(disabled ? 0.4 : 1)
30
+ }
31
+ .frame(width: 14, height: 14)
32
+ .background(Colors.black01)
33
+ .clipShape(Circle())
34
+ .padding(.leading,5)
35
+ .padding(.trailing,5)
36
+
37
+ }
38
+ .disabled(disabled)
39
+ .frame(width: 40, height: 24, alignment: value == true ? .trailing : .leading)
40
+ .background(value ? Colors.pink03 : Colors.black07)
41
+ .clipShape(Capsule())
42
+ .opacity(disabled ? 0.4 : 1)
43
+ }
44
+ }
@@ -0,0 +1,75 @@
1
+ import Foundation
2
+ import SwiftUI
3
+
4
+ public struct LogoView: View {
5
+ var type: String
6
+ var useShadow: Bool
7
+ var useBorder: Bool
8
+ var useBackground : Bool
9
+ var backgroundColor: Color
10
+ var shadowColor : Color
11
+ var borderColor : Color
12
+ var source: String
13
+ var radius: CGFloat
14
+
15
+ public init(source: String = "",
16
+ type: String = "image",
17
+ useBackground : Bool = true,
18
+ useShadow: Bool = true,
19
+ useBorder : Bool = true,
20
+ backgroundColor: Color = Colors.black01,
21
+ shadowColor : Color = Color(hex: "d9d9d9"),
22
+ borderColor : Color = Color(hex: "e2e2e2")){
23
+ self.type = type
24
+ self.useShadow = useShadow
25
+ self.useBorder = useBorder
26
+ self.useBackground = useBackground
27
+ self.backgroundColor = backgroundColor
28
+ self.borderColor = borderColor
29
+ self.source = source
30
+ self.shadowColor = shadowColor
31
+ self.radius = type == "image" ? 7 : 0
32
+ }
33
+
34
+
35
+ public var body: some View {
36
+ return ImageView(source)
37
+ .scaledToFit()
38
+ .frame(width: 28, height: 28)
39
+ .cornerRadius(radius)
40
+ .containerBorder(type, useBorder, borderColor)
41
+ .containerBackground(type, useBackground, backgroundColor)
42
+ .containerShadow(useShadow, shadowColor)
43
+ }
44
+
45
+ }
46
+
47
+ private extension View {
48
+ func containerBorder (_ type: String, _ useBorder: Bool, _ borderColor: Color) -> some View {
49
+ Group {
50
+ if (useBorder && type != "icon") {
51
+ self.overlay(RoundedRectangle(cornerRadius: 8).stroke(borderColor, lineWidth: 1))
52
+ } else {
53
+ self
54
+ }
55
+ }
56
+ }
57
+ func containerBackground (_ type: String, _ useBackground: Bool, _ backgroundColor: Color) -> some View {
58
+ Group {
59
+ if (useBackground && type != "icon") {
60
+ self.background(backgroundColor)
61
+ } else {
62
+ self
63
+ }
64
+ }
65
+ }
66
+ func containerShadow (_ useShadow: Bool, _ shadowColor: Color) -> some View {
67
+ Group {
68
+ if useShadow {
69
+ self.shadow(color: shadowColor, radius: 2, x: 0, y: 2)
70
+ } else {
71
+ self
72
+ }
73
+ }
74
+ }
75
+ }
@@ -0,0 +1,120 @@
1
+ //
2
+ // TrustBanner.swift
3
+ // MoMoUIKits
4
+ //
5
+ // Created by Nguyễn Hoàng Sơn on 14/12/2023.
6
+ //
7
+
8
+ import Foundation
9
+ import SwiftUI
10
+ import SDWebImageSwiftUI
11
+
12
+ let jsonUrl = "https://static.momocdn.net/app/json/component-kits/design_system.json"
13
+
14
+ public struct TrustBannerData: Decodable {
15
+ let content: [String: String]
16
+ let subContent: [String: String]
17
+ let pciImage: String
18
+ let sslImage: String
19
+ let urlConfig: String
20
+ let icons: [String]
21
+ let momoImage: String
22
+
23
+ enum CodingKeys: String, CodingKey {
24
+ case content
25
+ case subContent
26
+ case pciImage
27
+ case sslImage
28
+ case icons
29
+ case momoImage
30
+ case urlConfig = "url_config"
31
+ }
32
+ }
33
+
34
+ let defaultBanner = TrustBannerData(
35
+ content: ["vi": "An toàn tài sản & Bảo mật thông tin của bạn là ưu tiên hàng đầu của MoMo.",
36
+ "en": "Ensuring financial security and data privacy is MoMo's highest priority."],
37
+ subContent: [
38
+ "vi": "Tìm hiểu thêm",
39
+ "en": "Learn more"
40
+ ],
41
+ pciImage: "https://static.momocdn.net/app/img/kits/trustBanner/pci.png",
42
+ sslImage: "https://static.momocdn.net/app/img/kits/trustBanner/ssl.png",
43
+ urlConfig: "login_and_security",
44
+ icons: [
45
+ "https://static.momocdn.net/app/img/kits/trustBanner/ic_viettinbank.png",
46
+ "https://static.momocdn.net/app/img/kits/trustBanner/ic_agribank.png",
47
+ "https://static.momocdn.net/app/img/kits/trustBanner/ic_vietcombank.png",
48
+ "https://static.momocdn.net/app/img/kits/trustBanner/ic_bidv.png"
49
+ ],
50
+ momoImage: "https://static.momocdn.net/app/img/kits/trustBanner/ic_secu.png"
51
+ )
52
+
53
+ public struct TrustBanner: View {
54
+ @EnvironmentObject var applicationEnvironment: ApplicationEnvironment
55
+
56
+ var onPress: ((String)->Void)?
57
+
58
+ public init(onPress: ((String)->Void)?) {
59
+ self.onPress = onPress
60
+ }
61
+
62
+ var language: String? = "vi"
63
+
64
+ func onPressSecurity() {
65
+ if (onPress != nil) {
66
+ onPress!(applicationEnvironment.config?.trustBanner?.urlConfig ?? defaultBanner.urlConfig)
67
+ }
68
+ }
69
+
70
+
71
+ public var body: some View {
72
+ HStack(alignment: .center, spacing: 8) {
73
+ WebImage(url: URL(string: applicationEnvironment.config?.trustBanner?.momoImage ?? defaultBanner.momoImage))
74
+ .resizable()
75
+ .scaledToFit()
76
+ .frame(width: 64, height: 64)
77
+ VStack(alignment: .leading){
78
+ Text(applicationEnvironment.config?.trustBanner?.content[language ?? "vi"] as? String ?? defaultBanner.content[language ?? "vi"])
79
+ .foregroundColor(Color(hex: "484848"))
80
+ .lineLimit(2)
81
+ .font(.system(size: 13, weight: Font.Weight.regular))
82
+ .lineSpacing(3)
83
+ .padding(.bottom, 8)
84
+ HStack {
85
+ HStack(spacing: 0) {
86
+ Text(applicationEnvironment.config?.trustBanner?.subContent[language ?? "vi"] as? String ?? defaultBanner.subContent[language ?? "vi"])
87
+ .foregroundColor(Colors.pink03)
88
+ .font(.system(size: 13, weight: .bold))
89
+ .padding(.trailing, 4)
90
+
91
+ Icon(source: "arrow_chevron_right_small", color: Colors.pink03)
92
+ }.onTapGesture {
93
+ onPressSecurity()
94
+ }
95
+
96
+ Spacer()
97
+ HStack{
98
+ WebImage(url: URL(string: applicationEnvironment.config?.trustBanner?.pciImage ?? defaultBanner.pciImage))
99
+ .resizable()
100
+ .scaledToFit()
101
+ .frame(width: 24, height: 20)
102
+ WebImage(url: URL(string: applicationEnvironment.config?.trustBanner?.sslImage ?? defaultBanner.sslImage))
103
+ .resizable()
104
+ .scaledToFit()
105
+ .frame(width: 52, height: 20)
106
+ }
107
+ }
108
+
109
+ }
110
+
111
+ }
112
+ .padding(.all, 12)
113
+ .background(Color(hex: "F2F8FF"))
114
+ .cornerRadius(12)
115
+ .onTapGesture {
116
+ onPressSecurity()
117
+ }
118
+ .frame(maxWidth: UIScreen.main.bounds.size.width)
119
+ }
120
+ }
package/ios/Theme.md ADDED
@@ -0,0 +1,18 @@
1
+ ## 🎯 Usage
2
+ ### Declaring themes with Asset
3
+ To get started, you need to define four different types of assets in xcode
4
+ ```swift
5
+ public static let primary = Color("Primary")
6
+ public static let primaryDark = Color("PrimaryDark")
7
+ public static let primaryLight = Color("PrimaryLight")
8
+ public static let secondary = Color("Secondary")
9
+ public static let background = Color("Background")
10
+ public static let border = Color("Border")
11
+ public static let text = Color("Text")
12
+ public static let textSecondary = Color("TextSecondary")
13
+ public static let card = Color("Card")
14
+ public static let error = Color("Error")
15
+ public static let info = Color("Info")
16
+ public static let success = Color("Success")
17
+ ```
18
+ > You can refer Colors class with static colors
@@ -0,0 +1,140 @@
1
+ import SwiftUI
2
+
3
+ public func scaleSize(_ size: CGFloat) -> CGFloat {
4
+ let defaultScreenSize: CGFloat = 375
5
+ let maxFontScale: CGFloat = 1.5
6
+ let maxDeviceScale: CGFloat = 5
7
+
8
+ let deviceWidth = UIScreen.main.bounds.width
9
+ let deviceScale = deviceWidth / defaultScreenSize
10
+
11
+ let defaultFont = UIFont.systemFont(ofSize: UIFont.labelFontSize)
12
+ let scaledFont = UIFontMetrics.default.scaledFont(for: defaultFont)
13
+ let fontScale = scaledFont.pointSize / defaultFont.pointSize
14
+
15
+ var fontSizeDeviceScale = size
16
+ var fontSizeOSScale = size
17
+
18
+
19
+ if deviceScale > 1 {
20
+ fontSizeDeviceScale = min(fontSizeDeviceScale * deviceScale, fontSizeDeviceScale + maxDeviceScale)
21
+ }
22
+
23
+ if fontScale > 1 {
24
+ fontSizeOSScale = min(fontSizeOSScale * fontScale, fontSizeOSScale * maxFontScale)
25
+ }
26
+
27
+ return max(fontSizeDeviceScale, fontSizeOSScale)
28
+ }
29
+
30
+ public enum TypographyStyle {
31
+ case headlineDefaultBold
32
+ case headerMBold
33
+ case headerDefaultBold
34
+ case headerSSemibold
35
+ case headerXsSemibold
36
+ case bodyDefaultRegular
37
+ case bodyDefaultRegularStrikethrough
38
+ case descriptionDefaultRegular
39
+ case descriptionDefaultRegularStrikethrough
40
+ case descriptionXsRegular
41
+ case descriptionXsRegularStrikethrough
42
+ case labelDefaultMedium
43
+ case labelSMedium
44
+ case labelXsMedium
45
+ case actionDefaultBold
46
+ case actionSBold
47
+ case actionXsBold
48
+ case actionXxsBold
49
+ }
50
+
51
+ public extension TypographyStyle {
52
+ var fontSize: CGFloat {
53
+ switch self {
54
+ case .headlineDefaultBold: return 24
55
+ case .headerMBold: return 18
56
+ case .headerDefaultBold: return 16
57
+ case .headerSSemibold: return 14
58
+ case .headerXsSemibold: return 12
59
+ case .bodyDefaultRegular, .bodyDefaultRegularStrikethrough: return 14
60
+ case .descriptionDefaultRegular, .descriptionDefaultRegularStrikethrough: return 12
61
+ case .descriptionXsRegular, .descriptionXsRegularStrikethrough: return 10
62
+ case .labelDefaultMedium: return 14
63
+ case .labelSMedium: return 12
64
+ case .labelXsMedium: return 10
65
+ case .actionDefaultBold: return 16
66
+ case .actionSBold: return 14
67
+ case .actionXsBold: return 12
68
+ case .actionXxsBold: return 10
69
+ }
70
+ }
71
+ var lineHeight: CGFloat {
72
+ switch self {
73
+ case .headlineDefaultBold: return 34
74
+ case .headerMBold: return 26
75
+ case .headerDefaultBold: return 22
76
+ case .headerSSemibold: return 20
77
+ case .headerXsSemibold: return 18
78
+ case .bodyDefaultRegular, .bodyDefaultRegularStrikethrough: return 20
79
+ case .descriptionDefaultRegular, .descriptionDefaultRegularStrikethrough: return 18
80
+ case .descriptionXsRegular, .descriptionXsRegularStrikethrough: return 14
81
+ case .labelDefaultMedium: return 20
82
+ case .labelSMedium: return 18
83
+ case .labelXsMedium: return 14
84
+ case .actionDefaultBold: return 22
85
+ case .actionSBold: return 20
86
+ case .actionXsBold: return 18
87
+ case .actionXxsBold: return 14
88
+ }
89
+ }
90
+ var fontWeight: Font.Weight {
91
+ switch self {
92
+ case .headlineDefaultBold, .headerMBold, .headerDefaultBold,
93
+ .actionDefaultBold, .actionSBold, .actionXsBold, .actionXxsBold:
94
+ return .bold
95
+ case .headerSSemibold, .headerXsSemibold:
96
+ return .semibold
97
+ case .bodyDefaultRegular, .bodyDefaultRegularStrikethrough,
98
+ .descriptionDefaultRegular, .descriptionDefaultRegularStrikethrough,
99
+ .descriptionXsRegular, .descriptionXsRegularStrikethrough:
100
+ return .regular
101
+ case .labelDefaultMedium, .labelSMedium, .labelXsMedium:
102
+ return .medium
103
+ }
104
+ }
105
+ var isStrikethrough: Bool {
106
+ switch self {
107
+ case .bodyDefaultRegularStrikethrough,
108
+ .descriptionDefaultRegularStrikethrough,
109
+ .descriptionXsRegularStrikethrough:
110
+ return true
111
+ default:
112
+ return false
113
+ }
114
+ }
115
+ }
116
+
117
+ public struct MomoText: View {
118
+ private let content: String
119
+ private let typography: TypographyStyle
120
+ private let color: Color
121
+
122
+ public init(
123
+ _ content: String,
124
+ typography: TypographyStyle = .bodyDefaultRegular,
125
+ color: Color = Colors.text
126
+ ) {
127
+ self.content = content
128
+ self.typography = typography
129
+ self.color = color
130
+ }
131
+
132
+ public var body: some View {
133
+ let text = SwiftUI.Text(content)
134
+ .font(.system(size: scaleSize(typography.fontSize), weight: typography.fontWeight))
135
+ .foregroundColor(color)
136
+ .lineSpacing(scaleSize(typography.lineHeight) - scaleSize(typography.fontSize))
137
+
138
+ return text
139
+ }
140
+ }
@@ -0,0 +1,95 @@
1
+ import SwiftUI
2
+
3
+ public extension Font {
4
+ static func appFont(size: CGFloat) -> Font {
5
+ let defaultScreenSize: CGFloat = 375
6
+ let maxFontScale: CGFloat = 1.2
7
+ let maxDeviceScale: CGFloat = 5
8
+
9
+ let deviceWidth = UIScreen.main.bounds.width
10
+ let deviceScale = deviceWidth / defaultScreenSize
11
+
12
+ let defaultFont = UIFont.systemFont(ofSize: UIFont.labelFontSize)
13
+ let scaledFont = UIFontMetrics.default.scaledFont(for: defaultFont)
14
+ let fontScale = scaledFont.pointSize / defaultFont.pointSize
15
+
16
+ var fontSize = size
17
+
18
+ if deviceScale > 1 {
19
+ fontSize = min(fontSize * deviceScale, fontSize + maxDeviceScale)
20
+ }
21
+
22
+ if fontScale > 1 {
23
+ fontSize = min(fontSize * fontScale, fontSize * maxFontScale)
24
+ }
25
+
26
+ return Font.system(size: fontSize)
27
+ }
28
+
29
+ // New supported typography styles
30
+ static let headline_default_bold = appFont(size: 24).weight(.bold)
31
+ static let header_m_bold = appFont(size: 18).weight(.bold)
32
+ static let header_default_bold = appFont(size: 16).weight(.bold)
33
+ static let header_default_semibold = appFont(size: 16).weight(.semibold)
34
+ static let header_s_semibold = appFont(size: 14).weight(.semibold)
35
+ static let header_xs_semibold = appFont(size: 12).weight(.semibold)
36
+ static let body_default_regular = appFont(size: 14).weight(.regular)
37
+ static let description_default_regular = appFont(size: 12).weight(.regular)
38
+ static let description_xs_regular = appFont(size: 10).weight(.regular)
39
+ static let label_default_medium = appFont(size: 14).weight(.medium)
40
+ static let label_s_medium = appFont(size: 12).weight(.medium)
41
+ static let label_xs_medium = appFont(size: 10).weight(.medium)
42
+ static let action_default_bold = appFont(size: 16).weight(.bold)
43
+ static let action_s_bold = appFont(size: 14).weight(.bold)
44
+ static let action_xs_bold = appFont(size: 12).weight(.bold)
45
+ static let action_xxs_bold = appFont(size: 10).weight(.bold)
46
+
47
+ // Legacy styles
48
+ static let headline_default = appFont(size: 28).weight(.semibold)
49
+ static let headline_s = appFont(size: 24).weight(.semibold)
50
+ static let headline_l = appFont(size: 32).weight(.semibold)
51
+ static let headline_xl = appFont(size: 36).weight(.semibold)
52
+ static let title_default = appFont(size: 20).weight(.bold)
53
+ static let title_xs = appFont(size: 16).weight(.bold)
54
+ static let title_s = appFont(size: 18).weight(.bold)
55
+ static let header_default = appFont(size: 15).weight(.semibold)
56
+ static let header_xs = appFont(size: 12).weight(.semibold)
57
+ static let header_s = appFont(size: 14).weight(.semibold)
58
+ static let paragraph_default = appFont(size: 15).weight(.regular)
59
+ static let paragraph_bold = appFont(size: 15).weight(.bold)
60
+ static let description_default = appFont(size: 14).weight(.regular)
61
+ static let description_xs = appFont(size: 10).weight(.regular)
62
+ static let description_s = appFont(size: 12).weight(.regular)
63
+ static let label_default = appFont(size: 14).weight(.medium)
64
+ static let label_xxs = appFont(size: 8).weight(.medium)
65
+ static let label_xs = appFont(size: 10).weight(.medium)
66
+ static let label_s = appFont(size: 12).weight(.medium)
67
+ static let action_default = appFont(size: 16).weight(.bold)
68
+ static let action_xxs = appFont(size: 10).weight(.bold)
69
+ static let action_xs = appFont(size: 12).weight(.bold)
70
+ static let action_s = appFont(size: 15).weight(.bold)
71
+
72
+ // deprecated
73
+ static let h1 = appFont(size: 36).weight(.semibold) //headline_xl
74
+ static let h2 = appFont(size: 32).weight(.semibold)
75
+ static let h3 = appFont(size: 28).weight(.semibold)
76
+ static let h4 = appFont(size: 24).weight(.semibold)
77
+ static let title1 = appFont(size: 20).weight(.bold)
78
+ static let title2 = appFont(size: 18).weight(.bold)
79
+ static let title3 = appFont(size: 16).weight(.bold)
80
+ static let headerText1 = appFont(size: 15).weight(.semibold) //header_default
81
+ static let headerText2 = appFont(size: 14).weight(.semibold)
82
+ static let headerText3 = appFont(size: 12).weight(.semibold)
83
+ static let paragraph = appFont(size: 15).weight(.regular) //paragraph_default
84
+ static let description1 = appFont(size: 14).weight(.regular)
85
+ static let description2 = appFont(size: 12).weight(.regular)
86
+ static let description3 = appFont(size: 10).weight(.regular)
87
+ static let label1 = appFont(size: 14).weight(.medium)
88
+ static let label2 = appFont(size: 12).weight(.medium)
89
+ static let label3 = appFont(size: 10).weight(.medium)
90
+ static let label4 = appFont(size: 8).weight(.medium)
91
+ static let action1 = appFont(size: 16).weight(.bold)
92
+ static let action2 = appFont(size: 15).weight(.bold)
93
+ static let action3 = appFont(size: 12).weight(.bold)
94
+ static let action4 = appFont(size: 10).weight(.bold)
95
+ }
@@ -0,0 +1,18 @@
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'
11
+
12
+ spec.source_files = "**/*.swift"
13
+
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,11 +1,10 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.152.4-beta.6",
4
- "main": "index.js",
5
- "scripts": {
6
- "test": "echo \"Error: no test specified\" && exit 1"
3
+ "version": "0.152.4-maxapi",
4
+ "private": false,
5
+ "dependencies": {
6
+ "@momo-platform/native-max-api": "1.0.18"
7
7
  },
8
- "author": "",
9
- "license": "ISC",
10
- "description": ""
8
+ "devDependencies": {},
9
+ "license": "MoMo"
11
10
  }
@@ -0,0 +1,25 @@
1
+ rootProject.name = "momo-kits"
2
+
3
+ include(":sample:androidApp")
4
+ include(":compose")
5
+ include(":sample:shared")
6
+
7
+ pluginManagement {
8
+ repositories {
9
+ gradlePluginPortal()
10
+ mavenCentral()
11
+ google()
12
+ maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
13
+ }
14
+ }
15
+
16
+ dependencyResolutionManagement {
17
+ repositories {
18
+ mavenCentral()
19
+ google()
20
+ maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
21
+ }
22
+ }
23
+
24
+ include(":NativeMaxApi")
25
+ project(":NativeMaxApi").projectDir = file("./node_modules/@momo-platform/native-max-api/NativeMaxApi")