@momo-kits/native-kits 0.0.1-beta.4 → 0.2.0-kt22
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.
- package/README.md +176 -5
- package/ios/Application/ApplicationEnvironment.swift +50 -0
- package/ios/Application/Components.swift +263 -0
- package/ios/Application/ComposeApi.swift +22 -0
- package/ios/Application/FloatingButton.swift +172 -0
- package/ios/Application/HeaderRight.swift +271 -0
- package/ios/Application/Screen.swift +249 -0
- package/ios/Badge/Badge.swift +85 -0
- package/ios/Badge/BadgeDot.swift +31 -0
- package/ios/Badge/BadgeRibbon.swift +242 -0
- package/ios/Button/Button.swift +169 -89
- package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +126 -0
- package/ios/Checkbox/Checkbox.swift +81 -0
- package/ios/Chip/Chip.swift +96 -0
- package/ios/{Colors+Spacing → Colors+Radius+Spacing}/Colors.swift +21 -19
- package/ios/Colors+Radius+Spacing/Radius.swift +22 -0
- package/ios/Icon/Icon.swift +51 -0
- package/ios/Image/Image.swift +70 -0
- package/ios/Input/ErrorView.swift +55 -0
- package/ios/Input/Input.swift +159 -50
- package/ios/Input/InputPhoneNumber.swift +158 -0
- package/ios/Input/InputSearch.swift +238 -0
- package/ios/Input/InputTextArea.swift +242 -0
- package/ios/Lottie/LottieView.swift +86 -0
- package/ios/OTPKeyboard/KeyboardButton.swift +12 -4
- package/ios/OTPKeyboard/OTPKeyboard.swift +1 -1
- package/ios/Popup/PopupDisplay.swift +287 -0
- package/ios/Popup/PopupInput.swift +96 -0
- package/ios/Popup/PopupPromotion.swift +73 -0
- package/ios/PopupView/FullscreenPopup.swift +251 -0
- package/ios/{Popup → PopupView}/Modifiers.swift +6 -20
- package/ios/{Popup → PopupView}/PopupView.swift +38 -146
- package/ios/PopupView/Utils++.swift +281 -0
- package/ios/ScrollIndicator/ScrollIndicator.swift +110 -0
- package/ios/Swipeable/SwipeCell.swift +39 -31
- package/ios/Switch/Switch.swift +44 -0
- package/ios/Template/Logo/Logo.swift +75 -0
- package/ios/Template/TrustBanner/TrustBanner.swift +120 -0
- package/ios/Typography/Text.swift +140 -0
- package/ios/Typography/Typography.swift +70 -5
- package/ios/native-kits.podspec +20 -15
- package/package.json +6 -6
- package/CODE_OF_CONDUCT.md +0 -133
- package/CONTRIBUTING.md +0 -114
- package/LICENSE +0 -20
- package/android/build.gradle +0 -82
- package/android/gradle.properties +0 -5
- package/android/src/main/AndroidManifest.xml +0 -4
- package/android/src/main/java/com/momoplatform/nativekits/NativeKitsPackage.kt +0 -17
- package/android/src/main/java/com/momoplatform/nativekits/NativeKitsViewManager.kt +0 -20
- package/example/ios/Example/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -63
- package/example/ios/Example/Assets.xcassets/Background.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/Border.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/Card.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/Contents.json +0 -6
- package/example/ios/Example/Assets.xcassets/Error.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/Primary.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/PrimaryDark.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/PrimaryLight.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/Secondary.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/Success.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/Text.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/TextSecondary.colorset/Contents.json +0 -38
- package/example/ios/Example/Assets.xcassets/Warning.colorset/Contents.json +0 -38
- package/example/ios/Example/ComponentDetail.swift +0 -35
- package/example/ios/Example/ComponentItem.swift +0 -24
- package/example/ios/Example/ComponentModel.swift +0 -33
- package/example/ios/Example/ContentView.swift +0 -53
- package/example/ios/Example/Example.entitlements +0 -10
- package/example/ios/Example/Foundation/ButtonDemo.swift +0 -80
- package/example/ios/Example/Foundation/Popup/ActionSheets.swift +0 -136
- package/example/ios/Example/Foundation/Popup/Floats.swift +0 -127
- package/example/ios/Example/Foundation/Popup/Popups.swift +0 -101
- package/example/ios/Example/Foundation/PopupDemo.swift +0 -366
- package/example/ios/Example/Foundation/TextInputDemo.swift +0 -31
- package/example/ios/Example/Foundation/TypographyDemo.swift +0 -53
- package/example/ios/Example/Foundation.swift +0 -26
- package/example/ios/Example/Info.plist +0 -18
- package/example/ios/Example/Library/SwipeableDemo.swift +0 -105
- package/example/ios/Example/Library.swift +0 -26
- package/example/ios/Example/Main.swift +0 -11
- package/example/ios/Example/Overview.swift +0 -20
- package/example/ios/Example/Preview Content/Preview Assets.xcassets/Contents.json +0 -6
- package/example/ios/Example/Resource/SFProText-Black.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Bold.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Heavy.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Light.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Medium.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Regular.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Semibold.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Thin.ttf +0 -0
- package/example/ios/Example/Resource/SFProText-Ultralight.ttf +0 -0
- package/example/ios/Example/Resource/foundation.json +0 -33
- package/example/ios/Example/Resource/library.json +0 -8
- package/example/ios/Example/Utils.swift +0 -30
- package/example/ios/Example/ViewModifier/DarkViewModifier.swift +0 -22
- package/example/ios/Example.xcodeproj/project.pbxproj +0 -570
- package/example/ios/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/example/ios/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/example/ios/Example.xcodeproj/project.xcworkspace/xcuserdata/wem.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Example.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/example/ios/Example.xcworkspace/contents.xcworkspacedata +0 -10
- package/example/ios/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/example/ios/Example.xcworkspace/xcuserdata/wem.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Example.xcworkspace/xcuserdata/wem.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -6
- package/example/ios/Podfile +0 -6
- package/example/ios/Podfile.lock +0 -16
- package/example/ios/Pods/Local Podspecs/MoMoUIKits.podspec.json +0 -29
- package/example/ios/Pods/Manifest.lock +0 -16
- package/example/ios/Pods/Pods.xcodeproj/project.pbxproj +0 -661
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/Pods-Example.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +0 -25
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-dummy.m +0 -5
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-prefix.pch +0 -12
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-umbrella.h +0 -16
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.debug.xcconfig +0 -12
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.modulemap +0 -6
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.release.xcconfig +0 -12
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.markdown +0 -3
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.plist +0 -29
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-dummy.m +0 -5
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-umbrella.h +0 -16
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig +0 -14
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.modulemap +0 -6
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig +0 -14
- package/ios/Colors+Spacing/Radius.swift +0 -11
- package/ios/Popup/Utils++.swift +0 -163
- package/ios/Theme.md +0 -18
- package/publish.sh +0 -28
- /package/ios/{Colors+Spacing → Colors+Radius+Spacing}/Spacing.swift +0 -0
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import SwiftUI
|
|
2
|
+
|
|
3
|
+
public func scaleSize(_ size: CGFloat, _ scaleRate: CGFloat? = nil) -> CGFloat {
|
|
4
|
+
let defaultScreenSize: CGFloat = 375
|
|
5
|
+
let maxFontScale: CGFloat = scaleRate ?? 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
|
+
}
|
|
@@ -2,20 +2,85 @@ import SwiftUI
|
|
|
2
2
|
|
|
3
3
|
public extension Font {
|
|
4
4
|
static func appFont(size: CGFloat) -> Font {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
let defaultScreenSize: CGFloat = 375
|
|
6
|
+
let maxFontScale: CGFloat = 1.5
|
|
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
|
+
}
|
|
7
21
|
|
|
8
|
-
|
|
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
|
|
9
74
|
static let h2 = appFont(size: 32).weight(.semibold)
|
|
10
75
|
static let h3 = appFont(size: 28).weight(.semibold)
|
|
11
76
|
static let h4 = appFont(size: 24).weight(.semibold)
|
|
12
77
|
static let title1 = appFont(size: 20).weight(.bold)
|
|
13
78
|
static let title2 = appFont(size: 18).weight(.bold)
|
|
14
79
|
static let title3 = appFont(size: 16).weight(.bold)
|
|
15
|
-
static let headerText1 = appFont(size: 15).weight(.semibold)
|
|
80
|
+
static let headerText1 = appFont(size: 15).weight(.semibold) //header_default
|
|
16
81
|
static let headerText2 = appFont(size: 14).weight(.semibold)
|
|
17
82
|
static let headerText3 = appFont(size: 12).weight(.semibold)
|
|
18
|
-
static let paragraph = appFont(size: 15).weight(.regular)
|
|
83
|
+
static let paragraph = appFont(size: 15).weight(.regular) //paragraph_default
|
|
19
84
|
static let description1 = appFont(size: 14).weight(.regular)
|
|
20
85
|
static let description2 = appFont(size: 12).weight(.regular)
|
|
21
86
|
static let description3 = appFont(size: 10).weight(.regular)
|
package/ios/native-kits.podspec
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
Pod::Spec.new do |
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
19
|
+
|
|
20
|
+
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
"name": "@momo-kits/native-kits",
|
|
3
|
+
"version": "0.2.0-kt22",
|
|
4
|
+
"private": false,
|
|
5
|
+
"dependencies": {},
|
|
6
|
+
"devDependencies": {},
|
|
7
|
+
"license": "MoMo"
|
|
8
8
|
}
|
package/CODE_OF_CONDUCT.md
DELETED
|
@@ -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
|