@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.
Files changed (52) hide show
  1. package/compose/build.gradle.kts +1 -1
  2. package/compose/compose.podspec +1 -1
  3. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +1 -1
  4. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +3 -1
  5. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +26 -7
  6. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +3 -1
  7. package/gradle.properties +1 -1
  8. package/ios/Application/ApplicationEnvironment.swift +4 -2
  9. package/ios/Application/MaxApi.swift +18 -0
  10. package/ios/Application/Navigation/NavigationContainer.swift +21 -3
  11. package/ios/Application/Navigation/Navigator.swift +50 -29
  12. package/ios/Application/Navigation/Overplay/ModalScreen.swift +6 -0
  13. package/ios/Application/Navigation/Tracking/ScreenTracker.swift +117 -0
  14. package/ios/Application/StackScreen.swift +41 -0
  15. package/ios/Badge/BadgeRibbon.swift +80 -0
  16. package/ios/Button/Button.swift +67 -11
  17. package/ios/Carousel/Carousel.swift +16 -1
  18. package/ios/Checkbox/Checkbox.swift +14 -20
  19. package/ios/Chip/Chip.swift +35 -26
  20. package/ios/Collapse/Collapse.swift +11 -1
  21. package/ios/DateTimePicker/DateTimePicker.swift +4 -2
  22. package/ios/DateTimePicker/WheelPicker.swift +7 -3
  23. package/ios/Extensions/ActiveOpacityButtonStyle.swift +14 -0
  24. package/ios/Icon/Icon.swift +5 -1
  25. package/ios/IconButton/IconButton.swift +35 -7
  26. package/ios/Image/Image.swift +16 -3
  27. package/ios/Information/Information.swift +3 -1
  28. package/ios/Input/ErrorView.swift +3 -1
  29. package/ios/Input/Input.swift +31 -8
  30. package/ios/Input/InputPhoneNumber.swift +14 -3
  31. package/ios/Input/InputSearch.swift +7 -1
  32. package/ios/Input/InputTextArea.swift +78 -34
  33. package/ios/InputDropDown/InputDropDown.swift +4 -1
  34. package/ios/InputMoney/InputMoney.swift +16 -4
  35. package/ios/Popup/PopupDisplay.swift +3 -4
  36. package/ios/Popup/PopupNotify.swift +3 -4
  37. package/ios/Popup/PopupPromotion.swift +16 -8
  38. package/ios/ProgressInfo/ProgressInfo.swift +4 -2
  39. package/ios/Radio/Radio.swift +12 -13
  40. package/ios/Rating/Rating.swift +1 -1
  41. package/ios/Stepper/Stepper.swift +2 -2
  42. package/ios/Steps/Steps.swift +22 -6
  43. package/ios/SuggestAction/SuggestAction.swift +5 -3
  44. package/ios/Swipeable/SwipeCell.swift +5 -3
  45. package/ios/Switch/Switch.swift +53 -28
  46. package/ios/TabView/TabView.swift +18 -14
  47. package/ios/Template/TrustBanner/TrustBanner.swift +6 -7
  48. package/ios/Tooltip/Tooltip.swift +3 -0
  49. package/ios/Uploader/Uploader.swift +0 -9
  50. package/ios/native-kits.podspec +1 -1
  51. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  52. 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
- Icon(source: "navigation_close", size: 24, color: theme.colors.text.default)
81
- .contentShape(Rectangle())
82
- .onTapGesture { onClose() }
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: Colors.primary
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: Colors.error
74
+ defaultBackgroundColor: theme.colors.error.primary
73
75
  )
74
76
  }
75
77
  }
76
78
  }
77
79
 
78
80
  ZStack {
79
- Colors.card
81
+ theme.colors.background.surface
80
82
  content()
81
83
  }
82
84
  .frame(maxWidth: .infinity)
@@ -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
- public init(_ value: Binding<Bool>,disabled: Bool = false, onChange: ((Bool)->Void)? = nil){
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
- HStack{
24
- HStack {
25
- }
26
- .frame(width: 6, height: 6)
27
- .background(value ? Colors.pink03 : Colors.black07)
28
- .clipShape(Circle())
29
- .opacity(disabled ? 0.4 : 1)
30
- }
31
- .frame(width: 14, height: 14)
32
- .background(Colors.black01)
33
- .clipShape(Circle())
34
- .padding(.leading,5)
35
- .padding(.trailing,5)
36
-
37
- }
38
- .disabled(disabled)
39
- .frame(width: 40, height: 24, alignment: value == true ? .trailing : .leading)
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
- cardItem(tab: tab, isActive: isActive, iconColor: iconColor)
367
- .frame(maxWidth: .infinity)
368
- .frame(height: isActive ? 44 : 40)
369
- .background(isActive ? theme.colors.background.surface : theme.colors.background.tonal)
370
- .clipShape(UnstyledRoundedRectangle(topLeft: Radius.M, topRight: Radius.M))
371
- .contentShape(Rectangle())
372
- .onTapGesture { onPress(index) }
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
- Group {
420
- if direction == .column {
421
- columnBody
422
- } else {
423
- rowBody
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
- .contentShape(Rectangle())
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[language ?? "vi"] as? String ?? defaultBanner.content[language ?? "vi"])
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[language ?? "vi"] as? String ?? defaultBanner.subContent[language ?? "vi"])
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
- }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKits'
3
- s.version = '0.163.1-beta.6'
3
+ s.version = '0.162.2-sp.9'
4
4
  s.summary = 'MoMoUIKits for iOS'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKitsDemo'
3
- s.version = '0.163.1-beta.6'
3
+ s.version = '0.162.2-sp.9'
4
4
  s.summary = 'Demo browser for MoMoUIKits SwiftUI components'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.162.21-debug",
3
+ "version": "0.162.22-debug",
4
4
  "private": false,
5
5
  "dependencies": {},
6
6
  "devDependencies": {},