@momo-kits/native-kits 0.300.7-debug → 0.300.8-beta.1-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 (202) hide show
  1. package/CLAUDE.md +12 -8
  2. package/README.md +8 -7
  3. package/compose/build.gradle.kts +2 -4
  4. package/compose/build.gradle.kts.backup +1 -3
  5. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +1 -2
  6. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +3 -2
  7. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +17 -0
  8. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +1 -1
  9. package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +2 -3
  10. package/compose/src/commonMain/kotlin/vn/momo/kits/application/KitsBinding.kt +60 -0
  11. package/compose/src/commonMain/kotlin/vn/momo/kits/application/KitsHost.kt +32 -0
  12. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +20 -24
  13. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +5 -6
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +7 -17
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +18 -18
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +2 -2
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +15 -18
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +4 -2
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +13 -73
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +1 -1
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +1 -8
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +1 -53
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +3 -8
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +2 -3
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +12 -15
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +11 -9
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +17 -12
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +20 -5
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +3 -5
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +7 -8
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +1 -2
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -2
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +1 -2
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +83 -82
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +3 -3
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +6 -10
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +9 -9
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -2
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +13 -35
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +2 -4
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +5 -22
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -2
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -3
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +6 -24
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +55 -5
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +1 -7
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +3 -6
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +1 -1
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +22 -50
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +2 -7
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +11 -7
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/HeaderLayout.kt +71 -0
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ModalLayout.kt +184 -0
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +18 -9
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +5 -3
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +123 -64
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +24 -8
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +11 -9
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +16 -19
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +59 -41
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +69 -51
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +14 -10
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +5 -10
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +43 -32
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +330 -149
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +87 -70
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +1 -5
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +92 -261
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +133 -0
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -2
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +31 -40
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +3 -1
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +46 -72
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HelpCenterRequest.kt +8 -12
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +29 -24
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/ToolkitRequests.kt +8 -11
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +9 -9
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +26 -3
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +1 -3
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +3 -1
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +7 -0
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +4 -3
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +2 -3
  84. package/compose/src/commonTest/kotlin/vn/momo/kits/application/KitsHostTest.kt +44 -0
  85. package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/HelpCenterRequestTest.kt +2 -7
  86. package/compose/src/commonTest/kotlin/vn/momo/kits/navigation/component/ToolkitRequestsTest.kt +9 -18
  87. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +1 -1
  88. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +3 -6
  89. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +5 -6
  90. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +12 -12
  91. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +48 -0
  92. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +11 -6
  93. package/gradle/libs.versions.toml +1 -3
  94. package/gradle.properties +1 -3
  95. package/ios/Application/ApplicationEnvironment.swift +6 -4
  96. package/ios/Application/DesignSystemKits.swift +59 -13
  97. package/ios/Application/DesignSystemKitsPayload.swift +0 -8
  98. package/ios/Application/LanguageSource.swift +2 -11
  99. package/ios/Application/Localize.swift +8 -35
  100. package/ios/Application/LocalizeModifier.swift +2 -11
  101. package/ios/Application/MaxApi.swift +3 -11
  102. package/ios/Avatar/Avatar.swift +0 -1
  103. package/ios/Badge/Badge.swift +5 -8
  104. package/ios/Badge/BadgeRibbon.swift +2 -5
  105. package/ios/Button/Button.swift +4 -8
  106. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +5 -7
  107. package/ios/Carousel/Carousel.swift +4 -17
  108. package/ios/Checkbox/Checkbox.swift +0 -2
  109. package/ios/Collapse/Collapse.swift +17 -11
  110. package/ios/Colors+Radius+Spacing/Theme.swift +0 -7
  111. package/ios/DateTimePicker/DateTimePicker.swift +4 -10
  112. package/ios/DateTimePicker/DateTimePickerTypes.swift +1 -3
  113. package/ios/DateTimePicker/DateTimePickerUtils.swift +0 -3
  114. package/ios/DateTimePicker/WheelPicker.swift +2 -4
  115. package/ios/Extensions/ActiveOpacityButtonStyle.swift +2 -3
  116. package/ios/Extensions/Color++.swift +2 -4
  117. package/ios/Extensions/SkeletonUICompat.swift +0 -8
  118. package/ios/Icon/Icon.swift +3 -6
  119. package/ios/IconButton/IconButton.swift +2 -5
  120. package/ios/Input/ErrorView.swift +0 -7
  121. package/ios/Input/Input.swift +9 -20
  122. package/ios/Input/InputPhoneNumber.swift +37 -20
  123. package/ios/Input/InputSearch.swift +23 -12
  124. package/ios/Input/InputTextArea.swift +4 -13
  125. package/ios/InputDropDown/InputDropDown.swift +1 -11
  126. package/ios/InputMoney/InputMoney.swift +9 -28
  127. package/ios/InputOTP/InputOTP.swift +2 -9
  128. package/ios/Layout/HeaderLayout.swift +72 -0
  129. package/ios/Layout/Item.swift +1 -2
  130. package/ios/Layout/ModalLayout.swift +144 -0
  131. package/ios/Layout/ScreenLayout.swift +48 -31
  132. package/ios/Layout/Section.swift +2 -3
  133. package/ios/Loader/Loader.swift +3 -12
  134. package/ios/Lottie/LottieView.swift +0 -11
  135. package/ios/Navigation/BottomSheet.swift +73 -94
  136. package/ios/Navigation/BottomTab/BottomTab.swift +58 -73
  137. package/ios/Navigation/BottomTab/BottomTabBar.swift +286 -121
  138. package/ios/Navigation/BottomTab/CurvedContainer.swift +52 -54
  139. package/ios/Navigation/BottomTab/DuoBarCompression.swift +5 -12
  140. package/ios/Navigation/BottomTab/DuoTabBar.swift +67 -202
  141. package/ios/Navigation/BottomTab/TabBarMetrics.swift +97 -0
  142. package/ios/Navigation/Component/FloatingButton.swift +4 -11
  143. package/ios/Navigation/Component/Header.swift +35 -54
  144. package/ios/Navigation/Component/HeaderBackground.swift +2 -8
  145. package/ios/Navigation/Component/HeaderJourney.swift +4 -8
  146. package/ios/Navigation/Component/HeaderLocation.swift +4 -8
  147. package/ios/Navigation/Component/HeaderRight.swift +20 -22
  148. package/ios/Navigation/Component/HeaderTitle.swift +1 -6
  149. package/ios/Navigation/Component/HeaderUser.swift +4 -10
  150. package/ios/Navigation/Component/SideBar.swift +6 -21
  151. package/ios/Navigation/Component/SnackBar.swift +9 -13
  152. package/ios/Navigation/HostBackGestureBridge.swift +2 -9
  153. package/ios/Navigation/ModalScreen.swift +24 -13
  154. package/ios/Navigation/Navigation.swift +35 -19
  155. package/ios/Navigation/NavigationContainer.swift +4 -15
  156. package/ios/Navigation/Navigator.swift +21 -39
  157. package/ios/Navigation/StackScreen.swift +64 -51
  158. package/ios/Navigation/StackTransition.swift +7 -14
  159. package/ios/Navigation/SwipeBackHaptic.swift +2 -7
  160. package/ios/Navigation/Tracking/ScreenTracker.swift +2 -7
  161. package/ios/Pagination/PaginationDot.swift +0 -9
  162. package/ios/Pagination/PaginationNumber.swift +1 -9
  163. package/ios/Pagination/PaginationScroll.swift +2 -14
  164. package/ios/Pagination/PaginationWhiteDot.swift +1 -10
  165. package/ios/Popup/PopupDisplay.swift +7 -5
  166. package/ios/Popup/PopupInput.swift +6 -4
  167. package/ios/Popup/PopupLayout.swift +17 -9
  168. package/ios/Popup/PopupNotify.swift +32 -25
  169. package/ios/PopupView/FullscreenPopup.swift +3 -4
  170. package/ios/PopupView/PopupView.swift +2 -2
  171. package/ios/PopupView/Utils++.swift +1 -2
  172. package/ios/ProgressInfo/ProgressInfo.swift +2 -13
  173. package/ios/Skeleton/Skeleton.swift +5 -16
  174. package/ios/Slider/Slider.swift +5 -12
  175. package/ios/StatusBarTap/StatusBarTap.h +2 -3
  176. package/ios/StatusBarTap/StatusBarTap.m +3 -16
  177. package/ios/Stepper/Stepper.swift +8 -27
  178. package/ios/Steps/Steps.swift +29 -26
  179. package/ios/Swipeable/SwipeCell.swift +2 -2
  180. package/ios/Swipeable/SwipeCellModel.swift +3 -6
  181. package/ios/TabView/TabView.swift +14 -28
  182. package/ios/Template/TrustBanner/TrustBanner.swift +2 -9
  183. package/ios/Title/Title.swift +1 -3
  184. package/ios/Tooltip/Tooltip.swift +4 -9
  185. package/ios/Typography/FontScale.swift +79 -24
  186. package/ios/Typography/Text.swift +6 -12
  187. package/ios/Typography/Typography.swift +8 -11
  188. package/ios/Uploader/Uploader.swift +2 -17
  189. package/ios-demo/Resources/tabbar_scan_qr_button.json +1 -0
  190. package/ios-demo/Resources/tabbar_scan_qr_label.json +1 -0
  191. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +11 -2
  192. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +296 -59
  193. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +15 -4
  194. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +0 -8
  195. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +114 -0
  196. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +29 -1
  197. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +16 -0
  198. package/package.json +1 -1
  199. package/publish.sh +8 -2
  200. package/scripts/ci/build-swiftui.sh +22 -0
  201. package/scripts/ci/resolve-version.mjs +144 -0
  202. package/settings.gradle.kts +0 -1
