@momo-kits/native-kits 0.168.1-beta.3 → 0.168.1-beta.30-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 (176) hide show
  1. package/CLAUDE.md +14 -10
  2. package/README.md +2 -10
  3. package/build.gradle.kts +11 -0
  4. package/compose/build.gradle.kts +198 -0
  5. package/compose/build.gradle.kts.backup +198 -0
  6. package/compose/compose.podspec +47 -0
  7. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +20 -0
  8. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
  9. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +12 -0
  10. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
  11. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +153 -0
  12. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +6 -0
  13. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +110 -0
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +62 -0
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +1071 -0
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +56 -0
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +81 -0
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +338 -0
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +175 -0
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +357 -0
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +115 -0
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +89 -0
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +128 -0
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +209 -0
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +542 -0
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +49 -0
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +86 -0
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +125 -0
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +231 -0
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +189 -0
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +478 -0
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +114 -0
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +265 -0
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +235 -0
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +223 -0
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +265 -0
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +185 -0
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +343 -0
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +41 -0
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +84 -0
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +40 -0
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +370 -0
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +108 -0
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +308 -0
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +59 -0
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +21 -0
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +90 -0
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +330 -0
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +220 -0
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +473 -0
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +122 -0
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +207 -0
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +92 -0
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +560 -0
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +86 -0
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +125 -0
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +207 -0
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +501 -0
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +176 -0
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +182 -0
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +193 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +236 -0
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +180 -0
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +325 -0
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +17 -0
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +16 -0
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +194 -0
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +287 -0
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +54 -0
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +50 -0
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +321 -0
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +41 -0
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +52 -0
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +66 -0
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +104 -0
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +48 -0
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +502 -0
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +58 -0
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +148 -0
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +116 -0
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +205 -0
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +422 -0
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +732 -0
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +148 -0
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +35 -0
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +224 -0
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +383 -0
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +94 -0
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +97 -0
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +203 -0
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +106 -0
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +169 -0
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +455 -0
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +105 -0
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +106 -0
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +74 -0
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +399 -0
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +39 -0
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +363 -0
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +192 -0
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +133 -0
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +127 -0
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +12 -0
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +91 -0
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +9 -0
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +74 -0
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +20 -0
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +55 -0
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +15 -0
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +118 -0
  123. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +42 -0
  124. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +45 -0
  125. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +32 -0
  126. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +38 -0
  127. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +66 -0
  128. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +218 -0
  129. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +138 -0
  130. package/gradle/libs.versions.toml +69 -0
  131. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  132. package/gradle/wrapper/gradle-wrapper.properties +8 -0
  133. package/gradle.properties +26 -0
  134. package/gradlew +252 -0
  135. package/gradlew.bat +94 -0
  136. package/ios/Application/ApplicationEnvironment.swift +7 -6
  137. package/ios/Application/DesignSystemKits.swift +163 -0
  138. package/ios/Application/DesignSystemKitsPayload.swift +68 -0
  139. package/ios/Badge/BadgeRibbon.swift +8 -1
  140. package/ios/Extensions/Color++.swift +2 -4
  141. package/ios/Input/Input.swift +13 -3
  142. package/ios/Input/InputPhoneNumber.swift +1 -3
  143. package/ios/Input/InputSearch.swift +1 -2
  144. package/ios/Input/InputTextArea.swift +5 -3
  145. package/ios/InputMoney/InputMoney.swift +6 -7
  146. package/ios/Layout/ScreenLayout.swift +65 -10
  147. package/ios/Navigation/BottomSheet.swift +152 -21
  148. package/ios/Navigation/BottomTab/BottomTab.swift +12 -18
  149. package/ios/Navigation/BottomTab/BottomTabBar.swift +255 -114
  150. package/ios/Navigation/BottomTab/CurvedContainer.swift +51 -47
  151. package/ios/Navigation/BottomTab/DuoBarCompression.swift +2 -3
  152. package/ios/Navigation/BottomTab/DuoTabBar.swift +63 -172
  153. package/ios/Navigation/BottomTab/TabBarMetrics.swift +88 -0
  154. package/ios/Navigation/Component/HeaderBackground.swift +22 -1
  155. package/ios/Navigation/Component/SnackBar.swift +4 -0
  156. package/ios/Navigation/ModalScreen.swift +7 -3
  157. package/ios/Navigation/StackScreen.swift +6 -8
  158. package/ios/Popup/PopupDisplay.swift +2 -2
  159. package/ios/Popup/PopupInput.swift +2 -2
  160. package/ios/Popup/PopupLayout.swift +15 -10
  161. package/ios/Popup/PopupNotify.swift +2 -2
  162. package/ios/Stepper/Stepper.swift +1 -2
  163. package/ios/Template/TrustBanner/TrustBanner.swift +4 -2
  164. package/ios/Typography/FontScale.swift +29 -15
  165. package/ios/Typography/Text.swift +86 -12
  166. package/ios/Typography/Typography.swift +2 -2
  167. package/ios/native-kits.podspec +1 -1
  168. package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
  169. package/ios-demo/README.md +120 -0
  170. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +224 -59
  171. package/local.properties +9 -0
  172. package/package.json +1 -1
  173. package/publish.sh +2 -7
  174. package/settings.gradle.kts +64 -0
  175. package/ios/Typography/FontScaleStore.swift +0 -58
  176. package/ios/Typography/KitDesignSystem.swift +0 -17
