@momo-kits/native-kits 0.162.21-debug → 0.162.22-debug
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/compose/build.gradle.kts +1 -1
- package/compose/compose.podspec +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +3 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +26 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +3 -1
- package/gradle.properties +1 -1
- package/ios/Application/ApplicationEnvironment.swift +4 -2
- package/ios/Application/MaxApi.swift +18 -0
- package/ios/Application/Navigation/NavigationContainer.swift +21 -3
- package/ios/Application/Navigation/Navigator.swift +50 -29
- package/ios/Application/Navigation/Overplay/ModalScreen.swift +6 -0
- package/ios/Application/Navigation/Tracking/ScreenTracker.swift +117 -0
- package/ios/Application/StackScreen.swift +41 -0
- package/ios/Badge/BadgeRibbon.swift +80 -0
- package/ios/Button/Button.swift +67 -11
- package/ios/Carousel/Carousel.swift +16 -1
- package/ios/Checkbox/Checkbox.swift +14 -20
- package/ios/Chip/Chip.swift +35 -26
- package/ios/Collapse/Collapse.swift +11 -1
- package/ios/DateTimePicker/DateTimePicker.swift +4 -2
- package/ios/DateTimePicker/WheelPicker.swift +7 -3
- package/ios/Extensions/ActiveOpacityButtonStyle.swift +14 -0
- package/ios/Icon/Icon.swift +5 -1
- package/ios/IconButton/IconButton.swift +35 -7
- package/ios/Image/Image.swift +16 -3
- package/ios/Information/Information.swift +3 -1
- package/ios/Input/ErrorView.swift +3 -1
- package/ios/Input/Input.swift +31 -8
- package/ios/Input/InputPhoneNumber.swift +14 -3
- package/ios/Input/InputSearch.swift +7 -1
- package/ios/Input/InputTextArea.swift +78 -34
- package/ios/InputDropDown/InputDropDown.swift +4 -1
- package/ios/InputMoney/InputMoney.swift +16 -4
- package/ios/Popup/PopupDisplay.swift +3 -4
- package/ios/Popup/PopupNotify.swift +3 -4
- package/ios/Popup/PopupPromotion.swift +16 -8
- package/ios/ProgressInfo/ProgressInfo.swift +4 -2
- package/ios/Radio/Radio.swift +12 -13
- package/ios/Rating/Rating.swift +1 -1
- package/ios/Stepper/Stepper.swift +2 -2
- package/ios/Steps/Steps.swift +22 -6
- package/ios/SuggestAction/SuggestAction.swift +5 -3
- package/ios/Swipeable/SwipeCell.swift +5 -3
- package/ios/Switch/Switch.swift +53 -28
- package/ios/TabView/TabView.swift +18 -14
- package/ios/Template/TrustBanner/TrustBanner.swift +6 -7
- package/ios/Tooltip/Tooltip.swift +3 -0
- package/ios/Uploader/Uploader.swift +0 -9
- package/ios/native-kits.podspec +1 -1
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
- package/package.json +1 -1
|
@@ -77,9 +77,11 @@ public struct SuggestAction: View {
|
|
|
77
77
|
|
|
78
78
|
Spacer().frame(width: Spacing.S)
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
.
|
|
82
|
-
|
|
80
|
+
SwiftUI.Button(action: onClose) {
|
|
81
|
+
Icon(source: "navigation_close", size: 24, color: theme.colors.text.default)
|
|
82
|
+
.contentShape(Rectangle())
|
|
83
|
+
}
|
|
84
|
+
.buttonStyle(ActiveOpacityButtonStyle())
|
|
83
85
|
}
|
|
84
86
|
.padding(Spacing.M)
|
|
85
87
|
.frame(maxWidth: .infinity)
|
|
@@ -6,6 +6,8 @@ private let swipeActionWidth: CGFloat = 56
|
|
|
6
6
|
// MARK: - Swipe
|
|
7
7
|
|
|
8
8
|
public struct Swipe<Content: View>: View {
|
|
9
|
+
@Environment(\.appTheme) private var theme
|
|
10
|
+
|
|
9
11
|
private let leftActions: [SwipeAction]
|
|
10
12
|
private let rightActions: [SwipeAction]
|
|
11
13
|
private let height: CGFloat
|
|
@@ -54,7 +56,7 @@ public struct Swipe<Content: View>: View {
|
|
|
54
56
|
action: action,
|
|
55
57
|
height: height,
|
|
56
58
|
itemRadius: itemRadius,
|
|
57
|
-
defaultBackgroundColor:
|
|
59
|
+
defaultBackgroundColor: theme.colors.primary
|
|
58
60
|
)
|
|
59
61
|
}
|
|
60
62
|
Spacer(minLength: 0)
|
|
@@ -69,14 +71,14 @@ public struct Swipe<Content: View>: View {
|
|
|
69
71
|
action: action,
|
|
70
72
|
height: height,
|
|
71
73
|
itemRadius: itemRadius,
|
|
72
|
-
defaultBackgroundColor:
|
|
74
|
+
defaultBackgroundColor: theme.colors.error.primary
|
|
73
75
|
)
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
ZStack {
|
|
79
|
-
|
|
81
|
+
theme.colors.background.surface
|
|
80
82
|
content()
|
|
81
83
|
}
|
|
82
84
|
.frame(maxWidth: .infinity)
|
package/ios/Switch/Switch.swift
CHANGED
|
@@ -1,44 +1,69 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
import SwiftUI
|
|
3
3
|
|
|
4
|
-
public struct Switch: View{
|
|
4
|
+
public struct Switch: View {
|
|
5
5
|
@Binding var value: Bool
|
|
6
6
|
var disabled: Bool
|
|
7
|
-
var onChange: ((Bool)->Void)?
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
var onChange: ((Bool) -> Void)?
|
|
8
|
+
var title: String?
|
|
9
|
+
var accessibilityId: String?
|
|
10
|
+
|
|
11
|
+
public init(
|
|
12
|
+
_ value: Binding<Bool>,
|
|
13
|
+
disabled: Bool = false,
|
|
14
|
+
onChange: ((Bool) -> Void)? = nil,
|
|
15
|
+
title: String? = "",
|
|
16
|
+
accessibilityId: String? = ""
|
|
17
|
+
) {
|
|
10
18
|
self._value = value
|
|
11
19
|
self.disabled = disabled
|
|
12
20
|
self.onChange = onChange
|
|
21
|
+
self.title = title
|
|
22
|
+
self.accessibilityId = accessibilityId
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Mirrors Kotlin's `backgroundColor`: shared by the track AND the inner dot.
|
|
26
|
+
private var backgroundColor: Color {
|
|
27
|
+
switch (disabled, value) {
|
|
28
|
+
case (true, true): return Colors.green09
|
|
29
|
+
case (true, false): return Colors.black05
|
|
30
|
+
case (false, true): return Colors.green03
|
|
31
|
+
case (false, false): return Colors.black07
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Mirrors Kotlin's `circleBackgroundColor` (the outer 14pt thumb circle).
|
|
36
|
+
private var circleColor: Color {
|
|
37
|
+
value ? Colors.black01 : Colors.black03
|
|
13
38
|
}
|
|
14
|
-
|
|
15
|
-
|
|
39
|
+
|
|
40
|
+
private var automationId: String {
|
|
41
|
+
accessibilityId?.isEmpty == false ? accessibilityId! : "toggle_\(title?.isEmpty == false ? title! : "unknown")_\(value)"
|
|
42
|
+
}
|
|
43
|
+
|
|
16
44
|
public var body: some View {
|
|
17
45
|
SwiftUI.Button(action: {
|
|
18
|
-
withAnimation{
|
|
46
|
+
withAnimation {
|
|
19
47
|
value.toggle()
|
|
20
48
|
onChange?(value)
|
|
21
49
|
}
|
|
22
|
-
}){
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
.background(value ? Colors.pink03 : Colors.black07)
|
|
41
|
-
.clipShape(Capsule())
|
|
42
|
-
.opacity(disabled ? 0.4 : 1)
|
|
50
|
+
}) {
|
|
51
|
+
HStack {
|
|
52
|
+
HStack {}
|
|
53
|
+
.frame(width: 6, height: 6)
|
|
54
|
+
.background(backgroundColor)
|
|
55
|
+
.clipShape(Circle())
|
|
56
|
+
}
|
|
57
|
+
.frame(width: 14, height: 14)
|
|
58
|
+
.background(circleColor)
|
|
59
|
+
.clipShape(Circle())
|
|
60
|
+
.padding(.leading, Spacing.XS)
|
|
61
|
+
.padding(.trailing, Spacing.XS)
|
|
62
|
+
}
|
|
63
|
+
.disabled(disabled)
|
|
64
|
+
.frame(width: 38, height: 20, alignment: value ? .trailing : .leading)
|
|
65
|
+
.background(backgroundColor)
|
|
66
|
+
.clipShape(Capsule())
|
|
67
|
+
.accessibilityIdentifier(automationId)
|
|
43
68
|
}
|
|
44
69
|
}
|
|
@@ -363,13 +363,15 @@ private struct CardTabBar: View {
|
|
|
363
363
|
let isActive = selectedIndex == index
|
|
364
364
|
let iconColor = isActive ? selectedColor : unselectedColor
|
|
365
365
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
366
|
+
SwiftUI.Button(action: { onPress(index) }) {
|
|
367
|
+
cardItem(tab: tab, isActive: isActive, iconColor: iconColor)
|
|
368
|
+
.frame(maxWidth: .infinity)
|
|
369
|
+
.frame(height: isActive ? 44 : 40)
|
|
370
|
+
.background(isActive ? theme.colors.background.surface : theme.colors.background.tonal)
|
|
371
|
+
.clipShape(UnstyledRoundedRectangle(topLeft: Radius.M, topRight: Radius.M))
|
|
372
|
+
.contentShape(Rectangle())
|
|
373
|
+
}
|
|
374
|
+
.buttonStyle(ActiveOpacityButtonStyle())
|
|
373
375
|
}
|
|
374
376
|
}
|
|
375
377
|
.frame(maxWidth: .infinity)
|
|
@@ -416,15 +418,17 @@ private struct TabItemView: View {
|
|
|
416
418
|
private var textStyle: TypographyStyle { active ? .headerSSemibold : .bodyDefaultRegular }
|
|
417
419
|
|
|
418
420
|
var body: some View {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
421
|
+
SwiftUI.Button(action: onPress) {
|
|
422
|
+
Group {
|
|
423
|
+
if direction == .column {
|
|
424
|
+
columnBody
|
|
425
|
+
} else {
|
|
426
|
+
rowBody
|
|
427
|
+
}
|
|
424
428
|
}
|
|
429
|
+
.contentShape(Rectangle())
|
|
425
430
|
}
|
|
426
|
-
.
|
|
427
|
-
.onTapGesture { onPress() }
|
|
431
|
+
.buttonStyle(ActiveOpacityButtonStyle())
|
|
428
432
|
}
|
|
429
433
|
|
|
430
434
|
@ViewBuilder
|
|
@@ -52,15 +52,14 @@ let defaultBanner = TrustBannerData(
|
|
|
52
52
|
|
|
53
53
|
public struct TrustBanner: View {
|
|
54
54
|
@EnvironmentObject var applicationEnvironment: ApplicationEnvironment
|
|
55
|
-
|
|
55
|
+
@EnvironmentObject private var localize: Localize
|
|
56
|
+
|
|
56
57
|
var onPress: ((String)->Void)?
|
|
57
|
-
|
|
58
|
+
|
|
58
59
|
public init(onPress: ((String)->Void)?) {
|
|
59
60
|
self.onPress = onPress
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
-
var language: String? = "vi"
|
|
63
|
-
|
|
62
|
+
|
|
64
63
|
func onPressSecurity() {
|
|
65
64
|
if (onPress != nil) {
|
|
66
65
|
onPress!(applicationEnvironment.config?.trustBanner?.urlConfig ?? defaultBanner.urlConfig)
|
|
@@ -75,7 +74,7 @@ public struct TrustBanner: View {
|
|
|
75
74
|
.scaledToFit()
|
|
76
75
|
.frame(width: 64, height: 64)
|
|
77
76
|
VStack(alignment: .leading){
|
|
78
|
-
Text(applicationEnvironment.config?.trustBanner?.content[
|
|
77
|
+
Text(applicationEnvironment.config?.trustBanner?.content[localize.currentLanguage] ?? defaultBanner.content[localize.currentLanguage])
|
|
79
78
|
.foregroundColor(Color(hex: "484848"))
|
|
80
79
|
.lineLimit(2)
|
|
81
80
|
.font(.system(size: 13, weight: Font.Weight.regular))
|
|
@@ -84,7 +83,7 @@ public struct TrustBanner: View {
|
|
|
84
83
|
.padding(.bottom, 8)
|
|
85
84
|
HStack {
|
|
86
85
|
HStack(spacing: 0) {
|
|
87
|
-
Text(applicationEnvironment.config?.trustBanner?.subContent[
|
|
86
|
+
Text(applicationEnvironment.config?.trustBanner?.subContent[localize.currentLanguage] ?? defaultBanner.subContent[localize.currentLanguage])
|
|
88
87
|
.foregroundColor(Colors.pink03)
|
|
89
88
|
.font(.system(size: 13, weight: .bold))
|
|
90
89
|
.ignoreBoldTextSetting()
|
|
@@ -462,6 +462,9 @@ private struct TooltipSecondaryButton: View {
|
|
|
462
462
|
.padding(.vertical, Spacing.S)
|
|
463
463
|
}
|
|
464
464
|
.buttonStyle(.plain)
|
|
465
|
+
// Mirrors Compose's `Modifier.weight(1f, fill = false)` on the secondary button:
|
|
466
|
+
// it yields space to the primary button first under width pressure.
|
|
467
|
+
.layoutPriority(-1)
|
|
465
468
|
}
|
|
466
469
|
}
|
|
467
470
|
|
|
@@ -172,12 +172,3 @@ private struct UploaderImageItem: View {
|
|
|
172
172
|
.buttonStyle(ActiveOpacityButtonStyle())
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
|
|
176
|
-
// MARK: - Active opacity button style
|
|
177
|
-
|
|
178
|
-
private struct ActiveOpacityButtonStyle: ButtonStyle {
|
|
179
|
-
func makeBody(configuration: Configuration) -> some View {
|
|
180
|
-
configuration.label
|
|
181
|
-
.opacity(configuration.isPressed ? 0.5 : 1)
|
|
182
|
-
}
|
|
183
|
-
}
|
package/ios/native-kits.podspec
CHANGED