@@ -94,11 +94,7 @@ public struct Collapse<Content: View>: View {
94
94
  content()
95
95
  }
96
96
  .frame(maxWidth: .infinity)
97
- .overlay(
98
- showBorder
99
- ? Rectangle().strokeBorder(theme.colors.border.default, lineWidth: 1)
100
- : nil
101
- )
97
+ .overlay(contentBorder)
102
98
  .transition(.move(edge: .top))
103
99
  }
104
100
  }
@@ -108,17 +104,27 @@ public struct Collapse<Content: View>: View {
108
104
  .frame(maxWidth: .infinity)
109
105
  .background(resolvedBackgroundColor)
110
106
  .clipShape(RoundedRectangle(cornerRadius: Radius.S, style: .continuous))
111
- .overlay(
112
- showBorder
113
- ? RoundedRectangle(cornerRadius: Radius.S, style: .continuous)
114
- .strokeBorder(theme.colors.border.default, lineWidth: 1)
115
- : nil
116
- )
107
+ .overlay(containerBorder)
117
108
  // `.contain` keeps the children's own identifiers instead of overriding them.
118
109
  .accessibilityElement(children: .contain)
119
110
  .accessibilityIdentifier(automationId)
120
111
  }
121
112
 
113
+ @ViewBuilder
114
+ private var contentBorder: some View {
115
+ if showBorder {
116
+ Rectangle().strokeBorder(theme.colors.border.default, lineWidth: 1)
117
+ }
118
+ }
119
+
120
+ @ViewBuilder
121
+ private var containerBorder: some View {
122
+ if showBorder {
123
+ RoundedRectangle(cornerRadius: Radius.S, style: .continuous)
124
+ .strokeBorder(theme.colors.border.default, lineWidth: 1)
125
+ }
126
+ }
127
+
122
128
  private var header: some View {
123
129
  SwiftUI.Button(action: {
124
130
  onPress?(expanded)
@@ -1,10 +1,3 @@
1
- //
2
- // Theme.swift
3
- // MoMoUIKits
4
- //
5
- // Created by sophia on 25/2/26.
6
- //
7
-
8
1
  import Foundation
9
2
  import SwiftUI
10
3
 
@@ -7,12 +7,8 @@ private let datePickerWithLabelsHeight: CGFloat = 238
7
7
 
8
8
  // MARK: - DateTimePicker
9
9
 
10
- /// A wheel-style date/time picker matching Compose `DateTimePicker`.
11
- ///
12
- /// The `format` string drives which columns are shown:
13
- /// - `DD` day, `MM` month, `YYYY` year, `HH` hour, `mm` minute.
14
- /// - `"HH:mm"` shows hour + minute; a lone `"HH"` switches the hour wheel to a
15
- /// 12-hour clock with an AM/PM column.
10
+ /// Wheel date/time picker matching Compose `DateTimePicker`. `format` picks the columns (`DD`, `MM`,
11
+ /// `YYYY`, `HH`, `mm`); a lone `"HH"` switches the hour wheel to a 12-hour clock with an AM/PM column.
16
12
  public struct DateTimePicker: View {
17
13
  @Environment(\.appTheme) private var theme
18
14
 
@@ -39,7 +35,6 @@ public struct DateTimePicker: View {
39
35
  let effectiveMin = minDate ?? DateTimePickerUtils.createRelativeDate(years: -10)
40
36
  let effectiveMax = maxDate ?? DateTimePickerUtils.createRelativeDate(years: 10)
41
37
 
42
- // needCheckRange is true only when the caller supplied no bounds.
43
38
  let needCheckRange = (minDate == nil && maxDate == nil)
44
39
 
45
40
  self._currentData = State(initialValue: Self.pickerData(
@@ -222,9 +217,8 @@ public struct DateTimePicker: View {
222
217
  emitIfValid()
223
218
  }
224
219
 
225
- /// Emit `onChange` only when the assembled date is valid and (when bounds were
226
- /// not supplied) within the effective min/max range. Mirrors the Compose
227
- /// `snapshotFlow.mapNotNull` filter.
220
+ /// Emits `onChange` only for a valid date, range-checked only when no bounds were supplied
221
+ /// (Compose's `snapshotFlow.mapNotNull` filter).
228
222
  private func emitIfValid() {
229
223
  guard let date = currentData.toDate() else { return }
230
224
  if !needCheckRange {
@@ -2,8 +2,7 @@ import Foundation
2
2
 
3
3
  // MARK: - PickerData
4
4
 
5
- /// Internal mutable representation of the picker's current selection.
6
- /// Mirrors Compose `PickerData`.
5
+ /// The picker's current selection (Compose `PickerData`).
7
6
  public struct DateTimePickerData: Equatable {
8
7
  public var day: Int
9
8
  public var month: Int
@@ -28,7 +27,6 @@ public struct DateTimePickerData: Equatable {
28
27
  self.timeMode = timeMode
29
28
  }
30
29
 
31
- /// Convert to a `DateComponents` based value. Returns `nil` if the date is invalid.
32
30
  public func toDate(calendar: Calendar = Calendar.current) -> Date? {
33
31
  var components = DateComponents()
34
32
  components.year = year
@@ -38,7 +38,6 @@ public enum DateTimePickerUtils {
38
38
  }
39
39
  }
40
40
 
41
- /// Number of days in a given month/year.
42
41
  private static func daysInMonth(year: Int, month: Int) -> Int {
43
42
  switch month {
44
43
  case 1, 3, 5, 7, 8, 10, 12: return 31
@@ -90,7 +89,6 @@ public enum DateTimePickerUtils {
90
89
  return (startMonth...endMonth).map { paddingNum($0) }
91
90
  }
92
91
 
93
- /// Get a list of year strings between min and max date.
94
92
  public static func getYears(minDate: DateComponents, maxDate: DateComponents) -> [String] {
95
93
  let startYear = minDate.year ?? 0
96
94
  let endYear = maxDate.year ?? 0
@@ -120,7 +118,6 @@ public enum DateTimePickerUtils {
120
118
  return minutes
121
119
  }
122
120
 
123
- /// Today's date.
124
121
  public static func getCurrentDateTime() -> Date {
125
122
  return Date()
126
123
  }
@@ -8,10 +8,8 @@ private let wheelPickerBorderWidth: CGFloat = 1
8
8
 
9
9
  // MARK: - WheelPicker
10
10
 
11
- /// A reusable single-column wheel picker, mirroring Compose `WheelPicker.kt`.
12
- ///
13
- /// Five rows tall with the selection in the middle row. A drag always settles on a row
14
- /// (Compose snaps once the scroll stops) and then reports it via `onChange(name, value)`.
11
+ /// Single-column wheel (Compose `WheelPicker.kt`), five rows tall with the selection in the middle.
12
+ /// A drag always settles on a row (Compose snaps once the scroll stops), then reports it via `onChange`.
15
13
  public struct WheelPicker: View {
16
14
  @Environment(\.appTheme) private var theme
17
15
 
@@ -1,8 +1,7 @@
1
1
  import SwiftUI
2
2
 
3
- /// Mirrors Compose's `Modifier.activeOpacityClickable(activeOpacity:)` (modifier/Clickable.kt):
4
- /// fades the whole tappable subtree to `activeOpacity` while pressed, animated, instead of
5
- /// relying on a platform-default press indication.
3
+ /// Compose's `Modifier.activeOpacityClickable(activeOpacity:)`: the whole tappable subtree fades to `activeOpacity`
4
+ /// while pressed, instead of a platform-default press indication.
6
5
  struct ActiveOpacityButtonStyle: ButtonStyle {
7
6
  var activeOpacity: Double = 0.2
8
7
 
@@ -4,16 +4,14 @@ import Foundation
4
4
  private final class MoMoUIKitsBundleToken {}
5
5
 
6
6
  enum MoMoUIKitsResources {
7
+
7
8
  static let bundle: Bundle = {
8
9
  let bundleName = "MoMoUIKitsResources"
9
10
  let tokenBundle = Bundle(for: MoMoUIKitsBundleToken.self)
10
- let frameworkBundle = Bundle(identifier: "org.cocoapods.MoMoUIKits")
11
11
  let candidates = [
12
12
  Bundle.main.resourceURL,
13
13
  tokenBundle.resourceURL,
14
- tokenBundle.bundleURL,
15
- frameworkBundle?.resourceURL,
16
- frameworkBundle?.bundleURL
14
+ tokenBundle.bundleURL
17
15
  ]
18
16
 
19
17
  for candidate in candidates {
@@ -1,11 +1,3 @@
1
- // File: ios/Extensions/SkeletonUICompat.swift
2
- // Created At: 2026-10-07 12:03:28 +07:00
3
- // Created By: AI
4
- // AI Agent: Claude Code
5
- // Model: claude-opus-5-5
6
-
7
- // AI-GENERATED START: keep SkeletonUI extensions visible to MoMoUIKits clients
8
1
  // Unused here on purpose: Swift 5 exposes extension members of every module a dependency imports, so clients
9
2
  // that only `import MoMoUIKits` rely on SkeletonUI's (e.g. `Text(String?)` in NativeWidget). Removing it breaks them.
10
3
  import SkeletonUI
11
- // AI-GENERATED END: keep SkeletonUI extensions visible to MoMoUIKits clients
@@ -16,12 +16,10 @@ let iconSources: [String: String] = {
16
16
  return kitIcons.merging(hostIcons.mapValues(\.uri)) { kit, _ in kit }
17
17
  }()
18
18
 
19
- // Compose defaults `color` to the theme text color while `color = null` means "no tint".
20
- // Swift can't tell an omitted argument from an explicit `nil`, so the default is this
21
- // unrepresentable sentinel: omitted -> theme text color, `nil` -> untinted.
19
+ // Compose defaults `color` to the theme text color, `null` meaning no tint. Swift can't tell an omitted argument
20
+ // from `nil`, so the default is this unrepresentable sentinel: omitted -> theme text color, `nil` -> untinted.
22
21
  public let iconThemeColor = Color(.sRGB, red: -1, green: -1, blue: -1, opacity: -1)
23
22
 
24
- // Icon ViewModel
25
23
  public struct Icon: View {
26
24
  @Environment(\.appTheme) private var theme
27
25
 
@@ -55,8 +53,7 @@ public struct Icon: View {
55
53
  .scaledToFit()
56
54
  .foregroundColor(resolvedColor)
57
55
  .frame(width: size, height: size)
58
- // Mirrors Compose's auto-generated `contentDescription = "img|$iconUrl"`
59
- // when no explicit label is provided.
56
+ // Compose's auto-generated `contentDescription = "img|$iconUrl"` when no label is given.
60
57
  .accessibilityLabel(accessibilityLabel ?? "img|\(uri)")
61
58
  } else {
62
59
  // Compose keeps the sized box for an unknown key, so layouts don't collapse.
@@ -8,7 +8,6 @@ public enum IconSize {
8
8
  case medium
9
9
  case small
10
10
 
11
- /// Container width/height of the button.
12
11
  var containerSize: CGFloat {
13
12
  switch self {
14
13
  case .large: return 48
@@ -17,7 +16,6 @@ public enum IconSize {
17
16
  }
18
17
  }
19
18
 
20
- /// Glyph size of the icon inside the button.
21
19
  var iconSize: CGFloat {
22
20
  switch self {
23
21
  case .large: return 24
@@ -120,9 +118,8 @@ public struct IconButton: View {
120
118
  }
121
119
  }
122
120
 
123
- /// Type-erased shape switch (`Circle` vs a fixed `Radius.S` rounded rect) — mirrors
124
- /// Compose's `IconShape.toShape()`. `AnyShape` needs iOS 17+, so this hand-rolls the same
125
- /// erasure at the deployment target's iOS 15 floor.
121
+ /// Compose's `IconShape.toShape()` (`Circle` or a `Radius.S` rounded rect), type-erased by hand: `AnyShape` needs
122
+ /// iOS 17+ and the pod supports iOS 15.
126
123
  private struct IconButtonShape: InsettableShape {
127
124
  let shape: IconShape
128
125
  var insetAmount: CGFloat = 0
@@ -1,10 +1,3 @@
1
- //
2
- // ErrorView.swift
3
- // Pods
4
- //
5
- // Created by sophia on 13/1/26.
6
- //
7
-
8
1
  import SwiftUI
9
2
 
10
3
  public struct ErrorView: View {
@@ -101,10 +101,8 @@ public struct Input: View {
101
101
  let textBinding = Binding<String>(
102
102
  get: { self.text },
103
103
  set: { newValue in
104
- // Trim atomically before publishing, mirroring Kotlin's `onValueChange`
105
- // (`newText.take(maxLength)` before the state ever updates) — avoids a
106
- // render with the untrimmed value that a separate `.onChange` correction
107
- // would otherwise briefly show.
104
+ // Trimmed before publishing, like Compose's `newText.take(maxLength)`: an `.onChange`
105
+ // correction would briefly render the untrimmed value.
108
106
  let limited = limitText(newValue)
109
107
  self.text = limited
110
108
  self.onChangeText?(limited)
@@ -112,15 +110,12 @@ public struct Input: View {
112
110
  )
113
111
 
114
112
  VStack(alignment: .leading, spacing: 0) {
115
- // Input container
116
113
  HStack(alignment: .center, spacing: 0) {
117
- // Leading icon
118
114
  if !leadingIcon.isEmpty {
119
115
  Icon(source: leadingIcon, size: size == .small ? 24 : 32, color: leadingIconColor ?? theme.colors.text.hint)
120
116
  .padding(.trailing, Spacing.M)
121
117
  }
122
118
 
123
- // Text input field
124
119
  ZStack(alignment: .leading) {
125
120
  if text.isEmpty {
126
121
  MomoText(
@@ -162,16 +157,12 @@ public struct Input: View {
162
157
  .onAppear {
163
158
  if autofocus { isFieldFocused = true }
164
159
  }
165
- // SwiftUI reads a TextField's UIKit input traits only when it
166
- // builds the backing UITextField, so a later `keyboardType`
167
- // change is silently dropped. The secure path can call
168
- // `reloadInputViews()` in `updateUIView`; here the only lever
169
- // is to force a rebuild.
160
+ // SwiftUI reads UIKit input traits only when it builds the UITextField, so a later
161
+ // `keyboardType` change is dropped; force a rebuild.
170
162
  .id(keyboardType.rawValue)
171
163
  }
172
164
  }
173
165
 
174
- // Clear button (only show when focused and has text)
175
166
  if isFocused && !text.isEmpty {
176
167
  SwiftUI.Button(action: {
177
168
  text = ""
@@ -183,7 +174,6 @@ public struct Input: View {
183
174
  .accessibilityIdentifier("ic_clear")
184
175
  }
185
176
 
186
- // Loading indicator
187
177
  if loading {
188
178
  ActivityIndicator(isAnimating: .constant(true), style: .medium, color: getRightIconColor())
189
179
  .frame(width: 16, height: 16)
@@ -220,7 +210,6 @@ public struct Input: View {
220
210
  )
221
211
  .overlay(alignment: .topLeading) { floatingLabel }
222
212
 
223
- // Error or hint
224
213
  ErrorView(
225
214
  errorMessage: error,
226
215
  errorSpacing: errorSpacing,
@@ -252,7 +241,9 @@ public struct Input: View {
252
241
  }
253
242
  .padding(.horizontal, Spacing.S)
254
243
  .background(theme.colors.background.surface)
255
- .alignmentGuide(.top) { $0[VerticalAlignment.center] }
244
+ // A zero-height frame on the top edge centers the label on the border, re-laid out with font scale.
245
+ .fixedSize(horizontal: false, vertical: true)
246
+ .frame(height: 0)
256
247
  .offset(x: Spacing.S)
257
248
  }
258
249
  }
@@ -407,10 +398,8 @@ private struct SecureInputField: UIViewRepresentable {
407
398
  self.parent = parent
408
399
  }
409
400
 
410
- // When a secure text field regains focus (or turns secure while editing),
411
- // iOS marks the existing text as "committed" and the next keystroke would
412
- // replace ALL of it. Re-inserting via insertText() puts it back into an
413
- // "active editing" state (and moves the caret to the end).
401
+ // A secure field regaining focus (or turning secure mid-edit) marks its text committed, so
402
+ // the next keystroke would replace all of it; re-inserting resumes editing, caret at the end.
414
403
  func reinsertText(in textField: UITextField) {
415
404
  let existingText = textField.text ?? ""
416
405
  guard !existingText.isEmpty else { return }
@@ -1,10 +1,3 @@
1
- //
2
- // InputPhoneNumber.swift
3
- // Pods
4
- //
5
- // Created by sophia on 20/10/25.
6
- //
7
-
8
1
  import SwiftUI
9
2
  public struct InputPhoneNumber: View {
10
3
  @Environment(\.appTheme) private var theme
@@ -18,13 +11,22 @@ public struct InputPhoneNumber: View {
18
11
  public var errorSpacing: Bool
19
12
  public var loading: Bool
20
13
  public var required: Bool
14
+ /// Deprecated: use `trailing`.
21
15
  public var rightIcon: String
16
+ /// Deprecated: use `trailingColor`.
22
17
  public var rightIconColor: Color?
18
+ /// Icon key or URL; wins over `rightIcon` when not empty.
19
+ public var trailing: String
20
+ /// Wins over `rightIconColor` when set.
21
+ public var trailingColor: Color?
23
22
  public var autofocus: Bool
24
23
  public var onChangeText: ((String) -> Void)?
25
24
  public var onFocus: (() -> Void)?
26
25
  public var onBlur: (() -> Void)?
26
+ /// Deprecated: use `onPressTrailing`.
27
27
  public var onRightIconPressed: (() -> Void)?
28
+ /// Wins over `onRightIconPressed` when set.
29
+ public var onPressTrailing: (() -> Void)?
28
30
  public var accessibilityLabel: String?
29
31
 
30
32
  @State private var isFocused: Bool = false
@@ -41,11 +43,14 @@ public struct InputPhoneNumber: View {
41
43
  required: Bool = false,
42
44
  rightIcon: String = "",
43
45
  rightIconColor: Color? = nil,
46
+ trailing: String = "",
47
+ trailingColor: Color? = nil,
44
48
  autofocus: Bool = false,
45
49
  onChangeText: ((String) -> Void)? = nil,
46
50
  onFocus: (() -> Void)? = nil,
47
51
  onBlur: (() -> Void)? = nil,
48
52
  onRightIconPressed: (() -> Void)? = nil,
53
+ onPressTrailing: (() -> Void)? = nil,
49
54
  accessibilityLabel: String? = nil
50
55
  ) {
51
56
  self._text = text
@@ -58,11 +63,14 @@ public struct InputPhoneNumber: View {
58
63
  self.required = required
59
64
  self.rightIcon = rightIcon
60
65
  self.rightIconColor = rightIconColor
66
+ self.trailing = trailing
67
+ self.trailingColor = trailingColor
61
68
  self.autofocus = autofocus
62
69
  self.onChangeText = onChangeText
63
70
  self.onFocus = onFocus
64
71
  self.onBlur = onBlur
65
72
  self.onRightIconPressed = onRightIconPressed
73
+ self.onPressTrailing = onPressTrailing
66
74
  self.accessibilityLabel = accessibilityLabel
67
75
  }
68
76
 
@@ -78,7 +86,6 @@ public struct InputPhoneNumber: View {
78
86
 
79
87
  VStack(alignment: .leading, spacing: 0) {
80
88
  HStack(spacing: 0) {
81
- // 🇻🇳 Flag
82
89
  ImageView("https://static.momocdn.net/app/img/icon/ic-qrcode-package/ic_vn_flag.png")
83
90
  .frame(width: 24, height: 24)
84
91
  .padding(.trailing, Spacing.XS)
@@ -90,7 +97,6 @@ public struct InputPhoneNumber: View {
90
97
  .frame(width: 1, height: size == .small ? 24 : 32)
91
98
  .padding(.horizontal, Spacing.M)
92
99
 
93
- // Text input
94
100
  ZStack(alignment: .leading) {
95
101
  if text.isEmpty {
96
102
  MomoText(
@@ -117,7 +123,6 @@ public struct InputPhoneNumber: View {
117
123
  .accessibilityValue(textBinding.wrappedValue.isEmpty ? placeholder : textBinding.wrappedValue)
118
124
  }
119
125
 
120
- // Clear button
121
126
  if isFocused && !text.isEmpty {
122
127
  SwiftUI.Button(action: {
123
128
  text = ""
@@ -129,16 +134,13 @@ public struct InputPhoneNumber: View {
129
134
  .accessibilityIdentifier("ic_clear")
130
135
  }
131
136
 
132
- // Loading indicator
137
+ // Spinner replaces the trailing icon while loading (RN RenderTrailing)
133
138
  if loading {
134
- ActivityIndicator(isAnimating: .constant(true), style: .medium, color: rightIconColor ?? theme.colors.text.default)
139
+ ActivityIndicator(isAnimating: .constant(true), style: .medium, color: trailingTint)
135
140
  .frame(width: 16, height: 16)
136
- }
137
-
138
- // ✅ Right icon
139
- if !rightIcon.isEmpty {
140
- SwiftUI.Button(action: { onRightIconPressed?() }) {
141
- Icon(source: rightIcon, size: 24, color: rightIconColor ?? theme.colors.text.default)
141
+ } else if !trailingIcon.isEmpty {
142
+ SwiftUI.Button(action: pressTrailing) {
143
+ Icon(source: trailingIcon, size: 24, color: trailingTint)
142
144
  .padding(.leading, Spacing.S)
143
145
  }
144
146
  }
@@ -154,7 +156,6 @@ public struct InputPhoneNumber: View {
154
156
  .stroke(borderColor(), lineWidth: isFocused ? 1.5 : 1)
155
157
  )
156
158
 
157
- // Error or hint
158
159
  ErrorView(
159
160
  errorMessage: error,
160
161
  errorSpacing: errorSpacing,
@@ -164,7 +165,23 @@ public struct InputPhoneNumber: View {
164
165
  }
165
166
 
166
167
  // MARK: - Helpers
167
-
168
+
169
+ private var trailingIcon: String {
170
+ return trailing.isEmpty ? rightIcon : trailing
171
+ }
172
+
173
+ private var trailingTint: Color {
174
+ return trailingColor ?? rightIconColor ?? theme.colors.text.default
175
+ }
176
+
177
+ private func pressTrailing() {
178
+ if let onPressTrailing {
179
+ onPressTrailing()
180
+ return
181
+ }
182
+ onRightIconPressed?()
183
+ }
184
+
168
185
  private func handleFocusChange(_ focused: Bool) {
169
186
  guard focused != isFocused else { return }
170
187
  isFocused = focused
@@ -1,11 +1,13 @@
1
- //
2
- // InputSearch.swift
3
- // Pods
4
- //
5
- // Created by dung.pham2 on 3/12/24.
6
- //
7
1
  import SwiftUI
8
2
 
3
+ /// Body searches keep 36 / 24; the header search matches the 32pt header buttons.
4
+ enum InputSearchSize {
5
+ case `default`, header
6
+
7
+ var height: CGFloat { self == .header ? HeaderLayoutMetrics.searchHeight : 36 }
8
+ var iconSize: CGFloat { self == .header ? HeaderLayoutMetrics.iconSize : 24 }
9
+ }
10
+
9
11
  // MARK: - RenderRightIconSearch
10
12
 
11
13
  struct RenderRightIconSearch: View {
@@ -13,6 +15,7 @@ struct RenderRightIconSearch: View {
13
15
  let loading: Bool
14
16
  let icon: String
15
17
  let color: Color
18
+ var size: InputSearchSize = .default
16
19
  let onClick: () -> Void
17
20
 
18
21
  var body: some View {
@@ -23,13 +26,13 @@ struct RenderRightIconSearch: View {
23
26
  .padding(.horizontal, Spacing.S)
24
27
  }
25
28
  if !icon.isEmpty {
26
- // Compose: a 1pt rule inset S from the top and bottom of the 36pt bar.
29
+ // Compose: a 1pt rule inset S from the top and bottom of the bar.
27
30
  Rectangle()
28
31
  .fill(theme.colors.primary)
29
- .frame(width: 1, height: 36 - Spacing.S * 2)
32
+ .frame(width: 1, height: size.height - Spacing.S * 2)
30
33
  .padding(.leading, Spacing.S)
31
34
 
32
- Icon(source: icon, size: 24, color: color)
35
+ Icon(source: icon, size: size.iconSize, color: color)
33
36
  .padding(.leading, Spacing.S)
34
37
  .onTapGesture(perform: onClick)
35
38
  }
@@ -143,6 +146,7 @@ public struct InputSearch: View {
143
146
  var clearCondition: (() -> Bool)? = nil
144
147
  var onClearPress: () -> Void = {}
145
148
  var onSubmit: () -> Void = {}
149
+ var size: InputSearchSize = .default
146
150
 
147
151
  @State private var isFocused = false
148
152
  @State private var isBlurred = false
@@ -232,7 +236,7 @@ public struct InputSearch: View {
232
236
  if let searchIcon = searchIcon {
233
237
  searchIcon()
234
238
  } else {
235
- Icon(source: "navigation_search", size: 24, color: theme.colors.text.hint)
239
+ Icon(source: "navigation_search", size: size.iconSize, color: theme.colors.text.hint)
236
240
  .padding(.trailing, Spacing.XS)
237
241
  }
238
242
 
@@ -281,11 +285,11 @@ public struct InputSearch: View {
281
285
  .padding(.leading, Spacing.XS)
282
286
  }
283
287
 
284
- RenderRightIconSearch(loading: loading, icon: icon, color: iconColor, onClick: onRightIconPressed)
288
+ RenderRightIconSearch(loading: loading, icon: icon, color: iconColor, size: size, onClick: onRightIconPressed)
285
289
  }
286
290
  .padding(.horizontal, Spacing.M)
287
291
  .frame(maxWidth: .infinity, alignment: .leading)
288
- .frame(height: 36)
292
+ .frame(height: size.height)
289
293
  .background(
290
294
  RoundedRectangle(cornerRadius: Radius.XL)
291
295
  .fill(backgroundColor ?? theme.colors.background.surface)
@@ -304,6 +308,13 @@ public struct InputSearch: View {
304
308
  }
305
309
  }
306
310
 
311
+ /// The header search: 32pt tall with a 20pt icon, level with the header buttons.
312
+ func headerSize() -> InputSearch {
313
+ var copy = self
314
+ copy.size = .header
315
+ return copy
316
+ }
317
+
307
318
  // MARK: - Helper Functions
308
319
 
309
320
  func getBorderColor(isFocused: Bool, error: String, disabled: Bool) -> Color {
@@ -1,12 +1,5 @@
1
- //
2
- // InputTextArea.swift
3
- // Pods
4
- //
5
- // Created by dung.pham2 on 2/12/24.
6
- //
7
1
  import SwiftUI
8
2
 
9
- // Make these constants public
10
3
  public let MAX_LENGTH = 300
11
4
  public let DEFAULT_HEIGHT: CGFloat = 104
12
5
 
@@ -92,7 +85,6 @@ struct UITextViewWrapper: UIViewRepresentable {
92
85
  }
93
86
  }
94
87
 
95
- // Make the struct public
96
88
  public struct InputTextArea: View {
97
89
  @Environment(\.appTheme) private var theme
98
90
  @Environment(\.momoFontScale) private var fontScale
@@ -120,7 +112,6 @@ public struct InputTextArea: View {
120
112
 
121
113
  @State private var isFocused = false
122
114
 
123
- // Make the initializer public
124
115
  public init(
125
116
  text: Binding<String>,
126
117
  maxLength: Int = MAX_LENGTH,
@@ -204,7 +195,6 @@ public struct InputTextArea: View {
204
195
  }
205
196
  .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
206
197
 
207
- // Clear button (mirrors Compose: focused + non-empty).
208
198
  if isFocused && !text.isEmpty {
209
199
  SwiftUI.Button(action: {
210
200
  text = ""
@@ -215,8 +205,7 @@ public struct InputTextArea: View {
215
205
  .padding(.leading, Spacing.XS)
216
206
  }
217
207
 
218
- // Loading indicator and right icon (independent, mirrors
219
- // Compose's RenderRightIcon: both can render at once).
208
+ // Not if/else: Compose's RenderRightIcon can show the spinner and the icon together.
220
209
  if loading {
221
210
  ActivityIndicator(isAnimating: .constant(true), style: .medium, color: iconTintColor)
222
211
  .frame(width: 16, height: 16)
@@ -279,7 +268,9 @@ public struct InputTextArea: View {
279
268
  }
280
269
  .padding(.horizontal, Spacing.S)
281
270
  .background(theme.colors.background.surface)
282
- .alignmentGuide(.top) { $0[VerticalAlignment.center] }
271
+ // A zero-height frame on the top edge centers the label on the border, re-laid out with font scale.
272
+ .fixedSize(horizontal: false, vertical: true)
273
+ .frame(height: 0)
283
274
  .offset(x: Spacing.S)
284
275
  }
285
276
  }