@@ -2,77 +2,246 @@
2
2
  // BottomTabDemo.swift
3
3
  // Example
4
4
  //
5
- // Usage demo for the bottom-tab navigation. Mirrors Compose's `BottomTabUsage`:
6
- // four tabs (each with its own header title + badge) and a center floating
7
- // button. Must be hosted inside a `NavigationContainer` (uses the Navigator).
5
+ // Usage demo for the bottom-tab navigation, same as RN app/screens/Navigation/BottomTab and
6
+ // Compose's `BottomTabUsage`: the bar shows right away, every tab holds the options and each
7
+ // change rebuilds the bar below. Must be hosted inside a `NavigationContainer`.
8
8
  //
9
9
 
10
10
  import MoMoUIKits
11
11
  import SwiftUI
12
12
 
13
- @available(iOS 16.0, *)
13
+ private struct TabConfig: Hashable {
14
+ let name: String
15
+ var label: String
16
+ var icon: String
17
+ // nil = no badge, "" = dot, "0" = hidden, numbers > 99 = 99+, text = text badge
18
+ var badgeLabel: String?
19
+ var showDot = false
20
+ }
21
+
22
+ private struct DemoConfig: Hashable {
23
+ var tabs: [TabConfig] = [
24
+ TabConfig(name: "Momo", label: "Momo", icon: "home_momo_active"),
25
+ TabConfig(name: "UuDai", label: "Ưu đãi", icon: "home_promotions_active", badgeLabel: "Mới"),
26
+ TabConfig(name: "GiaoDich", label: "Giao dịch", icon: "home_history_active", badgeLabel: "5"),
27
+ TabConfig(name: "Toi", label: "Tôi", icon: "home_friends_active", badgeLabel: ""),
28
+ TabConfig(name: "Vi", label: "Ví", icon: "home_wallet_inactive", badgeLabel: "1999"),
29
+ ]
30
+ var tabCount = 4
31
+ var longLabels = false
32
+ var special = true
33
+ var ctaLabel = "Quét mọi QR"
34
+ var ctaIcon = "momomain_scan_code"
35
+ var initialRouteName = "Momo"
36
+ var compressionBehavior: DuoBarCompressionBehavior = .toolbar
37
+ var backToInitialTab = true
38
+
39
+ var visibleTabs: [TabConfig] { Array(tabs.prefix(tabCount)) }
40
+ }
41
+
42
+ private let icons = [
43
+ "home_momo_active", "home_promotions_active", "home_history_active", "home_friends_active",
44
+ "home_wallet_inactive", "notifications_bell", "basic_setting",
45
+ ]
46
+ private let ctaIcons = ["momomain_scan_code", "navigation_scan", "navigation_qrcode"]
47
+ private let badges: [(String, String?)] = [
48
+ ("Không", nil), ("Dot \"\"", ""), ("\"0\"", "0"), ("\"5\"", "5"),
49
+ ("\"1999\"", "1999"), ("\"Mới\"", "Mới"), ("Chữ dài", "Khuyến mãi lớn"),
50
+ ]
51
+
14
52
  struct BottomTabDemoContent: View {
15
- @EnvironmentObject private var navigator: Navigator
53
+ @State private var config = DemoConfig()
54
+ // the bar is rebuilt on every change: reopen it on the tab the user is on
55
+ @State private var focused = DemoConfig().initialRouteName
16
56
 
17
57
  var body: some View {
58
+ let tabs = config.visibleTabs
59
+ let initial = tabs.contains { $0.name == focused } ? focused : tabs[0].name
18
60
  BottomTab(
19
- items: [
61
+ items: tabs.map { tab in
20
62
  BottomTabItem(
21
- name: "Tab1",
22
- label: "Option 1",
23
- icon: "16_basic_home",
24
- badgeLabel: "",
25
- options: NavigationOptions(headerTitle: .default("Option 1"), hiddenBack: false),
26
- screen: { tabBody("Option 1", Colors.blue09) }
27
- ),
28
- BottomTabItem(
29
- name: "Tab2",
30
- label: "Option 2",
31
- icon: "help_center",
32
- badgeLabel: "0", // hidden (mirrors Compose's "0" → no badge)
33
- options: NavigationOptions(headerTitle: .default("Option 2")),
34
- screen: { tabBody("Option 2", Colors.pink09) }
35
- ),
36
- BottomTabItem(
37
- name: "Tab3",
38
- label: "Option 3 with a very long label",
39
- icon: "pin_star",
40
- badgeLabel: "New",
41
- options: NavigationOptions(headerTitle: .default("Option 3")),
42
- screen: { tabBody("Option 3", Colors.yellow09) }
43
- ),
44
- BottomTabItem(
45
- name: "Tab4",
46
- label: "Option 4 also quite long here",
47
- icon: "navigation_more_icon",
48
- badgeLabel: "9999",
49
- options: NavigationOptions(headerTitle: .default("Option 4")),
50
- screen: { tabBody("Option 4", Colors.blue10) }
63
+ name: tab.name,
64
+ label: config.longLabels ? "\(tab.label) dài quá" : tab.label,
65
+ icon: tab.icon,
66
+ showDot: tab.showDot,
67
+ badgeLabel: tab.badgeLabel,
68
+ options: NavigationOptions(headerTitle: .default(tab.label)),
69
+ screen: { TabContent(name: tab.name, config: $config, focused: $focused) }
51
70
  )
52
- ],
53
- floatingButton: BottomTabFloatingButton(
54
- icon: "16_basic_home",
55
- label: "Quét QR",
56
- onPress: { navigator.push({ qrScreen }, options: NavigationOptions(title: "QR")) }
57
- )
71
+ },
72
+ floatingButton: config.special
73
+ ? BottomTabFloatingButton(icon: config.ctaIcon, label: config.ctaLabel, onPress: {})
74
+ : nil,
75
+ compressionBehavior: config.compressionBehavior,
76
+ initialRouteName: initial,
77
+ onTabPress: { index, switchTab in
78
+ focused = tabs[index].name
79
+ switchTab()
80
+ },
81
+ backToInitialTab: config.backToInitialTab
58
82
  )
83
+ .id(config)
84
+ }
85
+ }
86
+
87
+ /// Content of every tab: this tab's own props, the bar props, then the center action. The tab's
88
+ /// StackScreen scrolls it under the floating bar and keeps its end clear of it.
89
+ private struct TabContent: View {
90
+ let name: String
91
+ @Binding var config: DemoConfig
92
+ @Binding var focused: String
93
+
94
+ private var tab: TabConfig { config.tabs.first { $0.name == name }! }
95
+
96
+ private func updateTab(_ change: (inout TabConfig) -> Void) {
97
+ guard let index = config.tabs.firstIndex(where: { $0.name == name }) else { return }
98
+ change(&config.tabs[index])
99
+ }
100
+
101
+ private func yesNo(_ value: Bool, _ onChange: @escaping (Bool) -> Void) -> [Option] {
102
+ [Option(title: "Có", selected: value) { onChange(true) },
103
+ Option(title: "Không", selected: !value) { onChange(false) }]
104
+ }
105
+
106
+ var body: some View {
107
+ let ctaHidden = config.special && config.tabCount % 2 != 0
108
+ VStack(alignment: .leading, spacing: Spacing.M) {
109
+ MomoText("Chạm các tab bên dưới để xem indicator chạy qua lại. Mỗi thay đổi áp dụng ngay lên thanh tab.",
110
+ typography: .bodyDefaultRegular)
111
+
112
+ Section(title: "Tab đang mở · \(name)") {
113
+ IconOptions(title: "icon", icons: icons, value: tab.icon) { icon in updateTab { $0.icon = icon } }
114
+ Options(title: "badgeLabel",
115
+ hint: "\"\" là dot, \"0\" ẩn badge, số > 99 hiện 99+, chữ dài bị cắt ở 58",
116
+ options: badges.map { title, value in
117
+ Option(title: title, selected: tab.badgeLabel == value) { updateTab { $0.badgeLabel = value } }
118
+ })
119
+ Options(title: "showDot",
120
+ hint: "Hiện dot khi không có badgeLabel hoặc badgeLabel là \"0\"",
121
+ options: yesNo(tab.showDot) { value in updateTab { $0.showDot = value } })
122
+ }
123
+
124
+ Section(title: "Thanh tab") {
125
+ Options(title: "Số tab (items)", options: (2...5).map { count in
126
+ Option(title: "\(count)", selected: config.tabCount == count) { config.tabCount = count }
127
+ })
128
+ Options(title: "label", options: [
129
+ Option(title: "Ngắn", selected: !config.longLabels) { config.longLabels = false },
130
+ Option(title: "Dài", selected: config.longLabels) { config.longLabels = true },
131
+ ])
132
+ Options(title: "initialRouteName", hint: "Tab được chọn khi BottomTab mở",
133
+ options: config.visibleTabs.map { item in
134
+ Option(title: item.name, selected: config.initialRouteName == item.name) {
135
+ focused = item.name
136
+ config.initialRouteName = item.name
137
+ }
138
+ })
139
+ Options(title: "compressionBehavior",
140
+ hint: "iPhone Duo: bar nào thu gọn trước khi side bar không đủ chỗ",
141
+ options: [
142
+ Option(title: "toolbar", selected: config.compressionBehavior == .toolbar) {
143
+ config.compressionBehavior = .toolbar
144
+ },
145
+ Option(title: "tabBar", selected: config.compressionBehavior == .tabBar) {
146
+ config.compressionBehavior = .tabBar
147
+ },
148
+ ])
149
+ Options(title: "backToInitialTab", hint: "Back ở tab khác quay về tab đầu trước khi rời màn",
150
+ options: yesNo(config.backToInitialTab) { config.backToInitialTab = $0 })
151
+ }
152
+
153
+ Section(title: "Nút giữa (floatingButton)") {
154
+ Options(title: "floatingButton",
155
+ hint: ctaHidden
156
+ ? "Đang ẩn: nút giữa chỉ hiện khi có 2 hoặc 4 tab"
157
+ : "Có = Special (nút giữa trong notch), Không = Default",
158
+ options: yesNo(config.special) { config.special = $0 })
159
+ if config.special {
160
+ Options(title: "label", options: ["Quét mọi QR", "Quét mã thanh toán"].map { label in
161
+ Option(title: label, selected: config.ctaLabel == label) { config.ctaLabel = label }
162
+ })
163
+ IconOptions(title: "icon", icons: ctaIcons, value: config.ctaIcon) { config.ctaIcon = $0 }
164
+ }
165
+ }
166
+
167
+ MoMoUIKits.Button(title: "Khôi phục mặc định", action: { config = DemoConfig() }, type: .outline)
168
+ }
169
+ .padding(Spacing.M)
59
170
  }
171
+ }
172
+
173
+ private struct Option: Identifiable {
174
+ var id: String { title }
175
+ let title: String
176
+ let selected: Bool
177
+ let onPress: () -> Void
178
+ }
60
179
 
