@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.
Files changed (101) 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 +6 -0
  5. package/android/build.gradle +82 -0
  6. package/android/gradle.properties +5 -0
  7. package/android/src/main/AndroidManifest.xml +4 -0
  8. package/android/src/main/java/com/momoplatform/nativekits/NativeKitsPackage.kt +17 -0
  9. package/android/src/main/java/com/momoplatform/nativekits/NativeKitsViewManager.kt +20 -0
  10. package/example/ios/Example/Assets.xcassets/AppIcon.appiconset/Contents.json +63 -0
  11. package/example/ios/Example/Assets.xcassets/Background.colorset/Contents.json +38 -0
  12. package/example/ios/Example/Assets.xcassets/Border.colorset/Contents.json +38 -0
  13. package/example/ios/Example/Assets.xcassets/Card.colorset/Contents.json +38 -0
  14. package/example/ios/Example/Assets.xcassets/Contents.json +6 -0
  15. package/example/ios/Example/Assets.xcassets/Error.colorset/Contents.json +38 -0
  16. package/example/ios/Example/Assets.xcassets/Primary.colorset/Contents.json +38 -0
  17. package/example/ios/Example/Assets.xcassets/PrimaryDark.colorset/Contents.json +38 -0
  18. package/example/ios/Example/Assets.xcassets/PrimaryLight.colorset/Contents.json +38 -0
  19. package/example/ios/Example/Assets.xcassets/Secondary.colorset/Contents.json +38 -0
  20. package/example/ios/Example/Assets.xcassets/Success.colorset/Contents.json +38 -0
  21. package/example/ios/Example/Assets.xcassets/Text.colorset/Contents.json +38 -0
  22. package/example/ios/Example/Assets.xcassets/TextSecondary.colorset/Contents.json +38 -0
  23. package/example/ios/Example/Assets.xcassets/Warning.colorset/Contents.json +38 -0
  24. package/example/ios/Example/ComponentDetail.swift +35 -0
  25. package/example/ios/Example/ComponentItem.swift +24 -0
  26. package/example/ios/Example/ComponentModel.swift +31 -0
  27. package/example/ios/Example/ContentView.swift +53 -0
  28. package/example/ios/Example/Example.entitlements +10 -0
  29. package/example/ios/Example/Foundation/ButtonDemo.swift +80 -0
  30. package/example/ios/Example/Foundation/Popup/ActionSheets.swift +136 -0
  31. package/example/ios/Example/Foundation/Popup/Floats.swift +127 -0
  32. package/example/ios/Example/Foundation/Popup/Popups.swift +101 -0
  33. package/example/ios/Example/Foundation/PopupDemo.swift +366 -0
  34. package/example/ios/Example/Foundation/TypographyDemo.swift +53 -0
  35. package/example/ios/Example/Foundation.swift +26 -0
  36. package/example/ios/Example/Info.plist +18 -0
  37. package/example/ios/Example/Library/SwipeableDemo.swift +105 -0
  38. package/example/ios/Example/Library.swift +26 -0
  39. package/example/ios/Example/Main.swift +11 -0
  40. package/example/ios/Example/Overview.swift +20 -0
  41. package/example/ios/Example/Preview Content/Preview Assets.xcassets/Contents.json +6 -0
  42. package/example/ios/Example/Resource/SFProText-Black.ttf +0 -0
  43. package/example/ios/Example/Resource/SFProText-Bold.ttf +0 -0
  44. package/example/ios/Example/Resource/SFProText-Heavy.ttf +0 -0
  45. package/example/ios/Example/Resource/SFProText-Light.ttf +0 -0
  46. package/example/ios/Example/Resource/SFProText-Medium.ttf +0 -0
  47. package/example/ios/Example/Resource/SFProText-Regular.ttf +0 -0
  48. package/example/ios/Example/Resource/SFProText-Semibold.ttf +0 -0
  49. package/example/ios/Example/Resource/SFProText-Thin.ttf +0 -0
  50. package/example/ios/Example/Resource/SFProText-Ultralight.ttf +0 -0
  51. package/example/ios/Example/Resource/foundation.json +33 -0
  52. package/example/ios/Example/Resource/library.json +8 -0
  53. package/example/ios/Example/Utils.swift +30 -0
  54. package/example/ios/Example/ViewModifier/DarkViewModifier.swift +22 -0
  55. package/example/ios/Example.xcodeproj/project.pbxproj +565 -0
  56. package/example/ios/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  57. package/example/ios/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  58. package/example/ios/Example.xcodeproj/project.xcworkspace/xcuserdata/wem.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  59. package/example/ios/Example.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  60. package/example/ios/Example.xcworkspace/contents.xcworkspacedata +10 -0
  61. package/example/ios/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  62. package/example/ios/Example.xcworkspace/xcuserdata/wem.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  63. package/example/ios/Example.xcworkspace/xcuserdata/wem.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +6 -0
  64. package/example/ios/Podfile +6 -0
  65. package/example/ios/Podfile.lock +16 -0
  66. package/example/ios/Pods/Local Podspecs/MoMoUIKits.podspec.json +29 -0
  67. package/example/ios/Pods/Manifest.lock +16 -0
  68. package/example/ios/Pods/Pods.xcodeproj/project.pbxproj +661 -0
  69. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +58 -0
  70. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/Pods-Example.xcscheme +58 -0
  71. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +25 -0
  72. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-dummy.m +5 -0
  73. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-prefix.pch +12 -0
  74. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-umbrella.h +16 -0
  75. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.debug.xcconfig +12 -0
  76. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.modulemap +6 -0
  77. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.release.xcconfig +12 -0
  78. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.markdown +3 -0
  79. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.plist +29 -0
  80. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-dummy.m +5 -0
  81. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-umbrella.h +16 -0
  82. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig +14 -0
  83. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.modulemap +6 -0
  84. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig +14 -0
  85. package/ios/Button/Button.swift +131 -0
  86. package/ios/Colors+Spacing/Colors.swift +170 -0
  87. package/ios/Colors+Spacing/Radius.swift +11 -0
  88. package/ios/Colors+Spacing/Spacing.swift +12 -0
  89. package/ios/Extensions/Color++.swift +25 -0
  90. package/ios/OTPKeyboard/KeyboardButton.swift +33 -0
  91. package/ios/OTPKeyboard/OTPKeyboard.swift +145 -0
  92. package/ios/Popup/Modifiers.swift +172 -0
  93. package/ios/Popup/PopupView.swift +397 -0
  94. package/ios/Popup/Utils.swift +186 -0
  95. package/ios/Swipeable/SwipeCell.swift +270 -0
  96. package/ios/Swipeable/SwipeCellModel.swift +86 -0
  97. package/ios/Theme.md +18 -0
  98. package/ios/Typography/Typography.swift +30 -0
  99. package/ios/native-kits.podspec +15 -0
  100. package/package.json +8 -0
  101. package/publish.sh +28 -0
