@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
@@ -66,6 +66,10 @@ private fun getBorderColor(isFocused: Boolean, error: String): Color {
66
66
  }
67
67
  }
68
68
 
69
+ /**
70
+ * [icon], [iconColor] and [onRightIconPressed] are deprecated aliases of [trailing] (icon key or URL),
71
+ * [trailingColor] and [onPressTrailing]; the new param wins when set ([trailing] when not empty).
72
+ */
69
73
  @Composable
70
74
  fun InputPhoneNumber(
71
75
  text: MutableState<String> = remember { mutableStateOf("") },
@@ -81,20 +85,21 @@ fun InputPhoneNumber(
81
85
  onFocus: () -> Unit = {},
82
86
  onBlur: () -> Unit = {},
83
87
  loading: Boolean = false,
88
+ trailing: String = "",
89
+ trailingColor: Color? = null,
90
+ onPressTrailing: (() -> Unit)? = null,
84
91
  modifier: Modifier = Modifier,
85
92
  inputModifier: Modifier = Modifier,
86
93
  ) {
87
- // Consolidated state management
88
94
  var inputState by remember { mutableStateOf(InputState()) }
89
95
 
90
- // Memoized color calculations
91
96
  val theme = AppTheme.current
92
- val colors = remember(theme, iconColor) {
93
- Triple(
94
- theme.colors.text.default, // textColor
95
- theme.colors.text.hint, // placeholderColor
96
- iconColor // iconTintColor
97
- )
97
+ val colors = remember(theme, iconColor, trailingColor) {
98
+ Triple(
99
+ theme.colors.text.default,
100
+ theme.colors.text.hint,
101
+ trailingColor ?: iconColor
102
+ )
98
103
  }
99
104
 
100
105
  val (textColor, placeholderColor, iconTintColor) = colors
@@ -153,7 +158,6 @@ fun InputPhoneNumber(
153
158
  modifier = Modifier.padding(horizontal = Spacing.M),
154
159
  verticalAlignment = Alignment.CenterVertically
155
160
  ) {
156
- // Leading icon
157
161
  Image(
158
162
  source = "https://static.momocdn.net/app/img/icon/ic-qrcode-package/ic_vn_flag.png",
159
163
  modifier = Modifier.size(24.dp).padding(end = Spacing.XS),
@@ -211,13 +215,14 @@ fun InputPhoneNumber(
211
215
  }
212
216
  }
213
217
 
214
- // Right icon (password toggle or custom icon)
215
- RenderRightIcon(loading, icon, iconTintColor, onRightIconPressed)
218
+ // Spinner replaces the trailing icon while loading (RN RenderTrailing)
219
+ val trailingIcon = if (loading) "" else trailing.ifEmpty { icon }
220
+ val onTrailingPress = onPressTrailing ?: onRightIconPressed
221
+ RenderRightIcon(loading, trailingIcon, iconTintColor, onTrailingPress)
216
222
  }
217
223
  }
218
224
  },
219
225
  )
220
- // Error/hint display
221
226
  ErrorView(error, errorSpacing, hintText)
222
227
  }
223
228
  }
@@ -45,16 +45,25 @@ import vn.momo.kits.application.IsShowBaseLineDebug
45
45
  import vn.momo.kits.const.Typography
46
46
  import vn.momo.kits.const.getFontFamily
47
47
  import vn.momo.kits.const.scaleSize
48
+ import vn.momo.kits.layout.HEADER_ICON_SIZE
49
+ import vn.momo.kits.layout.HEADER_SEARCH_HEIGHT
48
50
  import vn.momo.kits.modifier.conditional
49
51
  import vn.momo.kits.utils.ifTrue
50
52
 
53
+ // Body searches keep 36 / 24; the header search matches the 32pt header buttons.
54
+ internal enum class InputSearchSize(val height: Dp, val iconSize: Dp) {
55
+ Default(36.dp, 24.dp),
56
+ Header(HEADER_SEARCH_HEIGHT, HEADER_ICON_SIZE),
57
+ }
58
+
51
59
  @Composable
