@momo-kits/native-kits 0.0.1-beta.4 → 0.89.1-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/README.md +1 -0
- package/android/.gradle/8.0/checksums/checksums.lock +0 -0
- package/android/.gradle/8.0/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/8.0/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.0/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.0/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.0/gc.properties +0 -0
- package/android/.gradle/config.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/gradle.xml +12 -0
- package/android/.idea/migrations.xml +10 -0
- package/android/.idea/misc.xml +10 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/.idea/workspace.xml +50 -0
- package/android/build.gradle +35 -69
- package/android/local.properties +8 -0
- package/android/proguard-rules.pro +21 -0
- package/android/src/main/AndroidManifest.xml +2 -2
- package/android/src/main/java/com/momoplatform/nativekits/foundations/Button.kt +16 -0
- package/android/src/main/java/com/momoplatform/nativekits/libs/Logo.kt +63 -0
- package/android/src/main/java/com/momoplatform/nativekits/libs/TrustBanner.kt +246 -0
- package/android/src/main/res/drawable/ic_launcher_background.xml +170 -0
- package/android/src/main/res/drawable-v24/ic_launcher_foreground.xml +30 -0
- package/android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +6 -0
- package/android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +6 -0
- package/android/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
- package/android/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
- package/android/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
- package/android/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
- package/android/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
- package/android/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
- package/android/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
- package/android/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
- package/android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
- package/android/src/main/res/values/colors.xml +10 -0
- package/android/src/main/res/values/strings.xml +3 -0
- package/android/src/main/res/values/themes.xml +3 -0
- package/android/src/main/res/values-night/themes.xml +3 -0
- package/android/src/main/res/xml/backup_rules.xml +13 -0
- package/android/src/main/res/xml/data_extraction_rules.xml +19 -0
- package/build.gradle.kts +18 -0
- package/compose/build.gradle.kts +82 -0
- package/compose/src/androidMain/AndroidManifest.xml +2 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/utils/Platform.kt +3 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/utils/SetMaskFilter.kt +8 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/utils/Utils.android.kt +14 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Components.kt +194 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +197 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +133 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +62 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +27 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +288 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +80 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +23 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +42 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +126 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +51 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +299 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +246 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +223 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +244 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +281 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PromotionPopup.kt +72 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +65 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +64 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +63 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +73 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +42 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +150 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +13 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +173 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +242 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +50 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1321 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Platform.kt +3 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/SetMaskFilter.kt +5 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +97 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/utils/Platform.kt +3 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/utils/SetMaskFilter.kt +9 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/utils/Utils.ios.kt +18 -0
- package/gradle.properties +19 -0
- package/gradlew +240 -0
- package/gradlew.bat +91 -0
- package/ios/Button/Button.swift +9 -2
- package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +126 -0
- package/ios/Checkbox/Checkbox.swift +38 -0
- package/ios/{Colors+Spacing → Colors+Radius+Spacing}/Colors.swift +21 -19
- package/ios/Colors+Radius+Spacing/Radius.swift +22 -0
- package/ios/Image/Image.swift +60 -0
- package/ios/Input/Input.swift +88 -37
- package/ios/OTPKeyboard/KeyboardButton.swift +12 -4
- package/ios/OTPKeyboard/OTPKeyboard.swift +1 -1
- package/ios/Popup/PopupDisplay.swift +169 -0
- package/ios/Popup/PopupInput.swift +96 -0
- package/ios/Popup/PopupPromotion.swift +52 -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 +79 -0
- package/ios/Switch/Switch.swift +44 -0
- package/ios/Template/Logo/Logo.swift +75 -0
- package/ios/Template/TrustBanner/TrustBanner.swift +189 -0
- package/ios/native-kits.podspec +2 -0
- package/local.properties +8 -0
- package/package.json +6 -6
- package/publish.sh +1 -10
- package/settings.gradle.kts +41 -0
- package/android/gradle.properties +0 -5
- 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/{Colors+Spacing → Colors+Radius+Spacing}/Spacing.swift +0 -0
|
@@ -16,27 +16,28 @@ public enum Colors {
|
|
|
16
16
|
public static let info = Color("Info")
|
|
17
17
|
public static let success = Color("Success")
|
|
18
18
|
|
|
19
|
-
public static let black20 = Color(hex: "
|
|
20
|
-
public static let black19 = Color(hex: "
|
|
21
|
-
public static let black18 = Color(hex: "
|
|
22
|
-
public static let black17 = Color(hex: "
|
|
23
|
-
public static let black16 = Color(hex: "
|
|
24
|
-
public static let black15 = Color(hex: "
|
|
25
|
-
public static let black14 = Color(hex: "
|
|
26
|
-
public static let black13 = Color(hex: "
|
|
27
|
-
public static let black12 = Color(hex: "
|
|
28
|
-
public static let black11 = Color(hex: "
|
|
29
|
-
public static let black10 = Color(hex: "
|
|
30
|
-
public static let black09 = Color(hex: "
|
|
31
|
-
public static let black08 = Color(hex: "
|
|
32
|
-
public static let black07 = Color(hex: "
|
|
33
|
-
public static let black06 = Color(hex: "
|
|
34
|
-
public static let black05 = Color(hex: "
|
|
35
|
-
public static let black04 = Color(hex: "
|
|
36
|
-
public static let black03 = Color(hex: "
|
|
37
|
-
public static let black02 = Color(hex: "
|
|
19
|
+
public static let black20 = Color(hex: "000000")
|
|
20
|
+
public static let black19 = Color(hex: "18191a")
|
|
21
|
+
public static let black18 = Color(hex: "242424")
|
|
22
|
+
public static let black17 = Color(hex: "303233")
|
|
23
|
+
public static let black16 = Color(hex: "404040")
|
|
24
|
+
public static let black15 = Color(hex: "484848")
|
|
25
|
+
public static let black14 = Color(hex: "565656")
|
|
26
|
+
public static let black13 = Color(hex: "646464")
|
|
27
|
+
public static let black12 = Color(hex: "727272")
|
|
28
|
+
public static let black11 = Color(hex: "878787")
|
|
29
|
+
public static let black10 = Color(hex: "a0a0a0")
|
|
30
|
+
public static let black09 = Color(hex: "b9b9b9")
|
|
31
|
+
public static let black08 = Color(hex: "c6c6c6")
|
|
32
|
+
public static let black07 = Color(hex: "cccccc")
|
|
33
|
+
public static let black06 = Color(hex: "d8d8d8")
|
|
34
|
+
public static let black05 = Color(hex: "e5e5e5")
|
|
35
|
+
public static let black04 = Color(hex: "e8e8e8")
|
|
36
|
+
public static let black03 = Color(hex: "f0f0f0")
|
|
37
|
+
public static let black02 = Color(hex: "f9f9f9")
|
|
38
38
|
public static let black01 = Color(hex: "ffffff")
|
|
39
39
|
|
|
40
|
+
|
|
40
41
|
public static let pink11 = Color(hex: "fef8fc")
|
|
41
42
|
public static let pink10 = Color(hex: "fef4fa")
|
|
42
43
|
public static let pink09 = Color(hex: "fdeaf4")
|
|
@@ -49,6 +50,7 @@ public enum Colors {
|
|
|
49
50
|
public static let pink02 = Color(hex: "d42a87")
|
|
50
51
|
public static let pink01 = Color(hex: "bc2678")
|
|
51
52
|
|
|
53
|
+
|
|
52
54
|
public static let violet10 = Color(hex: "fcf8fe")
|
|
53
55
|
public static let violet09 = Color(hex: "faf4fe")
|
|
54
56
|
public static let violet08 = Color(hex: "ead4fc")
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import SwiftUI
|
|
2
|
+
import Foundation
|
|
3
|
+
|
|
4
|
+
public enum Radius {
|
|
5
|
+
public static let XXS: CGFloat = 2
|
|
6
|
+
public static let XS: CGFloat = 4
|
|
7
|
+
public static let S: CGFloat = 8
|
|
8
|
+
public static let M: CGFloat = 12
|
|
9
|
+
public static let L: CGFloat = 16
|
|
10
|
+
public static let XL: CGFloat = 24
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public struct RoundedCorner: Shape {
|
|
14
|
+
|
|
15
|
+
var radius: CGFloat = .infinity
|
|
16
|
+
var corners: UIRectCorner = .allCorners
|
|
17
|
+
|
|
18
|
+
public func path(in rect: CGRect) -> Path {
|
|
19
|
+
let path = UIBezierPath(roundedRect: rect, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
|
|
20
|
+
return Path(path.cgPath)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import Foundation
|
|
4
|
+
import SDWebImageSwiftUI
|
|
5
|
+
import SkeletonUI
|
|
6
|
+
import SwiftUI
|
|
7
|
+
|
|
8
|
+
public struct ImageView: View {
|
|
9
|
+
// MARK: Lifecycle
|
|
10
|
+
|
|
11
|
+
public init(_ url: String, aspectRatio: CGFloat? = nil, contentMode: ContentMode = ContentMode.fit, placeholder: AnyView? = nil) {
|
|
12
|
+
self.url = url
|
|
13
|
+
self.aspectRatio = aspectRatio
|
|
14
|
+
self.contentMode = contentMode
|
|
15
|
+
self.placeholder = placeholder
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// MARK: Public
|
|
19
|
+
|
|
20
|
+
public var body: some View {
|
|
21
|
+
return WebImage(url: URL(string: url), isAnimating: .constant(true))
|
|
22
|
+
.onFailure { _ in
|
|
23
|
+
error = true
|
|
24
|
+
}
|
|
25
|
+
.onSuccess { _, _, _ in
|
|
26
|
+
error = false
|
|
27
|
+
}
|
|
28
|
+
.resizable()
|
|
29
|
+
.placeholder {
|
|
30
|
+
Rectangle().foregroundColor(.gray)
|
|
31
|
+
VStack(alignment: .center, content: {
|
|
32
|
+
if error {
|
|
33
|
+
Image(systemName: "person.crop.circle.badge.exclamationmark")
|
|
34
|
+
.foregroundColor(Colors.textSecondary)
|
|
35
|
+
Text("Error!")
|
|
36
|
+
.font(.paragraph)
|
|
37
|
+
.foregroundColor(Colors.textSecondary)
|
|
38
|
+
.padding(Spacing.XXS)
|
|
39
|
+
} else if placeholder != nil {
|
|
40
|
+
placeholder
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
44
|
+
.skeleton(with: !error && placeholder == nil)
|
|
45
|
+
.shape(type: .rectangle)
|
|
46
|
+
}
|
|
47
|
+
.scaledToFit()
|
|
48
|
+
.transition(.fade)
|
|
49
|
+
.aspectRatio(aspectRatio, contentMode: contentMode)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// MARK: Internal
|
|
53
|
+
|
|
54
|
+
var aspectRatio: CGFloat?
|
|
55
|
+
var contentMode: ContentMode
|
|
56
|
+
var placeholder: AnyView?
|
|
57
|
+
|
|
58
|
+
@State var error: Bool = false
|
|
59
|
+
var url: String
|
|
60
|
+
}
|
package/ios/Input/Input.swift
CHANGED
|
@@ -4,22 +4,22 @@ import SwiftUI
|
|
|
4
4
|
|
|
5
5
|
fileprivate struct FloatingComponent: View {
|
|
6
6
|
var floatingValue: String
|
|
7
|
+
var floatingIcon: AnyView?
|
|
7
8
|
|
|
8
|
-
public init (_ floatingValue: String = ""){
|
|
9
|
+
public init (_ floatingValue: String = "", floatingIcon: AnyView? = nil){
|
|
9
10
|
self.floatingValue = floatingValue
|
|
11
|
+
self.floatingIcon = floatingIcon
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
public var body: some View {
|
|
13
15
|
return HStack {
|
|
14
16
|
Text(floatingValue)
|
|
17
|
+
.font(.paragraph)
|
|
15
18
|
.foregroundColor(Colors.black09)
|
|
16
19
|
.font(.system(size: 12))
|
|
17
20
|
.padding(.leading, 8)
|
|
18
|
-
Image(systemName: "info.circle")
|
|
19
|
-
.foregroundColor(Colors.black09)
|
|
20
|
-
.frame(width: 16, height: 16)
|
|
21
|
-
.padding(.leading, -4)
|
|
22
21
|
.padding(.trailing, 8)
|
|
22
|
+
floatingIcon
|
|
23
23
|
}
|
|
24
24
|
.background(Colors.black01)
|
|
25
25
|
.offset(x: 16, y:-8)
|
|
@@ -27,71 +27,122 @@ fileprivate struct FloatingComponent: View {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
struct DotTextField: View{
|
|
31
|
+
@Binding var value: String
|
|
32
|
+
@State var isHide: Bool = true
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
func onToggle(){
|
|
36
|
+
isHide.toggle()
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public var body: some View {
|
|
40
|
+
return HStack {
|
|
41
|
+
if (isHide){
|
|
42
|
+
SecureField("", text: $value)
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
TextField("", text: $value)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
SwiftButton(action: onToggle){
|
|
49
|
+
Image(systemName: isHide ? "eye.slash" : "eye")
|
|
50
|
+
.foregroundColor(Colors.text)
|
|
51
|
+
.frame(width: 16, height: 16)
|
|
52
|
+
.padding(.leading, -4)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
30
61
|
public struct Input: View {
|
|
31
|
-
@
|
|
62
|
+
@Binding var value: String
|
|
32
63
|
@State var focused: Bool = false
|
|
33
64
|
|
|
34
|
-
var iconPadding: CGFloat
|
|
35
|
-
var multilines: Bool
|
|
36
65
|
var placeholder: String
|
|
37
66
|
var floatingValue: String
|
|
38
67
|
var errorMessage: String
|
|
68
|
+
var isSecure: Bool
|
|
69
|
+
var keyboardType: UIKeyboardType
|
|
70
|
+
var floatingIcon: AnyView?
|
|
71
|
+
var rightIcon: AnyView?
|
|
72
|
+
var onChange: ((String) -> Void)?
|
|
73
|
+
var onBlur: (() -> Void)?
|
|
39
74
|
|
|
40
|
-
func
|
|
41
|
-
self.
|
|
75
|
+
func onCancel(){
|
|
76
|
+
self.value.removeAll()
|
|
42
77
|
}
|
|
43
78
|
|
|
44
|
-
public init(placeholder: String = "", floatingValue: String = "", multilines: Bool = false, errorMessage: String = ""){
|
|
79
|
+
public init(_ value: Binding<String>, placeholder: String = "", floatingValue: String = "", multilines: Bool = false, errorMessage: String = "", isSecure: Bool = false, keyboardType: UIKeyboardType = .default, floatingIcon: AnyView? = nil, rightIcon: AnyView? = nil, onChange: ((String)->Void)? = nil, onBlur: (()->Void)? = nil){
|
|
45
80
|
self.placeholder = placeholder
|
|
46
81
|
self.floatingValue = floatingValue
|
|
47
|
-
self.multilines = multilines
|
|
48
|
-
self.iconPadding = multilines == true ? 16 : 0
|
|
49
82
|
self.errorMessage = errorMessage
|
|
83
|
+
self.isSecure = isSecure
|
|
84
|
+
self._value = value
|
|
85
|
+
self.keyboardType = keyboardType
|
|
86
|
+
self.rightIcon = rightIcon
|
|
87
|
+
self.floatingIcon = floatingIcon
|
|
88
|
+
self.onChange = onChange
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
func onChangeText(value: String){
|
|
92
|
+
onChange?(value)
|
|
50
93
|
}
|
|
51
94
|
|
|
52
95
|
public var body: some View {
|
|
53
96
|
return ZStack (alignment: .topLeading){
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (multilines){
|
|
57
|
-
if #available(iOS 14.0, *) {
|
|
58
|
-
TextEditor(text: $value)
|
|
59
|
-
.frame(maxWidth: .infinity, minHeight: 48)
|
|
60
|
-
.padding(.horizontal, 8)
|
|
61
|
-
.padding(.top,4 )
|
|
62
|
-
.accentColor(Colors.pink03)
|
|
63
|
-
.fixedSize(horizontal: false, vertical: true)
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
97
|
+
HStack(alignment: .center){
|
|
98
|
+
if (!isSecure){
|
|
67
99
|
TextField("",text: $value, onEditingChanged:{ isChange in
|
|
68
|
-
|
|
100
|
+
self.focused = isChange
|
|
69
101
|
})
|
|
102
|
+
.font(.paragraph)
|
|
70
103
|
.padding(.horizontal, 12)
|
|
71
104
|
.accentColor(Colors.pink03)
|
|
105
|
+
.keyboardType(keyboardType)
|
|
106
|
+
.valueChanged(value: value, onChange: onChangeText)
|
|
72
107
|
|
|
73
|
-
|
|
108
|
+
HStack{
|
|
109
|
+
SwiftButton(action: onCancel){
|
|
110
|
+
Image(systemName: "x.circle.fill")
|
|
111
|
+
.foregroundColor(Colors.text)
|
|
112
|
+
.frame(width: 16, height: 16)
|
|
113
|
+
.padding(.leading, -4)
|
|
114
|
+
.padding(.trailing, 8)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
rightIcon
|
|
118
|
+
|
|
119
|
+
}
|
|
120
|
+
}else{
|
|
121
|
+
DotTextField(value: $value)
|
|
122
|
+
.padding(.horizontal, 12)
|
|
123
|
+
.accentColor(Colors.pink03)
|
|
124
|
+
SwiftButton(action: onCancel){
|
|
125
|
+
Image(systemName: "x.circle.fill")
|
|
126
|
+
.foregroundColor(Colors.text)
|
|
127
|
+
.frame(width: 16, height: 16)
|
|
128
|
+
.padding(.leading, -4)
|
|
129
|
+
.padding(.trailing, 8)
|
|
130
|
+
}
|
|
74
131
|
}
|
|
75
|
-
|
|
76
|
-
Image(systemName: "info.circle")
|
|
77
|
-
.foregroundColor(Colors.black09)
|
|
78
|
-
.frame(width: 16, height: 16)
|
|
79
|
-
.padding(.leading, -4)
|
|
80
|
-
.padding(.trailing, 8)
|
|
81
|
-
.padding(.top, iconPadding)
|
|
82
132
|
}
|
|
83
133
|
.frame(maxWidth: .infinity, minHeight: 48)
|
|
84
134
|
.overlay(RoundedRectangle(cornerRadius: 8).stroke(focused == true ? Colors.pink03 : Colors.border, lineWidth: 1))
|
|
85
135
|
.padding(.horizontal, 1)
|
|
86
136
|
if (value.isEmpty){
|
|
87
137
|
Text(placeholder)
|
|
138
|
+
.font(.paragraph)
|
|
88
139
|
.font(.system(size: 16))
|
|
89
140
|
.foregroundColor(Colors.black09)
|
|
90
141
|
.padding(.leading, 12)
|
|
91
|
-
.padding(.top,
|
|
142
|
+
.padding(.top, 16)
|
|
92
143
|
.allowsHitTesting(false)
|
|
93
144
|
}
|
|
94
|
-
FloatingComponent(floatingValue)
|
|
145
|
+
if (!floatingValue.isEmpty) {FloatingComponent(floatingValue, floatingIcon: floatingIcon)}
|
|
95
146
|
}.padding(.bottom, 8)
|
|
96
147
|
}
|
|
97
148
|
|
|
@@ -8,9 +8,13 @@ typealias SwiftButton = SwiftUI.Button
|
|
|
8
8
|
public struct KeyboardButton: View {
|
|
9
9
|
// MARK: Lifecycle
|
|
10
10
|
|
|
11
|
-
public init(_ key: String, action: @escaping (_ key: String)->Void) {
|
|
11
|
+
public init(_ key: String, action: @escaping (_ key: String)->Void, width: CGFloat = .infinity, height: CGFloat = 48, color: Color = Colors.card, textColor: Color = Colors.text) {
|
|
12
12
|
self.key = key
|
|
13
13
|
self.action = action
|
|
14
|
+
self.width = width
|
|
15
|
+
self.height = height
|
|
16
|
+
self.color = color
|
|
17
|
+
self.textColor = textColor
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
// MARK: Public
|
|
@@ -19,9 +23,9 @@ public struct KeyboardButton: View {
|
|
|
19
23
|
SwiftUI.Button(action: { self.action(key) }) {
|
|
20
24
|
HStack {
|
|
21
25
|
Text(key).font(.system(size: 24, weight: .bold))
|
|
22
|
-
}.frame(maxWidth:
|
|
23
|
-
.background(
|
|
24
|
-
.foregroundColor(
|
|
26
|
+
}.frame(maxWidth: CGFloat(width), minHeight: height)
|
|
27
|
+
.background(color)
|
|
28
|
+
.foregroundColor(textColor)
|
|
25
29
|
.clipShape(RoundedRectangle(cornerRadius: 8))
|
|
26
30
|
}
|
|
27
31
|
}
|
|
@@ -30,4 +34,8 @@ public struct KeyboardButton: View {
|
|
|
30
34
|
|
|
31
35
|
var key: String = ""
|
|
32
36
|
var action: (_ key: String)->Void
|
|
37
|
+
var width: CGFloat
|
|
38
|
+
var height: CGFloat
|
|
39
|
+
var color: Color
|
|
40
|
+
var textColor: Color
|
|
33
41
|
}
|
|
@@ -119,7 +119,7 @@ public struct OTPKeyboard: View {
|
|
|
119
119
|
private struct ValueView: View {
|
|
120
120
|
// MARK: Lifecycle
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
init(_ value: String, valueLength: Int) {
|
|
123
123
|
self.value = value
|
|
124
124
|
self.valueLength = valueLength
|
|
125
125
|
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import SDWebImageSwiftUI
|
|
2
|
+
import SwiftUI
|
|
3
|
+
|
|
4
|
+
// MARK: - PopupButtonDirection
|
|
5
|
+
|
|
6
|
+
public enum PopupButtonDirection {
|
|
7
|
+
case row
|
|
8
|
+
case column
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// MARK: - PopupButtonType
|
|
12
|
+
|
|
13
|
+
public enum PopupButtonType {
|
|
14
|
+
case text
|
|
15
|
+
case button
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// MARK: - PopupDisplay
|
|
19
|
+
|
|
20
|
+
public struct PopupDisplay: View {
|
|
21
|
+
// MARK: Lifecycle
|
|
22
|
+
|
|
23
|
+
public init(isPresented: Binding<Bool>, title: String = "", description: String = "", url: String = "", buttonDirection: PopupButtonDirection = .column, buttonType: PopupButtonType = .button, actionButtonTitle: String = "", closeButtonTitle: String = "", onPressAction: @escaping () -> Void = {}, onPressCloseButton: @escaping () -> Void = {}, onClose: @escaping () -> Void = {}) {
|
|
24
|
+
self._isPresented = isPresented
|
|
25
|
+
self.title = title
|
|
26
|
+
self.description = description
|
|
27
|
+
self.url = url
|
|
28
|
+
self.buttonDirection = buttonDirection
|
|
29
|
+
self.buttonType = buttonType
|
|
30
|
+
self.onPressAction = onPressAction
|
|
31
|
+
self.onPressCloseButton = onPressCloseButton
|
|
32
|
+
self.onClose = onClose
|
|
33
|
+
self.closeButtonTitle = closeButtonTitle
|
|
34
|
+
self.actionButtonTitle = actionButtonTitle
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// MARK: Public
|
|
38
|
+
|
|
39
|
+
public var body: some View {
|
|
40
|
+
VStack(spacing: 12) {
|
|
41
|
+
ZStack(alignment: .topTrailing) {
|
|
42
|
+
SwiftUI.Button(action: onPressClose) {
|
|
43
|
+
Image(systemName: "xmark.circle.fill")
|
|
44
|
+
.resizable()
|
|
45
|
+
.frame(width: 16, height: 16)
|
|
46
|
+
}.foregroundColor(Colors.black20)
|
|
47
|
+
.background(Colors.black01.cornerRadius(8))
|
|
48
|
+
.offset(x: 6, y: -6)
|
|
49
|
+
.zIndex(1)
|
|
50
|
+
|
|
51
|
+
VStack {
|
|
52
|
+
WebImage(url: URL(string: url), isAnimating: .constant(true))
|
|
53
|
+
.resizable()
|
|
54
|
+
.scaledToFill()
|
|
55
|
+
.frame(maxWidth: .infinity, maxHeight: 164)
|
|
56
|
+
.clipShape(RoundedCorner(radius: 8, corners: [.topLeft, .topRight]))
|
|
57
|
+
|
|
58
|
+
VStack(alignment: .leading) {
|
|
59
|
+
Text(title)
|
|
60
|
+
.foregroundColor(.black)
|
|
61
|
+
.font(.headerText1)
|
|
62
|
+
.padding(.top, 12)
|
|
63
|
+
.padding(.bottom, 24)
|
|
64
|
+
|
|
65
|
+
Text(description)
|
|
66
|
+
.foregroundColor(.black)
|
|
67
|
+
.font(.paragraph)
|
|
68
|
+
.opacity(0.6)
|
|
69
|
+
.multilineTextAlignment(.leading)
|
|
70
|
+
.padding(.bottom, 20)
|
|
71
|
+
}.padding(.horizontal, 24)
|
|
72
|
+
|
|
73
|
+
if buttonDirection == .row {
|
|
74
|
+
if buttonType == .text {
|
|
75
|
+
RowTextButtons
|
|
76
|
+
} else {
|
|
77
|
+
RowButtons
|
|
78
|
+
}
|
|
79
|
+
} else {
|
|
80
|
+
if buttonType == .text {
|
|
81
|
+
ColumnTextButtons
|
|
82
|
+
} else {
|
|
83
|
+
ColumnButtons
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
}.clipped()
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
.background(Color.white.cornerRadius(8))
|
|
91
|
+
.shadow(color: .black.opacity(0.08), radius: 2, x: 0, y: 0)
|
|
92
|
+
.shadow(color: .black.opacity(0.16), radius: 24, x: 0, y: 0)
|
|
93
|
+
.padding(.horizontal, 40)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// MARK: Internal
|
|
97
|
+
|
|
98
|
+
@Binding var isPresented: Bool
|
|
99
|
+
var title: String
|
|
100
|
+
var description: String
|
|
101
|
+
var url: String
|
|
102
|
+
var buttonDirection: PopupButtonDirection
|
|
103
|
+
var buttonType: PopupButtonType
|
|
104
|
+
var onPressAction: () -> Void
|
|
105
|
+
var onPressCloseButton: () -> Void
|
|
106
|
+
var onClose: () -> Void
|
|
107
|
+
var actionButtonTitle: String
|
|
108
|
+
var closeButtonTitle: String
|
|
109
|
+
|
|
110
|
+
var RowTextButtons: some View {
|
|
111
|
+
HStack {
|
|
112
|
+
SwiftUI.Button(action: onPressCloseButton) {
|
|
113
|
+
Text(closeButtonTitle)
|
|
114
|
+
.font(.action2)
|
|
115
|
+
}.foregroundColor(Colors.black09)
|
|
116
|
+
.padding(.trailing, 12)
|
|
117
|
+
|
|
118
|
+
SwiftUI.Button(action: onPressAction) {
|
|
119
|
+
Text(actionButtonTitle)
|
|
120
|
+
.font(.action2)
|
|
121
|
+
}.foregroundColor(Colors.primary)
|
|
122
|
+
}
|
|
123
|
+
.frame(maxWidth: .infinity, alignment: .trailing)
|
|
124
|
+
.padding(EdgeInsets(top: 0, leading: 0, bottom: 24, trailing: 24))
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
var ColumnTextButtons: some View {
|
|
128
|
+
VStack(alignment: .trailing) {
|
|
129
|
+
SwiftUI.Button(action: onPressAction) {
|
|
130
|
+
Text(actionButtonTitle)
|
|
131
|
+
.font(.action2)
|
|
132
|
+
}.foregroundColor(Colors.primary)
|
|
133
|
+
.padding(.bottom, 6)
|
|
134
|
+
|
|
135
|
+
SwiftUI.Button(action: onPressCloseButton) {
|
|
136
|
+
Text(closeButtonTitle)
|
|
137
|
+
.font(.action2)
|
|
138
|
+
}.foregroundColor(Colors.black09)
|
|
139
|
+
}
|
|
140
|
+
.frame(maxWidth: .infinity, alignment: .trailing)
|
|
141
|
+
.padding(EdgeInsets(top: 0, leading: 0, bottom: 24, trailing: 24))
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
var RowButtons: some View {
|
|
145
|
+
HStack {
|
|
146
|
+
Button(title: closeButtonTitle, action: onPressCloseButton, type: .secondary)
|
|
147
|
+
Button(title: actionButtonTitle, action: onPressAction)
|
|
148
|
+
}
|
|
149
|
+
.frame(maxWidth: .infinity, alignment: .center)
|
|
150
|
+
.padding(.horizontal, 24)
|
|
151
|
+
.padding(.bottom, 24)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
var ColumnButtons: some View {
|
|
155
|
+
VStack(alignment: .trailing) {
|
|
156
|
+
Button(title: actionButtonTitle, action: onPressAction)
|
|
157
|
+
Button(title: closeButtonTitle, action: onPressCloseButton, type: .secondary)
|
|
158
|
+
}
|
|
159
|
+
.frame(maxWidth: .infinity, alignment: .trailing)
|
|
160
|
+
.padding(.horizontal, 24)
|
|
161
|
+
.padding(.bottom, 24)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
func onPressClose(){
|
|
166
|
+
isPresented = false
|
|
167
|
+
onClose()
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import SDWebImageSwiftUI
|
|
2
|
+
import SwiftUI
|
|
3
|
+
|
|
4
|
+
public struct PopupInput: View {
|
|
5
|
+
// MARK: Lifecycle
|
|
6
|
+
|
|
7
|
+
public init(isPresented: Binding<Bool>, title: String = "", description: String = "", numberOfButtons: Int = 1, actionButtonTitle: String = "", closeButtonTitle: String = "", onPressAction: @escaping () -> Void = {}, onPressCloseButton: @escaping () -> Void = {}, onClose: @escaping () -> Void = {}, inputPlaceholder: String = "", inputValue: Binding<String> = Binding.constant(""), onTextChange: ((String) -> Void)? = nil) {
|
|
8
|
+
self._isPresented = isPresented
|
|
9
|
+
self._inputValue = inputValue
|
|
10
|
+
self.title = title
|
|
11
|
+
self.description = description
|
|
12
|
+
self.onPressAction = onPressAction
|
|
13
|
+
self.onPressCloseButton = onPressCloseButton
|
|
14
|
+
self.onClose = onClose
|
|
15
|
+
self.inputPlaceholder = inputPlaceholder
|
|
16
|
+
self.onTextChange = onTextChange
|
|
17
|
+
self.numberOfButtons = numberOfButtons
|
|
18
|
+
self.closeButtonTitle = closeButtonTitle
|
|
19
|
+
self.actionButtonTitle = actionButtonTitle
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// MARK: Public
|
|
23
|
+
|
|
24
|
+
public var body: some View {
|
|
25
|
+
VStack(spacing: 12) {
|
|
26
|
+
ZStack(alignment: .topTrailing) {
|
|
27
|
+
SwiftUI.Button(action: onPressClose) {
|
|
28
|
+
Image(systemName: "xmark.circle.fill")
|
|
29
|
+
.resizable()
|
|
30
|
+
.frame(width: 16, height: 16)
|
|
31
|
+
}.foregroundColor(Colors.black20)
|
|
32
|
+
.background(Colors.black01.cornerRadius(8))
|
|
33
|
+
.offset(x: 6, y: -6)
|
|
34
|
+
.zIndex(1)
|
|
35
|
+
|
|
36
|
+
VStack {
|
|
37
|
+
VStack(alignment: .leading) {
|
|
38
|
+
Text(title)
|
|
39
|
+
.foregroundColor(.black)
|
|
40
|
+
.font(.headerText1)
|
|
41
|
+
.padding(.top, 12)
|
|
42
|
+
.padding(.bottom, 24)
|
|
43
|
+
|
|
44
|
+
Text(description)
|
|
45
|
+
.foregroundColor(.black)
|
|
46
|
+
.font(.paragraph)
|
|
47
|
+
.opacity(0.6)
|
|
48
|
+
.multilineTextAlignment(.leading)
|
|
49
|
+
.padding(.bottom, 20)
|
|
50
|
+
}.padding(.horizontal, 24)
|
|
51
|
+
|
|
52
|
+
Input($inputValue, placeholder: inputPlaceholder, onChange: onTextChange)
|
|
53
|
+
.padding(.horizontal, 24)
|
|
54
|
+
|
|
55
|
+
if numberOfButtons == 1 {
|
|
56
|
+
Button(title: actionButtonTitle, action: onPressAction)
|
|
57
|
+
.padding(.horizontal, 24)
|
|
58
|
+
.padding(.bottom, 24)
|
|
59
|
+
} else {
|
|
60
|
+
HStack {
|
|
61
|
+
Button(title: closeButtonTitle, action: onPressCloseButton, type: .secondary)
|
|
62
|
+
Button(title: actionButtonTitle, action: onPressAction)
|
|
63
|
+
}.padding(.horizontal, 24)
|
|
64
|
+
.padding(.bottom, 24)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
}.clipped()
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
.background(Color.white.cornerRadius(8))
|
|
71
|
+
.shadow(color: .black.opacity(0.08), radius: 2, x: 0, y: 0)
|
|
72
|
+
.shadow(color: .black.opacity(0.16), radius: 24, x: 0, y: 0)
|
|
73
|
+
.padding(.horizontal, 40)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// MARK: Internal
|
|
77
|
+
|
|
78
|
+
@Binding var isPresented: Bool
|
|
79
|
+
@Binding var inputValue: String
|
|
80
|
+
var title: String
|
|
81
|
+
var description: String
|
|
82
|
+
var onPressAction: () -> Void
|
|
83
|
+
var onPressCloseButton: () -> Void
|
|
84
|
+
var onClose: () -> Void
|
|
85
|
+
var inputPlaceholder: String
|
|
86
|
+
var onTextChange: ((String) -> Void)?
|
|
87
|
+
var numberOfButtons: Int
|
|
88
|
+
var actionButtonTitle: String
|
|
89
|
+
var closeButtonTitle: String
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
func onPressClose(){
|
|
93
|
+
isPresented = false
|
|
94
|
+
onClose()
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import SDWebImageSwiftUI
|
|
2
|
+
import SwiftUI
|
|
3
|
+
|
|
4
|
+
public struct PopupPromotion: View {
|
|
5
|
+
// MARK: Lifecycle
|
|
6
|
+
|
|
7
|
+
public init(isPresented: Binding<Bool>, url: String = "", buttonTitle: String = "", onPressAction: @escaping () -> Void = {}, onClose: @escaping () -> Void = {}) {
|
|
8
|
+
self._isPresented = isPresented
|
|
9
|
+
self.onPressAction = onPressAction
|
|
10
|
+
self.buttonTitle = buttonTitle
|
|
11
|
+
self.onClose = onClose
|
|
12
|
+
self.url = url
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// MARK: Public
|
|
16
|
+
|
|
17
|
+
public var body: some View {
|
|
18
|
+
VStack(spacing: 12) {
|
|
19
|
+
ZStack(alignment: .bottom) {
|
|
20
|
+
WebImage(url: URL(string: url), isAnimating: .constant(true))
|
|
21
|
+
.resizable()
|
|
22
|
+
.placeholder {
|
|
23
|
+
Circle().foregroundColor(.gray)
|
|
24
|
+
}
|
|
25
|
+
.scaledToFill()
|
|
26
|
+
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
27
|
+
.cornerRadius(8)
|
|
28
|
+
|
|
29
|
+
Button(title: buttonTitle, action: onPressAction)
|
|
30
|
+
.padding(.horizontal, 24)
|
|
31
|
+
.padding(.bottom, 24)
|
|
32
|
+
}.clipped()
|
|
33
|
+
}
|
|
34
|
+
.frame(maxWidth: .infinity, maxHeight: 400)
|
|
35
|
+
.shadow(color: .black.opacity(0.08), radius: 2, x: 0, y: 0)
|
|
36
|
+
.shadow(color: .black.opacity(0.16), radius: 24, x: 0, y: 0)
|
|
37
|
+
.padding(.horizontal, 40)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// MARK: Internal
|
|
41
|
+
|
|
42
|
+
@Binding var isPresented: Bool
|
|
43
|
+
var onPressAction: () -> Void
|
|
44
|
+
var onClose: () -> Void
|
|
45
|
+
var buttonTitle: String
|
|
46
|
+
var url: String
|
|
47
|
+
|
|
48
|
+
func onPressClose(){
|
|
49
|
+
isPresented = false
|
|
50
|
+
onClose()
|
|
51
|
+
}
|
|
52
|
+
}
|