@@ -0,0 +1,127 @@
1
+
2
+
3
+ import SwiftUI
4
+
5
+ // MARK: - FloatTopFirst
6
+
7
+ struct FloatTopFirst: View {
8
+ var body: some View {
9
+ ZStack {
10
+ RoundedRectangle(cornerRadius: 12)
11
+ .fill(Color(hex: "E0E3E8"))
12
+
13
+ HStack(spacing: 0) {
14
+ Image("avatar1")
15
+ .aspectRatio(1.0, contentMode: .fit)
16
+ .cornerRadius(16)
17
+ .padding(16.0)
18
+
19
+ VStack(alignment: .leading, spacing: 8) {
20
+ Group {
21
+ Text("Adam Jameson")
22
+ .bold()
23
+ .foregroundColor(.black) +
24
+ Text(" invites you to join his training")
25
+ .foregroundColor(.black.opacity(0.6))
26
+ }
27
+
28
+ Button {
29
+ debugPrint("Accepted!")
30
+ } label: {
31
+ Text("Accept".uppercased())
32
+ .font(.system(size: 14, weight: .black))
33
+ }
34
+ }
35
+
36
+ Spacer()
37
+ }
38
+ }
39
+ .frame(height: 98)
40
+ .padding(.horizontal, 16)
41
+ }
42
+ }
43
+
44
+ // MARK: - FloatTopSecond
45
+
46
+ struct FloatTopSecond: View {
47
+ var body: some View {
48
+ HStack(spacing: 0) {
49
+ VStack(alignment: .leading, spacing: 2) {
50
+ Text("We give you a gift!")
51
+ .foregroundColor(.white)
52
+ .font(.system(size: 18))
53
+
54
+ Text("30% discount until the end of the month on all products of the company.")
55
+ .foregroundColor(.white)
56
+ .font(.system(size: 16))
57
+ .opacity(0.8)
58
+ }
59
+
60
+ Spacer()
61
+
62
+ Image("gift")
63
+ .aspectRatio(1.0, contentMode: .fit)
64
+ }
65
+ .padding(16)
66
+ .background(Color(hex: "9265F8").cornerRadius(12))
67
+ .shadow(color: Color(hex: "9265F8").opacity(0.5), radius: 40, x: 0, y: 12)
68
+ .padding(.horizontal, 16)
69
+ }
70
+ }
71
+
72
+ // MARK: - FloatBottomFirst
73
+
74
+ struct FloatBottomFirst: View {
75
+ var body: some View {
76
+ HStack(spacing: 0) {
77
+ Text("Your message has been sent to Alex Brant")
78
+ .font(.system(size: 15))
79
+ .foregroundColor(.black)
80
+ Spacer()
81
+ Image("avatar2")
82
+ .frame(width: 32, height: 32)
83
+ .cornerRadius(16)
84
+ }
85
+ .padding(16)
86
+ .background(Color.white.cornerRadius(12))
87
+ .shadow(color: .black.opacity(0.08), radius: 2, x: 0, y: 0)
88
+ .shadow(color: .black.opacity(0.16), radius: 24, x: 0, y: 0)
89
+ .padding(.horizontal, 16)
90
+ }
91
+ }
92
+
93
+ // MARK: - FloatBottomSecond
94
+
95
+ struct FloatBottomSecond: View {
96
+ var body: some View {
97
+ HStack(spacing: 8) {
98
+ Image(systemName: "wifi.slash")
99
+ .foregroundColor(.white)
100
+ .frame(width: 24, height: 24)
101
+
102
+ Text("Check your network connection and try again")
103
+ .foregroundColor(.white)
104
+ .font(.system(size: 16))
105
+ }
106
+ .padding(16)
107
+ .background(Color(hex: "FFB93D").cornerRadius(12))
108
+ .padding(.horizontal, 16)
109
+ }
110
+ }
111
+
112
+ // MARK: - Floats_Previews
113
+
114
+ struct Floats_Previews: PreviewProvider {
115
+ static var previews: some View {
116
+ ZStack {
117
+ Rectangle()
118
+ .ignoresSafeArea()
119
+ VStack {
120
+ FloatTopFirst()
121
+ FloatTopSecond()
122
+ FloatBottomFirst()
123
+ FloatBottomSecond()
124
+ }
125
+ }
126
+ }
127
+ }
@@ -0,0 +1,101 @@
1
+
2
+ import SwiftUI
3
+
4
+ // MARK: - PopupMiddle
5
+
6
+ struct PopupMiddle: View {
7
+ @Binding var isPresented: Bool
8
+
9
+ var body: some View {
10
+ VStack(spacing: 12) {
11
+ Image("winner")
12
+ .resizable()
13
+ .scaledToFit()
14
+ .frame(maxWidth: 226, maxHeight: 226)
15
+
16
+ Text("Congratulations!")
17
+ .foregroundColor(.black)
18
+ .font(.system(size: 24))
19
+ .padding(.top, 12)
20
+
21
+ Text("In two weeks, you did 12 workouts and burned 2671 calories. That's 566 calories more than last month. Continue at the same pace and the result will please you.")
22
+ .foregroundColor(.black)
23
+ .font(.system(size: 16))
24
+ .opacity(0.6)
25
+ .multilineTextAlignment(.center)
26
+ .padding(.bottom, 20)
27
+
28
+ Button("Thanks") {
29
+ isPresented = false
30
+ }
31
+ .buttonStyle(.plain)
32
+ .font(.system(size: 18, weight: .bold))
33
+ .frame(maxWidth: .infinity)
34
+ .padding(.vertical, 18)
35
+ .padding(.horizontal, 24)
36
+ .foregroundColor(.white)
37
+ .background(Color(hex: "9265F8"))
38
+ .cornerRadius(12)
39
+ }
40
+ .padding(EdgeInsets(top: 37, leading: 24, bottom: 40, trailing: 24))
41
+ .background(Color.white.cornerRadius(20))
42
+ .shadow(color: .black.opacity(0.08), radius: 2, x: 0, y: 0)
43
+ .shadow(color: .black.opacity(0.16), radius: 24, x: 0, y: 0)
44
+ .padding(.horizontal, 40)
45
+ }
46
+ }
47
+
48
+ // MARK: - PopupBottomFirst
49
+
50
+ struct PopupBottomFirst: View {
51
+ @Binding var isPresented: Bool
52
+
53
+ var body: some View {
54
+ VStack(spacing: 12) {
55
+ Text("Policy changes")
56
+ .foregroundColor(.black)
57
+ .font(.system(size: 24))
58
+
59
+ Text("Policy change occurs through interactions between wide external changes or shocks to the political system and the success of the ideas in the coalitions, which may cause actors in the advocacy coalition to shift coalitions.")
60
+ .foregroundColor(.black)
61
+ .font(.system(size: 16))
62
+ .opacity(0.6)
63
+ .multilineTextAlignment(.center)
64
+ .padding(.bottom, 12)
65
+
66
+ Button("Ok, I accept") {
67
+ isPresented = false
68
+ }
69
+ .buttonStyle(.plain)
70
+ .font(.system(size: 18, weight: .bold))
71
+ .frame(maxWidth: .infinity)
72
+ .padding(.vertical, 18)
73
+ .foregroundColor(.white)
74
+ .background(Color(hex: "FFB93D"))
75
+ .cornerRadius(12)
76
+ }
77
+ .padding(EdgeInsets(top: 37, leading: 24, bottom: 40, trailing: 24))
78
+ .background(Color.white.cornerRadius(20))
79
+ .shadow(color: .black.opacity(0.08), radius: 2, x: 0, y: 0)
80
+ .shadow(color: .black.opacity(0.16), radius: 24, x: 0, y: 0)
81
+ .padding(.horizontal, 16)
82
+ }
83
+ }
84
+
85
+ // MARK: - Popups_Previews
86
+
87
+ struct Popups_Previews: PreviewProvider {
88
+ static var previews: some View {
89
+ ZStack {
90
+ Rectangle()
91
+ .ignoresSafeArea()
92
+ PopupMiddle(isPresented: .constant(true))
93
+ }
94
+
95
+ ZStack {
96
+ Rectangle()
97
+ .ignoresSafeArea()
98
+ PopupBottomFirst(isPresented: .constant(false))
99
+ }
100
+ }
101
+ }
@@ -0,0 +1,366 @@
1
+
2
+ import MoMoUIKits
3
+ import SwiftUI
4
+
5
+ // MARK: - PopupDemo
6
+
7
+ struct PopupDemo: View {
8
+ @AppStorage("showOTPKeyboard") var showOTPKeyboard: Bool = false
9
+
10
+ @State var showingTopFirstFloat: Bool = false
11
+ @State var showingTopSecondFloat: Bool = false
12
+ @State var showingBottomFirstFloat: Bool = false
13
+ @State var showingBottomSecondFloat: Bool = false
14
+
15
+ @State var showingMiddlePopup: Bool = false
16
+ @State var showingBottomFirstPopup: Bool = false
17
+
18
+ @State var showingFirstActionSheet: Bool = false
19
+ @State var showingSecondActionSheet: Bool = false
20
+
21
+ var body: some View {
22
+ let hideAll: () -> () = {
23
+ self.showingTopFirstFloat = false
24
+ self.showingTopSecondFloat = false
25
+ self.showingBottomFirstFloat = false
26
+ self.showingBottomSecondFloat = false
27
+
28
+ self.showingMiddlePopup = false
29
+ self.showingBottomFirstPopup = false
30
+
31
+ self.showingFirstActionSheet = false
32
+ self.showingSecondActionSheet = false
33
+ }
34
+
35
+ return ZStack {
36
+ Rectangle()
37
+ .fill(Colors.background)
38
+ .ignoresSafeArea()
39
+ ScrollView {
40
+ LazyVStack(spacing: 12) {
41
+ Group {
42
+ SectionHeader(name: "Design system", count: 4)
43
+ .padding(.bottom, 12)
44
+
45
+ PopupButton(isShowing: $showOTPKeyboard, hideAll: hideAll) {
46
+ PopupTypeView(
47
+ title: "Show OTP keyboard",
48
+ detail: "Top popup show otp keyboard"
49
+ ) {
50
+ ActionSheetImage()
51
+ }
52
+ }
53
+ }
54
+
55
+ Group {
56
+ SectionHeader(name: "Floats", count: 4)
57
+ .padding(.bottom, 12)
58
+
59
+ PopupButton(isShowing: $showingTopFirstFloat, hideAll: hideAll) {
60
+ PopupTypeView(
61
+ title: "Top version 1",
62
+ detail: "Top float with a picture and one button"
63
+ ) {
64
+ FloatsImage(position: .top)
65
+ }
66
+ }
67
+ PopupButton(isShowing: $showingTopSecondFloat, hideAll: hideAll) {
68
+ PopupTypeView(
69
+ title: "Top version 2",
70
+ detail: "Top float with a picture"
71
+ ) {
72
+ FloatsImage(position: .top)
73
+ }
74
+ }
75
+ PopupButton(isShowing: $showingBottomFirstFloat, hideAll: hideAll) {
76
+ PopupTypeView(
77
+ title: "Bottom version 1",
78
+ detail: "Bottom float with a picture"
79
+ ) {
80
+ FloatsImage(position: .bottom)
81
+ }
82
+ }
83
+ PopupButton(isShowing: $showingBottomSecondFloat, hideAll: hideAll) {
84
+ PopupTypeView(
85
+ title: "Bottom version 2",
86
+ detail: "Bottom float with a picture"
87
+ ) {
88
+ FloatsImage(position: .bottom)
89
+ }
90
+ }
91
+ }
92
+
93
+ Group {
94
+ SectionHeader(name: "Popups", count: 2)
95
+ .padding(EdgeInsets(top: 20, leading: 0, bottom: 12, trailing: 0))
96
+
97
+ PopupButton(isShowing: $showingMiddlePopup, hideAll: hideAll) {
98
+ PopupTypeView(
99
+ title: "Middle",
100
+ detail: "Popup in the middle of the screen with a picture"
101
+ ) {
102
+ PopupImage(style: .default)
103
+ }
104
+ }
105
+ PopupButton(isShowing: $showingBottomFirstPopup, hideAll: hideAll) {
106
+ PopupTypeView(
107
+ title: "Bottom version 1",
108
+ detail: "Popup bottom"
109
+ ) {
110
+ PopupImage(style: .bottomFirst)
111
+ }
112
+ }
113
+ }
114
+
115
+ Group {
116
+ SectionHeader(name: "Action sheets", count: 2)
117
+ .padding(EdgeInsets(top: 20, leading: 0, bottom: 12, trailing: 0))
118
+
119
+ PopupButton(isShowing: $showingFirstActionSheet, hideAll: hideAll) {
120
+ PopupTypeView(
121
+ title: "Version 1",
122
+ detail: "Action sheets"
123
+ ) {
124
+ ActionSheetImage()
125
+ }
126
+ }
127
+ PopupButton(isShowing: $showingSecondActionSheet, hideAll: hideAll) {
128
+ PopupTypeView(
129
+ title: "Version 2",
130
+ detail: "Action sheets"
131
+ ) {
132
+ ActionSheetImage()
133
+ }
134
+ }
135
+ }
136
+ }
137
+ }
138
+
139
+ // MARK: - Designed floats
140
+
141
+ .popup(isPresented: $showingTopFirstFloat, type: .floater(), position: .top, animation: .spring()) {
142
+ FloatTopFirst()
143
+ }
144
+ .popup(isPresented: $showingTopSecondFloat, type: .floater(), position: .top, animation: .spring(), autohideIn: 3) {
145
+ FloatTopSecond()
146
+ }
147
+ .popup(isPresented: $showingBottomFirstFloat, type: .floater(), position: .bottom, animation: .spring(), autohideIn: 2) {
148
+ FloatBottomFirst()
149
+ }
150
+ .popup(isPresented: $showingBottomSecondFloat, type: .floater(), position: .bottom, animation: .spring(), autohideIn: 5) {
151
+ FloatBottomSecond()
152
+ }
153
+
154
+ // MARK: - Designed popups
155
+
156
+ .popup(isPresented: $showingMiddlePopup, type: .default, position: .center, closeOnTap: true, backgroundColor: .black.opacity(0.4)) {
157
+ PopupMiddle(isPresented: $showingMiddlePopup)
158
+ }
159
+ .popup(isPresented: $showingBottomFirstPopup, type: .floater(), position: .bottom, closeOnTapOutside: true, backgroundColor: .black.opacity(0.4)) {
160
+ PopupBottomFirst(isPresented: $showingBottomFirstPopup)
161
+ }
162
+
163
+ // MARK: - Designed sheets
164
+
165
+ .popup(isPresented: $showingFirstActionSheet, type: .toast, position: .bottom, closeOnTap: false, backgroundColor: .black.opacity(0.4)) {
166
+ ActionSheetFirst()
167
+ }
168
+ .popup(isPresented: $showingSecondActionSheet, type: .toast, position: .bottom, closeOnTap: false, backgroundColor: .black.opacity(0.4)) {
169
+ ActionSheetSecond()
170
+ }
171
+ }
172
+ }
173
+ }
174
+
175
+ // MARK: - SectionHeader
176
+
177
+ private struct SectionHeader: View {
178
+ let name: String
179
+ let count: Int
180
+
181
+ var body: some View {
182
+ HStack {
183
+ Text(name)
184
+ .font(.system(size: 24, weight: .bold))
185
+ .foregroundColor(Colors.text)
186
+
187
+ Spacer()
188
+
189
+ HStack(spacing: 4) {
190
+ Text("\(count)")
191
+ .font(.system(size: 18))
192
+ .foregroundColor(Colors.text)
193
+ .opacity(0.8)
194
+
195
+ Text("types")
196
+ .font(.system(size: 18))
197
+ .foregroundColor(Colors.text)
198
+ .opacity(0.5)
199
+ }
200
+ }
201
+ .padding(.horizontal, 20)
202
+ }
203
+ }
204
+
205
+ // MARK: - PopupTypeView
206
+
207
+ private struct PopupTypeView<Content>: View where Content: View {
208
+ let title: String
209
+ let detail: String
210
+ @ViewBuilder let icon: () -> Content
211
+
212
+ var body: some View {
213
+ ZStack(alignment: .leading) {
214
+ RoundedRectangle(cornerRadius: 12)
215
+ .fill(Colors.card)
216
+
217
+ HStack {
218
+ icon()
219
+ VStack(alignment: .leading, spacing: 0) {
220
+ Text(title)
221
+ .font(.system(size: 18))
222
+ .foregroundColor(Colors.text)
223
+ Text(detail)
224
+ .lineLimit(1)
225
+ .font(.system(size: 13))
226
+ .foregroundColor(Colors.text)
227
+ .opacity(0.4)
228
+ }
229
+ }
230
+ .padding()
231
+ }
232
+ .padding(.horizontal, 20)
233
+ }
234
+ }
235
+
236
+ // MARK: - PopupButton
237
+
238
+ private struct PopupButton<Content>: View where Content: View {
239
+ @Binding var isShowing: Bool
240
+
241
+ var hideAll: () -> ()
242
+
243
+ @ViewBuilder let content: () -> Content
244
+
245
+ var body: some View {
246
+ Button {
247
+ hideAll()
248
+ isShowing.toggle()
249
+ } label: {
250
+ content()
251
+ }
252
+ }
253
+ }
254
+
255
+ // MARK: - AlertImageView
256
+
257
+ private struct AlertImageView<Content>: View where Content: View {
258
+ let hex: String
259
+ let alignment: Alignment
260
+
261
+ @ViewBuilder let content: (Color) -> Content
262
+
263
+ var body: some View {
264
+ let color = Color(hex: hex)
265
+ return ZStack(alignment: alignment) {
266
+ Rectangle()
267
+ .fill(color)
268
+ .opacity(0.24)
269
+ .frame(width: 40, height: 40)
270
+ content(color)
271
+ }
272
+ .cornerRadius(10)
273
+ }
274
+ }
275
+
276
+ // MARK: - FloatsImage
277
+
278
+ private struct FloatsImage: View {
279
+ enum Position {
280
+ case top
281
+ case bottom
282
+
283
+ // MARK: Internal
284
+
285
+ func toAligment() -> Alignment {
286
+ switch self {
287
+ case .top:
288
+ return .top
289
+ case .bottom:
290
+ return .bottom
291
+ }
292
+ }
293
+ }
294
+
295
+ let position: Position
296
+
297
+ var body: some View {
298
+ AlertImageView(hex: "9265F8", alignment: position.toAligment()) { color in
299
+ Rectangle()
300
+ .fill(color)
301
+ .frame(width: 24, height: 4)
302
+ .cornerRadius(12)
303
+ .padding(.all, 8)
304
+ }
305
+ }
306
+ }
307
+
308
+ // MARK: - PopupImage
309
+
310
+ private struct PopupImage: View {
311
+ enum Style {
312
+ case `default`
313
+ case bottomFirst
314
+ case bottomSecond
315
+
316
+ // MARK: Internal
317
+
318
+ func toAligment() -> Alignment {
319
+ switch self {
320
+ case .default:
321
+ return .center
322
+ case .bottomFirst,
323
+ .bottomSecond:
324
+ return .bottom
325
+ }
326
+ }
327
+ }
328
+
329
+ let style: Style
330
+
331
+ var body: some View {
332
+ AlertImageView(hex: "CCE7A2", alignment: style.toAligment()) { color in
333
+ switch style {
334
+ case .default:
335
+ RoundedRectangle(cornerRadius: 4)
336
+ .fill(color)
337
+ .frame(width: 24, height: 20)
338
+
339
+ case .bottomFirst:
340
+ RoundedRectangle(cornerRadius: 4)
341
+ .fill(color)
342
+ .frame(width: 24, height: 20)
343
+ .padding(.bottom, 4)
344
+
345
+ case .bottomSecond:
346
+ RoundedRectangle(cornerRadius: 4)
347
+ .fill(color)
348
+ .frame(width: 40, height: 20)
349
+ .padding(0)
350
+ }
351
+ }
352
+ }
353
+ }
354
+
355
+ // MARK: - ActionSheetImage
356
+
357
+ private struct ActionSheetImage: View {
358
+ var body: some View {
359
+ AlertImageView(hex: "FFB93D", alignment: .bottom) { color in
360
+ RoundedRectangle(cornerRadius: 4)
361
+ .fill(color)
362
+ .frame(width: 40, height: 20)
363
+ .padding(0)
364
+ }
365
+ }
366
+ }
@@ -0,0 +1,53 @@
1
+ //
2
+ // TypographyDemo.swift
3
+ // Example
4
+ //
5
+ // Created by Wem on 13/12/2022.
6
+ //
7
+
8
+ import Foundation
9
+ import SwiftUI
10
+
11
+ struct TypographyDemo: View {
12
+
13
+ var body: some View {
14
+ ScrollView {
15
+ Group {
16
+ VStack {
17
+ Text("Text").font(.h1)
18
+ Text("Text").font(.h2)
19
+ Text("Text").font(.h3)
20
+ Text("Text").font(.h4)
21
+ }
22
+ VStack {
23
+ Text("Text").font(.title1)
24
+ Text("Text").font(.title2)
25
+ Text("Text").font(.title3)
26
+ }
27
+ VStack {
28
+ Text("Text").font(.headerText1)
29
+ Text("Text").font(.headerText2)
30
+ Text("Text").font(.headerText3)
31
+ Text("Text").font(.paragraph)
32
+ }
33
+ VStack {
34
+ Text("Text").font(.description1)
35
+ Text("Text").font(.description2)
36
+ Text("Text").font(.description3)
37
+ }
38
+ VStack {
39
+ Text("Text").font(.label1)
40
+ Text("Text").font(.label2)
41
+ Text("Text").font(.label3)
42
+ Text("Text").font(.label4)
43
+ }
44
+ VStack {
45
+ Text("Text").font(.action1)
46
+ Text("Text").font(.action2)
47
+ Text("Text").font(.action3)
48
+ Text("Text").font(.action4)
49
+ }
50
+ }.padding(16)
51
+ }.padding(.top)
52
+ }
53
+ }
@@ -0,0 +1,26 @@
1
+ //
2
+ // Foundation.swift
3
+ // Example
4
+ //
5
+ // Created by Wem on 13/12/2022.
6
+ //
7
+
8
+ import Foundation
9
+ import SwiftUI
10
+
11
+ struct Foundation: View {
12
+ var foundations: [ComponentModel]
13
+
14
+ var body: some View {
15
+ NavigationView {
16
+ List(foundations) { item in
17
+ NavigationLink {
18
+ ComponentDetail(item)
19
+ } label: {
20
+ ComponentItem(item)
21
+ }
22
+ }
23
+ .navigationTitle("Foundations")
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>UIAppFonts</key>
6
+ <array>
7
+ <string>SFProText-Bold.ttf</string>
8
+ <string>SFProText-Regular.ttf</string>
9
+ <string>SFProText-Semibold.ttf</string>
10
+ <string>SFProText-Light.ttf</string>
11
+ <string>SFProText-Heavy.ttf</string>
12
+ <string>SFProText-Medium.ttf</string>
13
+ <string>SFProText-Black.ttf</string>
14
+ <string>SFProText-Thin.ttf</string>
15
+ <string>SFProText-Ultralight.ttf</string>
16
+ </array>
17
+ </dict>
18
+ </plist>