52
60
  internal fun RenderRightIconSearch(
53
61
  loading: Boolean,
54
62
  icon: String,
55
63
  color: Color?,
56
64
  onClick: () -> Unit,
57
- iconModifier: Modifier = Modifier
65
+ iconModifier: Modifier = Modifier,
66
+ iconSize: Dp = InputSearchSize.Default.iconSize,
58
67
  ) {
59
68
  if (loading) {
60
69
  Box(Modifier.padding(horizontal = Spacing.S)) {
@@ -74,7 +83,7 @@ internal fun RenderRightIconSearch(
74
83
  Icon(
75
84
  source = icon,
76
85
  color = color,
77
- size = 24.dp,
86
+ size = iconSize,
78
87
  modifier = iconModifier.padding(start = Spacing.S, end = 0.dp).clickable(
79
88
  onClick = onClick,
80
89
  interactionSource = remember { MutableInteractionSource() },
@@ -119,6 +128,11 @@ fun InputSearch(
119
128
  text = remember { mutableStateOf("") },
120
129
  ),
121
130
  ) {
131
+ InputSearch(inputSearchProps, InputSearchSize.Default)
132
+ }
133
+
134
+ @Composable
135
+ internal fun InputSearch(inputSearchProps: InputSearchProps, size: InputSearchSize) {
122
136
  var isFocused by remember { mutableStateOf(false) }
123
137
  val disabledColor = AppTheme.current.colors.text.disable
124
138
  var textColor = AppTheme.current.colors.text.default
@@ -156,7 +170,7 @@ fun InputSearch(
156
170
  Row(
157
171
  verticalAlignment = Alignment.CenterVertically, modifier = Modifier
158
172
  .fillMaxWidth()
159
- .height(36.dp)
173
+ .height(size.height)
160
174
  .conditional(IsShowBaseLineDebug) {
161
175
  border(1.dp, Colors.blue_03)
162
176
  }
@@ -203,7 +217,7 @@ fun InputSearch(
203
217
  inputSearchProps.searchIcon?.invoke() ?: Icon(
204
218
  source = "navigation_search",
205
219
  modifier = Modifier.padding(end = Spacing.XS),
206
- size = 24.dp,
220
+ size = size.iconSize,
207
221
  color = AppTheme.current.colors.text.hint
208
222
  )
209
223
  Box(Modifier.weight(1f)) {
@@ -242,7 +256,8 @@ fun InputSearch(
242
256
  inputSearchProps.icon,
243
257
  iconTintColor,
244
258
  inputSearchProps.onRightIconPressed,
245
- iconModifier = inputSearchProps.iconModifier
259
+ iconModifier = inputSearchProps.iconModifier,
260
+ iconSize = size.iconSize,
246
261
  )
247
262
  }
248
263
  }
@@ -57,8 +57,8 @@ fun InputTextArea(
57
57
  keyboardType: KeyboardType = KeyboardType.Text,
58
58
  ) {
59
59
  var isFocused by remember { mutableStateOf(false) }
60
- val (textColor, placeholderColor, iconTintColor, floatingTitleColor, floatingIconTintColor) =
61
- getInputColors(disabled, iconColor, floatingValueColor, floatingIconColor)
60
+ val colors = getInputColors(disabled, iconColor, floatingValueColor, floatingIconColor)
61
+ val (textColor, placeholderColor, iconTintColor, floatingTitleColor, floatingIconTintColor) = colors
62
62
 
63
63
  val fontSize = 16.sp
64
64
  val lineHeight = 24.sp
@@ -95,7 +95,6 @@ fun InputTextArea(
95
95
  }
96
96
  },
97
97
  decorationBox = { innerTextField ->
98
- // Floating Icon
99
98
  FloatingLabel(
100
99
  floatingValue = floatingValue,
101
100
  floatingIcon = floatingIcon,
@@ -104,7 +103,7 @@ fun InputTextArea(
104
103
  offsetY = -scaleHeight / 2,
105
104
  required = required,
106
105
  )
107
- //input box wrapper
106
+ // Input container
108
107
  Box(
109
108
  modifier = Modifier.fillMaxWidth()
110
109
  .background(
@@ -179,7 +178,6 @@ fun InputTextArea(
179
178
  }
180
179
  },
181
180
  )
182
- // show error
183
181
  ErrorView(error, errorSpacing, "")
184
182
  }
185
183
  }
@@ -98,16 +98,15 @@ fun LazyColumnWithBouncing(
98
98
  }.collect()
99
99
  }
100
100
 
101
- val measureLayout =
102
- remember<MeasureScope.(Measurable, Constraints) -> MeasureResult>(maxConstraint) {
103
- { m, c ->
104
- val p = m.measure(c.copy(minHeight = 0))
105
- maxConstraint.value = c.maxHeight
106
- layout(p.width, p.height) {
107
- p.place(IntOffset.Zero)
108
- }
101
+ val measureLayout = remember<MeasureScope.(Measurable, Constraints) -> MeasureResult>(maxConstraint) {
102
+ { m, c ->
103
+ val p = m.measure(c.copy(minHeight = 0))
104
+ maxConstraint.value = c.maxHeight
105
+ layout(p.width, p.height) {
106
+ p.place(IntOffset.Zero)
109
107
  }
110
108
  }
109
+ }
111
110
 
112
111
  if (getPlatformName() == "iOS") {
113
112
 
@@ -8,7 +8,6 @@ import androidx.compose.foundation.shape.RoundedCornerShape
8
8
  import androidx.compose.runtime.Composable
9
9
  import androidx.compose.ui.Alignment
10
10
  import androidx.compose.ui.Modifier
11
- import androidx.compose.ui.graphics.Color
12
11
  import androidx.compose.ui.unit.dp
13
12
  import vn.momo.kits.application.IsShowBaseLineDebug
14
13
  import vn.momo.kits.const.Colors
@@ -23,7 +22,7 @@ fun PaginationNumber(
23
22
  ) {
24
23
  BoxWithConstraints(
25
24
  modifier = Modifier.background(
26
- color = Color(0x33000000),
25
+ color = Colors.opacity_black_20,
27
26
  shape = RoundedCornerShape(Spacing.L)
28
27
  )
29
28
  .conditional(IsShowBaseLineDebug) {
@@ -38,14 +38,12 @@ fun PaginationScroll(
38
38
  val scrollState = rememberScrollState()
39
39
  val theme = AppTheme.current
40
40
 
41
- // Use derivedStateOf to optimize scroll position calculations
42
41
  val indicatorOffset by remember {
43
42
  derivedStateOf {
44
43
  calculateOffset(scrollState.value, scrollState.maxValue)
45
44
  }
46
45
  }
47
46
 
48
- // Cache theme colors to avoid repeated access
49
47
  val (progressBackground, indicatorColor) = remember(theme) {
50
48
  theme.colors.background.pressed to theme.colors.primary
51
49
  }
@@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.padding
7
7
  import androidx.compose.foundation.shape.RoundedCornerShape
8
8
  import androidx.compose.runtime.Composable
9
9
  import androidx.compose.ui.Modifier
10
- import androidx.compose.ui.graphics.Color
11
10
  import androidx.compose.ui.unit.dp
12
11
  import vn.momo.kits.application.IsShowBaseLineDebug
13
12
  import vn.momo.kits.const.Colors
@@ -21,7 +20,7 @@ fun PaginationWhiteDot(
21
20
  ) {
22
21
  Row(
23
22
  modifier = Modifier.background(
24
- color = Color(0x33000000),
23
+ color = Colors.opacity_black_20,
25
24
  shape = RoundedCornerShape(Spacing.S)
26
25
  )
27
26
  .conditional(IsShowBaseLineDebug) {
@@ -2,8 +2,6 @@ package vn.momo.kits.components
2
2
 
3
3
  import androidx.compose.foundation.background
4
4
  import androidx.compose.foundation.border
5
- import androidx.compose.foundation.clickable
6
- import androidx.compose.foundation.interaction.MutableInteractionSource
7
5
  import androidx.compose.foundation.rememberScrollState
8
6
  import androidx.compose.foundation.verticalScroll
9
7
  import androidx.compose.foundation.layout.*
@@ -22,7 +20,9 @@ import vn.momo.kits.application.LocalLocalize
22
20
  import vn.momo.kits.const.*
23
21
  import vn.momo.kits.modifier.conditional
24
22
  import vn.momo.kits.modifier.setAutomationId
25
- import vn.momo.kits.layout.getScreenLayout
23
+ import vn.momo.kits.layout.MODAL_ICON_BUTTON_SIZE
24
+ import vn.momo.kits.layout.ModalIconButton
25
+ import vn.momo.kits.layout.rememberModalLayout
26
26
  import kotlin.math.min
27
27
 
28
28
  data class PopupAction(
@@ -36,21 +36,23 @@ enum class PopupActionDirection {
36
36
  AUTO
37
37
  }
38
38
 
39
- // Width of a system alert on the iPhone Duo inner display, in both orientations (RN Popup/utils.ts).
40
- private val DUO_POPUP_MAX_WIDTH = 440.dp
39
+ // Card width on foldables (ModalLayout, RN Popup/utils.ts); unbounded on phones, where each popup's padding sets it.
40
+ @Composable
41
+ internal fun popupMaxWidth(): Dp {
42
+ val modal = rememberModalLayout()
43
+ return if (modal.isFoldable) modal.popup.maxWidth else Dp.Unspecified
44
+ }
41
45
 
42
- // Card width cap plus the popup's own side padding; unbounded off iPhone Duo.
46
+ // The placement already keeps foldable popups off the edges, so their own side padding goes.
43
47
  @Composable
44
- internal fun popupMaxWidth(horizontalPadding: Dp): Dp =
45
- if (getScreenLayout().isIPhoneDuoDevice) DUO_POPUP_MAX_WIDTH + horizontalPadding * 2 else Dp.Unspecified
48
+ internal fun popupHorizontalPadding(padding: Dp): Dp = if (rememberModalLayout().isFoldable) 0.dp else padding
46
49
 
47
- // Room left for a popup on iPhone Duo, where landscape is too short for it; null elsewhere.
50
+ // Tallest a popup gets on foldables; null on phones.
48
51
  @Composable
49
- internal fun popupMaxHeight(): Dp? {
50
- val layout = getScreenLayout()
51
- if (!layout.isIPhoneDuoDevice) return null
52
- return layout.height - layout.duoTopInset - layout.insetBottom - Spacing.XL * 2
53
- }
52
+ internal fun popupMaxHeight(): Dp? = rememberModalLayout().popup.maxHeight
53
+
54
+ @Composable
55
+ internal fun popupRadius(): Dp = rememberModalLayout().popup.radius
54
56
 
55
57
  private fun heightForLines(
56
58
  layout: TextLayoutResult,
@@ -84,6 +86,7 @@ data class PopupNotifyProps(
84
86
  val buttonDirection: PopupActionDirection = PopupActionDirection.ROW,
85
87
  val onIconClose: () -> Unit,
86
88
  val isShowCloseIcon: Boolean = true,
89
+ val highlightText: List<String> = emptyList(),
87
90
  )
88
91
 
89
92
  @Composable
@@ -95,6 +98,7 @@ fun PopupNotify(
95
98
 
96
99
  val density = LocalDensity.current
97
100
  var scrollHeight: Dp by remember { mutableStateOf(0.dp) }
101
+ val description = rememberHighlightedText(props.description, props.highlightText)
98
102
 
99
103
  LaunchedEffect(layoutResult.value) {
100
104
  if ((layoutResult.value?.lineCount ?: 0) > 3) {
@@ -120,7 +124,7 @@ fun PopupNotify(
120
124
  ) {
121
125
  item {
122
126
  Text(
123
- text = props.description,
127
+ text = description,
124
128
  onTextLayout = { layoutResult.value = it },
125
129
  style = Typography.bodyDefaultRegular
126
130
  )
@@ -131,7 +135,7 @@ fun PopupNotify(
131
135
  { modifier ->
132
136
  Box(modifier = modifier) {
133
137
  Text(
134
- text = props.description,
138
+ text = description,
135
139
  onTextLayout = { layoutResult.value = it },
136
140
  style = Typography.bodyDefaultRegular
137
141
  )
@@ -143,22 +147,23 @@ fun PopupNotify(
143
147
  callback?.invoke()
144
148
  }
145
149
 
146
- val maxHeight = popupMaxHeight()
147
- val bodyScrollState = rememberScrollState()
150
+ val popup = rememberModalLayout().popup
151
+ val maxHeight = popup.maxHeight
152
+ val descriptionScrollState = rememberScrollState()
153
+ val shape = RoundedCornerShape(popup.radius)
148
154
 
149
155
  Box(
150
- Modifier.setAutomationId("popup_notify"), contentAlignment = Alignment.TopEnd
156
+ Modifier
157
+ .widthIn(min = popup.minWidth, max = popup.maxWidth)
158
+ .fillMaxWidth()
159
+ .setAutomationId("popup_notify"),
160
+ contentAlignment = Alignment.TopEnd
151
161
  ) {
152
162
  Column(
153
163
  modifier = Modifier
154
- .widthIn(max = popupMaxWidth(horizontalPadding = 12.dp))
155
164
  .fillMaxWidth()
156
- .padding(horizontal = 12.dp)
157
- .clip(RoundedCornerShape(Radius.L))
158
- .background(
159
- AppTheme.current.colors.background.surface,
160
- RoundedCornerShape(Radius.L)
161
- )
165
+ .clip(shape)
166
+ .background(AppTheme.current.colors.background.surface, shape)
162
167
  .conditional(IsShowBaseLineDebug) {
163
168
  border(1.dp, Colors.blue_03)
164
169
  }
@@ -166,37 +171,56 @@ fun PopupNotify(
166
171
  heightIn(max = maxHeight ?: Dp.Unspecified)
167
172
  }
168
173
  ) {
169
- // scrolls when iPhone Duo landscape is too short; actions stay visible
174
+ if(props.image.isNotEmpty()) {
175
+ Image(
176
+ source = props.image,
177
+ modifier = Modifier.fillMaxWidth().aspectRatio(1.777f),
178
+ options = Options(alignment = Alignment.Center)
179
+ )
180
+ }
181
+
182
+ // with a max height only the description scrolls; image, title and actions stay
170
183
  Column(
171
- Modifier.conditional(maxHeight != null) {
172
- weight(1f, fill = false).verticalScroll(bodyScrollState)
173
- }
184
+ modifier = Modifier
185
+ .conditional(maxHeight != null) { weight(1f, fill = false) }
186
+ .padding(Spacing.XL)
174
187
  ) {
175
- if(props.image.isNotEmpty()) {
176
- Image(
177
- source = props.image,
178
- modifier = Modifier.fillMaxWidth().aspectRatio(1.777f),
179
- options = Options(alignment = Alignment.Center)
180
- )
181
- }
182
-
183
- Column(modifier = Modifier.padding(Spacing.XL)) {
184
- Text(
185
- style = Typography.headerDefaultBold,
186
- maxLines = 2,
187
- text = props.title,
188
- modifier = Modifier.setAutomationId("title_popup_permission")
189
- )
190
- content(Modifier.padding(top = Spacing.S))
191
- if (props.error.isNotEmpty()) {
188
+ Text(
189
+ style = Typography.headerDefaultBold,
190
+ maxLines = 2,
191
+ text = props.title,
192
+ modifier = Modifier
193
+ .conditional(props.isShowCloseIcon && props.image.isEmpty()) {
194
+ padding(end = MODAL_ICON_BUTTON_SIZE + Spacing.M - Spacing.XL)
195
+ }
196
+ .setAutomationId("title_popup_permission")
197
+ )
198
+ if (maxHeight != null) {
199
+ // still capped at ~8.5 lines, then shrinks further when the popup reaches its max height
200
+ Box(
201
+ Modifier
202
+ .padding(top = Spacing.S)
203
+ .weight(1f, fill = false)
204
+ .conditional(isScroll) { heightIn(max = scrollHeight) }
205
+ .verticalScroll(descriptionScrollState)
206
+ ) {
192
207
  Text(
193
- text = LocalLocalize.current.translate("errorCode") + props.error,
194
- style = Typography.descriptionXsRegular,
195
- color = AppTheme.current.colors.text.hint,
196
- maxLines = 1,
197
- modifier = Modifier.padding(top = Spacing.S)
208
+ text = description,
209
+ onTextLayout = { layoutResult.value = it },
210
+ style = Typography.bodyDefaultRegular
198
211
  )
199
212
  }
213
+ } else {
214
+ content(Modifier.padding(top = Spacing.S))
215
+ }
216
+ if (props.error.isNotEmpty()) {
217
+ Text(
218
+ text = LocalLocalize.current.translate("errorCode") + props.error,
219
+ style = Typography.descriptionXsRegular,
220
+ color = AppTheme.current.colors.text.hint,
221
+ maxLines = 1,
222
+ modifier = Modifier.padding(top = Spacing.S)
223
+ )
200
224
  }
201
225
  }
202
226
 
@@ -210,36 +234,13 @@ fun PopupNotify(
210
234
  }
211
235
  }
212
236
 
213
- if(props.isShowCloseIcon) {
214
- Box(
215
- Modifier
216
- .width(22.dp)
217
- .height(22.dp)
218
- .offset(x = -(1).dp, y = (-11).dp)
219
- .background(
220
- color = AppTheme.current.colors.text.default,
221
- shape = RoundedCornerShape(Radius.M)
222
- )
223
- .border(
224
- width = 2.dp,
225
- color = AppTheme.current.colors.background.surface,
226
- shape = RoundedCornerShape(Radius.M)
227
- )
228
- .clip(RoundedCornerShape(100))
229
- .clickable(
230
- interactionSource = remember { MutableInteractionSource() },
231
- indication = null,
232
- onClick = { onClose { props.onIconClose() } }
233
- ),
234
- contentAlignment = Alignment.Center
235
- ) {
236
- Icon(
237
- source = "navigation_close",
238
- color = AppTheme.current.colors.background.surface,
239
- size = 16.dp,
240
- modifier = Modifier.setAutomationId("ic_popup_close")
241
- )
242
- }
237
+ if (props.isShowCloseIcon) {
238
+ ModalIconButton(
239
+ icon = "navigation_close",
240
+ automationId = "ic_popup_close",
241
+ onClick = { onClose { props.onIconClose() } },
242
+ modifier = Modifier.padding(top = Spacing.M, end = Spacing.M),
243
+ )
243
244
  }
244
245
  }
245
246
  }
@@ -32,15 +32,15 @@ fun PopupPromotion(
32
32
  onClose: (() -> Unit) = {},
33
33
  ) {
34
34
  val maxHeight = popupMaxHeight()
35
- var maxWidth = popupMaxWidth(horizontalPadding = Spacing.M)
35
+ var maxWidth = popupMaxWidth()
36
36
  if (maxHeight != null) {
37
37
  // fit the portrait image by height when iPhone Duo leaves too little room
38
- maxWidth = minOf(maxWidth, (maxHeight - CLOSE_ROW_HEIGHT) * ASPECT_RATIO + Spacing.M * 2)
38
+ maxWidth = minOf(maxWidth, (maxHeight - CLOSE_ROW_HEIGHT) * ASPECT_RATIO)
39
39
  }
40
40
 
41
41
  Column(Modifier
42
42
  .widthIn(max = maxWidth)
43
- .padding(horizontal = Spacing.M)
43
+ .padding(horizontal = popupHorizontalPadding(Spacing.M))
44
44
  .conditional(IsShowBaseLineDebug) {
45
45
  border(1.dp, Colors.blue_03)
46
46
  }
@@ -103,15 +103,12 @@ private fun ProgressInfoHorizontal(
103
103
  ProgressInfoAlign.Center -> TextAlign.Center
104
104
  }
105
105
 
106
- val endPadding = if (!isLast &&
107
- align != ProgressInfoAlign.Center &&
108
- align != ProgressInfoAlign.Stretch
109
- ) Spacing.XS else 0.dp
106
+ val isSideAligned = align != ProgressInfoAlign.Center && align != ProgressInfoAlign.Stretch
107
+ val endPadding = if (!isLast && isSideAligned) Spacing.XS else 0.dp
110
108
 
111
- val hideLineLeft = align == ProgressInfoAlign.Left ||
112
- (align == ProgressInfoAlign.Stretch && isFirst)
113
- val hideLineRight = align == ProgressInfoAlign.Right ||
114
- (align == ProgressInfoAlign.Stretch && isLast)
109
+ val isStretch = align == ProgressInfoAlign.Stretch
110
+ val hideLineLeft = align == ProgressInfoAlign.Left || (isStretch && isFirst)
111
+ val hideLineRight = align == ProgressInfoAlign.Right || (isStretch && isLast)
115
112
 
116
113
  Column(
117
114
  modifier = Modifier
@@ -186,8 +183,7 @@ private fun ProgressInfoVertical(
186
183
  steps.forEachIndexed { index, item ->
187
184
  val isLast = index == steps.lastIndex
188
185
 
189
- // Intrinsic height lets the connector fill the row in one pass; measuring the row and
190
- // feeding it back lagged a frame and never let the line shrink with its text.
186
+ // Intrinsic height lets the connector fill the row in one pass and shrink with its text.
191
187
  Row(
192
188
  modifier = Modifier
193
189
  .fillMaxWidth()
@@ -2,20 +2,20 @@ package vn.momo.kits.components
2
2
 
3
3
  import androidx.compose.runtime.Composable
4
4
  import androidx.compose.runtime.CompositionLocalProvider
5
- import vn.momo.kits.application.ScaleSizeMaxRate
5
+ import androidx.compose.runtime.remember
6
+ import vn.momo.kits.application.LocalContext
7
+ import vn.momo.kits.application.MiniAppContext
6
8
 
7
- @Deprecated(
8
- "Max font scale is fixed at MAX_FONT_SCALE (1.5); this override is no longer applied. Remove the wrapper.",
9
- ReplaceWith("content()"),
10
- )
9
+ // Caps scaleSize() for the subtree at size × scaleSizeMaxRate through MiniAppContext.scaleSizeMaxRate
10
+ // (RN ScaleSizeProvider); the nearest scope wins and null lifts the cap.
11
11
  @Composable
12
12
  fun ScaleSizeScope(
13
13
  scaleSizeMaxRate: Float? = null,
14
14
  content: @Composable () -> Unit
15
15
  ) {
16
- CompositionLocalProvider(
17
- ScaleSizeMaxRate provides scaleSizeMaxRate,
18
- ) {
19
- content()
16
+ val context = LocalContext.current
17
+ val scoped = remember(context, scaleSizeMaxRate) {
18
+ (context ?: MiniAppContext()).copy(scaleSizeMaxRate = scaleSizeMaxRate)
20
19
  }
20
+ CompositionLocalProvider(LocalContext provides scoped, content = content)
21
21
  }
@@ -51,7 +51,6 @@ fun Modifier.shimmerLoadingAnimation(
51
51
  angleOfAxisY: Float = 0f,
52
52
  durationMillis: Int = DEFAULT_DURATION_MILLIS,
53
53
  ): Modifier {
54
- // Memoize calculations to avoid repeated computations
55
54
  val widthOfShadowBrush = remember(maxWidth) {
56
55
  (maxWidth * SHADOW_BRUSH_PERCENTAGE).toInt()
57
56
  }
@@ -75,7 +74,6 @@ fun Modifier.shimmerLoadingAnimation(
75
74
  )
76
75
 
77
76
  return drawBehind {
78
- // Memoize brush creation by using remember in the calling composable
79
77
  val startX = translateAnimation.value - widthOfShadowBrush
80
78
  val endX = translateAnimation.value
81
79