61
- @ViewBuilder
62
- private func tabBody(_ title: String, _ color: Color) -> some View {
63
- VStack {
64
- MomoText(title, typography: .headerDefaultBold)
65
- .padding(.top, 24)
66
- Spacer()
180
+ private struct Section<Content: View>: View {
181
+ let title: String
182
+ @ViewBuilder let content: () -> Content
183
+
184
+ @Environment(\.appTheme) private var theme
185
+
186
+ var body: some View {
187
+ VStack(alignment: .leading, spacing: Spacing.M) {
188
+ MomoText(title, typography: .headerSSemibold)
189
+ content()
67
190
  }
68
- .frame(maxWidth: .infinity, maxHeight: .infinity)
69
- .background(color)
191
+ .padding(Spacing.M)
192
+ .frame(maxWidth: .infinity, alignment: .leading)
193
+ .background(RoundedRectangle(cornerRadius: Radius.M).fill(theme.colors.background.surface))
70
194
  }
195
+ }
196
+
197
+ private struct Options: View {
198
+ let title: String
199
+ var hint: String? = nil
200
+ let options: [Option]
71
201
 
72
- private var qrScreen: some View {
73
- VStack { MomoText("QR scanner placeholder") }
74
- .frame(maxWidth: .infinity)
75
- .padding(24)
202
+ var body: some View {
203
+ VStack(alignment: .leading, spacing: Spacing.XS) {
204
+ MomoText(title, typography: .labelDefaultMedium)
205
+ if let hint {
206
+ MomoText(hint, typography: .descriptionXsRegular)
207
+ }
208
+ LazyVGrid(columns: [GridItem(.adaptive(minimum: 88), spacing: Spacing.S, alignment: .leading)],
209
+ alignment: .leading, spacing: Spacing.S) {
210
+ ForEach(options) { option in
211
+ MoMoUIKits.Button(title: option.title, action: option.onPress,
212
+ type: option.selected ? .primary : .outline, size: .small, isFull: false)
213
+ }
214
+ }
215
+ }
216
+ }
217
+ }
218
+
219
+ private struct IconOptions: View {
220
+ let title: String
221
+ let icons: [String]
222
+ let value: String
223
+ let onChange: (String) -> Void
224
+
225
+ @Environment(\.appTheme) private var theme
226
+
227
+ var body: some View {
228
+ VStack(alignment: .leading, spacing: Spacing.XS) {
229
+ MomoText(title, typography: .labelDefaultMedium)
230
+ HStack(spacing: Spacing.S) {
231
+ ForEach(icons, id: \.self) { icon in
232
+ let selected = icon == value
233
+ SwiftUI.Button { onChange(icon) } label: {
234
+ Icon(source: icon, size: 24, color: selected ? theme.colors.primary : theme.colors.text.default)
235
+ .frame(width: 40, height: 40)
236
+ .overlay(
237
+ RoundedRectangle(cornerRadius: Radius.S)
238
+ .stroke(selected ? theme.colors.primary : theme.colors.border.default, lineWidth: 1)
239
+ )
240
+ }
241
+ .buttonStyle(.plain)
242
+ }
243
+ }
244
+ }
76
245
  }
77
246
  }
78
247
 
@@ -80,10 +249,6 @@ struct BottomTabDemoContent: View {
80
249
 
81
250
  struct BottomTabDemo: View {
82
251
  var body: some View {
83
- if #available(iOS 16.0, *) {
84
- BottomTabDemoContent()
85
- } else {
86
- Text("Bottom tab demo requires iOS 16+").padding()
87
- }
252
+ BottomTabDemoContent()
88
253
  }
89
254
  }
@@ -0,0 +1,9 @@
1
+ ## This file must *NOT* be checked into Version Control Systems,
2
+ # as it contains information specific to your local configuration.
3
+ #
4
+ # Location of the SDK. This is only used by Gradle.
5
+ # For customization when using a Version Control System, please read the
6
+ # header note.
7
+ #Wed Oct 28 18:45:30 GMT+07:00 2026
8
+ sdk.dir=/Users/phucvu/Library/Android/sdk
9
+ kotlin.apple.cocoapods.bin=/Users/phucvu/.gem/ruby/2.6.0/bin/pod
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.168.1-beta.3",
3
+ "version": "0.168.1-beta.30-debug",
4
4
  "private": false,
5
5
  "dependeNavigationncies": {},
6
6
  "devDependencies": {},
package/publish.sh CHANGED
@@ -374,13 +374,8 @@ phase_publish_npm() {
374
374
  echo ""
375
375
  # A bad token surfaces as a 404 on the PUT, after the working tree was already rewritten
376
376
  # below — so verify auth first, before anything is touched.
377
- if ! NPM_WHOAMI_OUTPUT=$(npm whoami --registry https://registry.npmjs.org 2>&1); then
378
- echo "$NPM_WHOAMI_OUTPUT"
379
- if echo "$NPM_WHOAMI_OUTPUT" | grep -qE "E401|ENEEDAUTH"; then
380
- echo "❌ Error: npm auth failed (npm whoami). Renew the token in .npmrc / ~/.npmrc and retry."
381
- else
382
- echo "❌ Error: npm whoami failed (see above) — likely network / VPN to registry.npmjs.org. Retry in a moment."
383
- fi
377
+ if ! npm whoami --registry https://registry.npmjs.org >/dev/null 2>&1; then
378
+ echo "❌ Error: npm auth failed (npm whoami). Renew the token in .npmrc / ~/.npmrc and retry."
384
379
  exit 1
385
380
  fi
386
381
 
@@ -0,0 +1,64 @@
1
+ import org.gradle.kotlin.dsl.maven
2
+
3
+ rootProject.name = "momo-native-kits"
4
+ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
5
+
6
+ pluginManagement {
7
+ repositories {
8
+ google {
9
+ mavenContent {
10
+ includeGroupAndSubgroups("androidx")
11
+ includeGroupAndSubgroups("com.android")
12
+ includeGroupAndSubgroups("com.google")
13
+ }
14
+ }
15
+ mavenCentral()
16
+ gradlePluginPortal()
17
+ maven {
18
+ url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
19
+ credentials {username = "download_packages"; password = "gldt-bjDqLpU_sPcHDuXau2ws" }
20
+ }
21
+ maven {
22
+ url = uri("https://artifacts.mservice.com.vn/repository/maven-momo-app/")
23
+ credentials {
24
+ username = "viewer"
25
+ password = "viewer"
26
+ }
27
+ isAllowInsecureProtocol = true
28
+ }
29
+ }
30
+ }
31
+
32
+ dependencyResolutionManagement {
33
+ repositories {
34
+ google {
35
+ mavenContent {
36
+ includeGroupAndSubgroups("androidx")
37
+ includeGroupAndSubgroups("com.android")
38
+ includeGroupAndSubgroups("com.google")
39
+ }
40
+ }
41
+ mavenCentral()
42
+ maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") }
43
+ maven {
44
+ url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
45
+ credentials {
46
+ username = "download_packages";
47
+ password = "gldt-bjDqLpU_sPcHDuXau2ws"
48
+ }
49
+ }
50
+ maven {
51
+ url = uri("https://artifacts.mservice.com.vn/repository/maven-momo-app/")
52
+ credentials {
53
+ username = "viewer"
54
+ password = "viewer"
55
+ }
56
+ isAllowInsecureProtocol = true
57
+ }
58
+ }
59
+ }
60
+
61
+ include(":compose")
62
+
63
+ include(":sample:androidApp")
64
+ include(":sample:shared")
@@ -1,58 +0,0 @@
1
- import SwiftUI
2
-
3
- /// App-wide font-scale inputs for the SwiftUI kit, and the single place they publish from.
4
- /// The host writes `update(...)` at startup (from the cache-backed `FontScaleProvider`) and again
5
- /// whenever the in-app font-size preference changes; the OS Dynamic Type factor is tracked here.
6
- /// Mirrors Compose's `KitFontScale` + `ProvideOsFontScale` pair, including its live behaviour —
7
- /// views re-render on change as long as the subtree got `.momoFontScale()` (`NavigationContainer`
8
- /// applies it). When `useOSScaleRate` is false the kit applies `userScaleRate` instead of the OS factor.
9
- public final class FontScaleStore: ObservableObject {
10
- public static let shared = FontScaleStore()
11
-
12
- @Published public private(set) var userScaleRate: CGFloat = 1
13
- @Published public private(set) var useOSScaleRate: Bool = true
14
- @Published public private(set) var osFontScale: CGFloat = FontScaleStore.currentOsFontScale()
15
-
16
- private init() {
17
- NotificationCenter.default.addObserver(
18
- self,
19
- selector: #selector(contentSizeCategoryDidChange),
20
- name: UIContentSizeCategory.didChangeNotification,
21
- object: nil
22
- )
23
- }
24
-
25
- public var snapshot: FontScale {
26
- FontScale(
27
- userScaleRate: userScaleRate,
28
- useOSScaleRate: useOSScaleRate,
29
- osFontScale: osFontScale
30
- )
31
- }
32
-
33
- public func update(userScaleRate: CGFloat, useOSScaleRate: Bool) {
34
- onMain {
35
- // Re-assigning an unchanged value would still publish and invalidate every kit subtree.
36
- if self.userScaleRate != userScaleRate { self.userScaleRate = userScaleRate }
37
- if self.useOSScaleRate != useOSScaleRate { self.useOSScaleRate = useOSScaleRate }
38
- }
39
- }
40
-
41
- @objc private func contentSizeCategoryDidChange() {
42
- let next = Self.currentOsFontScale()
43
- guard next != osFontScale else { return }
44
- osFontScale = next
45
- }
46
-
47
- /// Same factor Compose's iOS `ProvideOsFontScale` derives from
48
- /// `UIFont.preferredFont(forTextStyle: .body).pointSize / 17`, so both iOS surfaces scale alike.
49
- static func currentOsFontScale() -> CGFloat {
50
- let base = UIFont.systemFont(ofSize: UIFont.labelFontSize)
51
- return UIFontMetrics.default.scaledFont(for: base).pointSize / base.pointSize
52
- }
53
-
54
- /// Synchronous when already on main — an async hop would defer the change by a frame.
55
- private func onMain(_ work: @escaping () -> Void) {
56
- if Thread.isMainThread { work() } else { DispatchQueue.main.async(execute: work) }
57
- }
58
- }
@@ -1,17 +0,0 @@
1
- import Foundation
2
-
3
- /// Design-system rollout flag for the SwiftUI kit, mirroring Compose's `KitDesignSystem`.
4
- /// The kit is sandboxed and can't read the host config, so the host writes `update(_:)` once at
5
- /// startup from `DesignSystemConfig`. Startup-only and non-reactive, like `FontScaleStore` was
6
- /// before it gained live updates: there is no SwiftUI navigation container to re-render from.
7
- public final class KitDesignSystem {
8
- public static let shared = KitDesignSystem()
9
-
10
- public private(set) var isWhiteList: Bool = false
11
-
12
- private init() {}
13
-
14
- public func update(isWhiteList: Bool) {
15
- self.isWhiteList = isWhiteList
16
- }
17
- }