@momo-kits/native-kits 0.0.1-beta.2
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/CODE_OF_CONDUCT.md +133 -0
- package/CONTRIBUTING.md +114 -0
- package/LICENSE +20 -0
- package/README.md +6 -0
- package/android/build.gradle +82 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/momoplatform/nativekits/NativeKitsPackage.kt +17 -0
- package/android/src/main/java/com/momoplatform/nativekits/NativeKitsViewManager.kt +20 -0
- package/example/ios/Example/Assets.xcassets/AppIcon.appiconset/Contents.json +63 -0
- package/example/ios/Example/Assets.xcassets/Background.colorset/Contents.json +38 -0
- package/example/ios/Example/Assets.xcassets/Border.colorset/Contents.json +38 -0
- package/example/ios/Example/Assets.xcassets/Card.colorset/Contents.json +38 -0
- package/example/ios/Example/Assets.xcassets/Contents.json +6 -0
- package/example/ios/Example/Assets.xcassets/Error.colorset/Contents.json +38 -0
- package/example/ios/Example/Assets.xcassets/Primary.colorset/Contents.json +38 -0
- package/example/ios/Example/Assets.xcassets/PrimaryDark.colorset/Contents.json +38 -0
- package/example/ios/Example/Assets.xcassets/PrimaryLight.colorset/Contents.json +38 -0
- package/example/ios/Example/Assets.xcassets/Secondary.colorset/Contents.json +38 -0
- package/example/ios/Example/Assets.xcassets/Success.colorset/Contents.json +38 -0
- package/example/ios/Example/Assets.xcassets/Text.colorset/Contents.json +38 -0
- package/example/ios/Example/Assets.xcassets/TextSecondary.colorset/Contents.json +38 -0
- package/example/ios/Example/Assets.xcassets/Warning.colorset/Contents.json +38 -0
- package/example/ios/Example/ComponentDetail.swift +35 -0
- package/example/ios/Example/ComponentItem.swift +24 -0
- package/example/ios/Example/ComponentModel.swift +31 -0
- package/example/ios/Example/ContentView.swift +53 -0
- package/example/ios/Example/Example.entitlements +10 -0
- package/example/ios/Example/Foundation/ButtonDemo.swift +80 -0
- package/example/ios/Example/Foundation/Popup/ActionSheets.swift +136 -0
- package/example/ios/Example/Foundation/Popup/Floats.swift +127 -0
- package/example/ios/Example/Foundation/Popup/Popups.swift +101 -0
- package/example/ios/Example/Foundation/PopupDemo.swift +366 -0
- package/example/ios/Example/Foundation/TypographyDemo.swift +53 -0
- package/example/ios/Example/Foundation.swift +26 -0
- package/example/ios/Example/Info.plist +18 -0
- package/example/ios/Example/Library/SwipeableDemo.swift +105 -0
- package/example/ios/Example/Library.swift +26 -0
- package/example/ios/Example/Main.swift +11 -0
- package/example/ios/Example/Overview.swift +20 -0
- package/example/ios/Example/Preview Content/Preview Assets.xcassets/Contents.json +6 -0
- 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 +33 -0
- package/example/ios/Example/Resource/library.json +8 -0
- package/example/ios/Example/Utils.swift +30 -0
- package/example/ios/Example/ViewModifier/DarkViewModifier.swift +22 -0
- package/example/ios/Example.xcodeproj/project.pbxproj +565 -0
- package/example/ios/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/example/ios/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- 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 +14 -0
- package/example/ios/Example.xcworkspace/contents.xcworkspacedata +10 -0
- package/example/ios/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/example/ios/Example.xcworkspace/xcuserdata/wem.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Example.xcworkspace/xcuserdata/wem.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +6 -0
- package/example/ios/Podfile +6 -0
- package/example/ios/Podfile.lock +16 -0
- package/example/ios/Pods/Local Podspecs/MoMoUIKits.podspec.json +29 -0
- package/example/ios/Pods/Manifest.lock +16 -0
- package/example/ios/Pods/Pods.xcodeproj/project.pbxproj +661 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/Pods-Example.xcscheme +58 -0
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +25 -0
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-dummy.m +5 -0
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-prefix.pch +12 -0
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-umbrella.h +16 -0
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.debug.xcconfig +12 -0
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.modulemap +6 -0
- package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.release.xcconfig +12 -0
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.markdown +3 -0
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.plist +29 -0
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-dummy.m +5 -0
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-umbrella.h +16 -0
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig +14 -0
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.modulemap +6 -0
- package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig +14 -0
- package/ios/Button/Button.swift +131 -0
- package/ios/Colors+Spacing/Colors.swift +170 -0
- package/ios/Colors+Spacing/Radius.swift +11 -0
- package/ios/Colors+Spacing/Spacing.swift +12 -0
- package/ios/Extensions/Color++.swift +25 -0
- package/ios/OTPKeyboard/KeyboardButton.swift +33 -0
- package/ios/OTPKeyboard/OTPKeyboard.swift +145 -0
- package/ios/Popup/Modifiers.swift +172 -0
- package/ios/Popup/PopupView.swift +397 -0
- package/ios/Popup/Utils.swift +186 -0
- package/ios/Swipeable/SwipeCell.swift +270 -0
- package/ios/Swipeable/SwipeCellModel.swift +86 -0
- package/ios/Theme.md +18 -0
- package/ios/Typography/Typography.swift +30 -0
- package/ios/native-kits.podspec +15 -0
- package/package.json +8 -0
- package/publish.sh +28 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
|
|
2
|
+
import MoMoUIKits
|
|
3
|
+
import SwiftUI
|
|
4
|
+
|
|
5
|
+
// MARK: - SwipeableDemo
|
|
6
|
+
|
|
7
|
+
struct SwipeableDemo: View {
|
|
8
|
+
@State var data = (1 ... 10).map { "Item \($0)" }
|
|
9
|
+
@State var currentUserInteractionCellID: String?
|
|
10
|
+
|
|
11
|
+
var body: some View {
|
|
12
|
+
GeometryReader { _ in
|
|
13
|
+
ScrollView {
|
|
14
|
+
LazyVStack(alignment: .center, spacing: 10) {
|
|
15
|
+
ForEach(data, id: \.self) { item in
|
|
16
|
+
RowView(item: item, deletionCallback: { item in
|
|
17
|
+
self.data = self.data.filter { anyItem->Bool in
|
|
18
|
+
anyItem != item
|
|
19
|
+
}
|
|
20
|
+
}, currentUserInteractionCellID: $currentUserInteractionCellID)
|
|
21
|
+
}
|
|
22
|
+
}.animation(.default, value: data)
|
|
23
|
+
.padding(20)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// MARK: - RowView
|
|
30
|
+
|
|
31
|
+
struct RowView: View {
|
|
32
|
+
var item: String
|
|
33
|
+
var deletionCallback: (String)->()
|
|
34
|
+
@Binding var currentUserInteractionCellID: String?
|
|
35
|
+
|
|
36
|
+
var body: some View {
|
|
37
|
+
Text(item)
|
|
38
|
+
.frame(maxWidth: .infinity)
|
|
39
|
+
.padding(.vertical, 16)
|
|
40
|
+
.background(RoundedRectangle(cornerRadius: 5).foregroundColor(.green))
|
|
41
|
+
.swipeCell(id: self.item, leadingSideGroup: leftGroup(), trailingSideGroup: rightGroup())
|
|
42
|
+
.onTapGesture {}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
func leftGroup()->[SwipeCellActionItem] {
|
|
46
|
+
return [SwipeCellActionItem(buttonView: {
|
|
47
|
+
self.pinView(swipeOut: false)
|
|
48
|
+
|
|
49
|
+
}, swipeOutButtonView: {
|
|
50
|
+
self.pinView(swipeOut: true)
|
|
51
|
+
}, buttonWidth: 80, backgroundColor: .yellow, swipeOutAction: true, swipeOutHapticFeedbackType: .success, swipeOutIsDestructive: false)
|
|
52
|
+
{}]
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
func pinView(swipeOut: Bool)->AnyView {
|
|
56
|
+
Group {
|
|
57
|
+
Spacer()
|
|
58
|
+
VStack(spacing: 2) {
|
|
59
|
+
Image(systemName: "pin").font(.system(size: 24)).foregroundColor(.white)
|
|
60
|
+
}.frame(maxHeight: 80).padding(.horizontal, swipeOut ? 20 : 5)
|
|
61
|
+
if swipeOut == false {
|
|
62
|
+
Spacer()
|
|
63
|
+
}
|
|
64
|
+
}.animation(.default).castToAnyView()
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
func rightGroup()->[SwipeCellActionItem] {
|
|
68
|
+
return [
|
|
69
|
+
SwipeCellActionItem(buttonView: {
|
|
70
|
+
VStack(spacing: 2) {
|
|
71
|
+
Image(systemName: "person.crop.circle.badge.plus").font(.system(size: 22)).foregroundColor(.white)
|
|
72
|
+
Text("Share").fixedSize().font(.system(size: 12)).foregroundColor(.white)
|
|
73
|
+
}.frame(maxHeight: 80).castToAnyView()
|
|
74
|
+
|
|
75
|
+
}, backgroundColor: .blue) {
|
|
76
|
+
print("share action!")
|
|
77
|
+
},
|
|
78
|
+
SwipeCellActionItem(buttonView: {
|
|
79
|
+
VStack(spacing: 2) {
|
|
80
|
+
Image(systemName: "folder.fill").font(.system(size: 22)).foregroundColor(.white)
|
|
81
|
+
Text("Move").fixedSize().font(.system(size: 12)).foregroundColor(.white)
|
|
82
|
+
}.frame(maxHeight: 80).castToAnyView()
|
|
83
|
+
|
|
84
|
+
}, backgroundColor: .purple, actionCallback: {
|
|
85
|
+
print("folder action")
|
|
86
|
+
}),
|
|
87
|
+
|
|
88
|
+
SwipeCellActionItem(buttonView: {
|
|
89
|
+
self.trashView(swipeOut: false)
|
|
90
|
+
}, swipeOutButtonView: {
|
|
91
|
+
self.trashView(swipeOut: true)
|
|
92
|
+
}, backgroundColor: .red, swipeOutAction: true, swipeOutHapticFeedbackType: .warning, swipeOutIsDestructive: true) {
|
|
93
|
+
print("delete action")
|
|
94
|
+
self.deletionCallback(item)
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
func trashView(swipeOut: Bool)->AnyView {
|
|
100
|
+
VStack(spacing: 3) {
|
|
101
|
+
Image(systemName: "trash").font(.system(size: swipeOut ? 28 : 22)).foregroundColor(.white)
|
|
102
|
+
Text("Delete").fixedSize().font(.system(size: swipeOut ? 16 : 12)).foregroundColor(.white)
|
|
103
|
+
}.frame(maxHeight: 80).animation(.default).castToAnyView()
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Library.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Created by Wem on 13/12/2022.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import SwiftUI
|
|
10
|
+
|
|
11
|
+
struct Library: View {
|
|
12
|
+
var libraries: [ComponentModel]
|
|
13
|
+
|
|
14
|
+
var body: some View {
|
|
15
|
+
NavigationView {
|
|
16
|
+
List(libraries) { item in
|
|
17
|
+
NavigationLink {
|
|
18
|
+
ComponentDetail(item)
|
|
19
|
+
} label: {
|
|
20
|
+
ComponentItem(item)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
.navigationTitle("Libraries")
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Overview.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Created by Wem on 13/12/2022.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import SwiftUI
|
|
10
|
+
import MoMoUIKits
|
|
11
|
+
|
|
12
|
+
struct Overview: View {
|
|
13
|
+
@AppStorage("isDarkMode") var isDarkMode: Bool = true
|
|
14
|
+
|
|
15
|
+
var body: some View {
|
|
16
|
+
VStack {
|
|
17
|
+
Toggle("DarkMode", isOn: $isDarkMode)
|
|
18
|
+
}.padding()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "Typography",
|
|
4
|
+
"name": "Typography",
|
|
5
|
+
"description": "The typography system",
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"id": "TextInput",
|
|
9
|
+
"name": "TextInput",
|
|
10
|
+
"description": "Text fields let users enter and edit text",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id": "Button",
|
|
14
|
+
"name": "Button",
|
|
15
|
+
"description": "Button component that should render nicely on any platform.",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": "IconButton",
|
|
19
|
+
"name": "IconButton",
|
|
20
|
+
"description": "Icon buttons allow users to take actions, and make choices, with a single tap.",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"id": "Image",
|
|
24
|
+
"name": "Image",
|
|
25
|
+
"description": "Imagery communicates and differentiates a product through visuals.",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"id": "Popup",
|
|
29
|
+
"name": "Popup",
|
|
30
|
+
"description": "sheet & popup in application",
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Utils.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Created by Wem on 23/12/2022.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
func load<T: Decodable>(_ filename: String) -> T {
|
|
11
|
+
let data: Data
|
|
12
|
+
|
|
13
|
+
guard let file = Bundle.main.url(forResource: filename, withExtension: nil)
|
|
14
|
+
else {
|
|
15
|
+
fatalError("Couldn't find \(filename) in main bundle.")
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
do {
|
|
19
|
+
data = try Data(contentsOf: file)
|
|
20
|
+
} catch {
|
|
21
|
+
fatalError("Couldn't load \(filename) from main bundle:\n\(error)")
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
do {
|
|
25
|
+
let decoder = JSONDecoder()
|
|
26
|
+
return try decoder.decode(T.self, from: data)
|
|
27
|
+
} catch {
|
|
28
|
+
fatalError("Couldn't parse \(filename) as \(T.self):\n\(error)")
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ViewModifier.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Created by Wem on 17/12/2022.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import SwiftUI
|
|
10
|
+
|
|
11
|
+
public struct DarkViewModifier: ViewModifier {
|
|
12
|
+
// MARK: Public
|
|
13
|
+
|
|
14
|
+
public func body(content: Content) -> some View {
|
|
15
|
+
content
|
|
16
|
+
.preferredColorScheme(isDarkMode ? .dark : .light)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// MARK: Internal
|
|
20
|
+
|
|
21
|
+
@AppStorage("isDarkMode") var isDarkMode: Bool = true
|
|
22
|
+
}
|