@momo-kits/native-kits 0.168.1-beta.30-debug → 0.168.1-beta.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +2 -1
- package/ios/Input/Input.swift +3 -1
- package/ios/Input/InputTextArea.swift +3 -1
- package/ios/Navigation/BottomTab/BottomTab.swift +33 -14
- package/ios/Navigation/BottomTab/BottomTabBar.swift +131 -254
- package/ios/Navigation/BottomTab/CurvedContainer.swift +47 -51
- package/ios/Navigation/BottomTab/DuoLiquidSelection.swift +364 -0
- package/ios/Navigation/BottomTab/DuoTabBar.swift +292 -71
- package/ios/Navigation/StackScreen.swift +1 -3
- package/ios/native-kits.podspec +1 -1
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +59 -224
- package/package.json +1 -1
- package/build.gradle.kts +0 -11
- package/compose/build.gradle.kts +0 -198
- package/compose/build.gradle.kts.backup +0 -198
- package/compose/compose.podspec +0 -47
- package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -20
- package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -153
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +0 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -110
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +0 -62
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -1071
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -269
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -81
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -357
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -115
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -542
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -86
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -231
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -189
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -478
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -114
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -265
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -235
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -223
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -265
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -185
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -84
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -370
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -108
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -308
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -90
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -330
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -473
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -207
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -92
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -560
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -125
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -207
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -501
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -236
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -180
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -17
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -194
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -287
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -54
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -50
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +0 -321
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -41
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -502
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -148
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -116
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -205
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -422
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -732
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -35
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -224
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -383
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -94
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +0 -97
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +0 -203
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/TabBarMetrics.kt +0 -106
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -169
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -455
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -105
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -106
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -74
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -399
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -39
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -363
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +0 -192
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -133
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -91
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -74
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +0 -20
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -118
- package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -42
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -32
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -218
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +0 -138
- package/gradle/libs.versions.toml +0 -69
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +0 -8
- package/gradle.properties +0 -26
- package/gradlew +0 -252
- package/gradlew.bat +0 -94
- package/ios/Navigation/BottomTab/TabBarMetrics.swift +0 -88
- package/ios-demo/README.md +0 -120
- package/local.properties +0 -9
- package/settings.gradle.kts +0 -64
|
@@ -2,246 +2,77 @@
|
|
|
2
2
|
// BottomTabDemo.swift
|
|
3
3
|
// Example
|
|
4
4
|
//
|
|
5
|
-
// Usage demo for the bottom-tab navigation
|
|
6
|
-
//
|
|
7
|
-
//
|
|
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).
|
|
8
8
|
//
|
|
9
9
|
|
|
10
10
|
import MoMoUIKits
|
|
11
11
|
import SwiftUI
|
|
12
12
|
|
|
13
|
-
|
|
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
|
-
|
|
13
|
+
@available(iOS 16.0, *)
|
|
52
14
|
struct BottomTabDemoContent: View {
|
|
53
|
-
@
|
|
54
|
-
// the bar is rebuilt on every change: reopen it on the tab the user is on
|
|
55
|
-
@State private var focused = DemoConfig().initialRouteName
|
|
15
|
+
@EnvironmentObject private var navigator: Navigator
|
|
56
16
|
|
|
57
17
|
var body: some View {
|
|
58
|
-
let tabs = config.visibleTabs
|
|
59
|
-
let initial = tabs.contains { $0.name == focused } ? focused : tabs[0].name
|
|
60
18
|
BottomTab(
|
|
61
|
-
items:
|
|
19
|
+
items: [
|
|
62
20
|
BottomTabItem(
|
|
63
|
-
name:
|
|
64
|
-
label:
|
|
65
|
-
icon:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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) }
|
|
70
51
|
)
|
|
71
|
-
|
|
72
|
-
floatingButton:
|
|
73
|
-
|
|
74
|
-
:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
onTabPress: { index, switchTab in
|
|
78
|
-
focused = tabs[index].name
|
|
79
|
-
switchTab()
|
|
80
|
-
},
|
|
81
|
-
backToInitialTab: config.backToInitialTab
|
|
52
|
+
],
|
|
53
|
+
floatingButton: BottomTabFloatingButton(
|
|
54
|
+
icon: "16_basic_home",
|
|
55
|
+
label: "Quét QR",
|
|
56
|
+
onPress: { navigator.push({ qrScreen }, options: NavigationOptions(title: "QR")) }
|
|
57
|
+
)
|
|
82
58
|
)
|
|
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)
|
|
170
59
|
}
|
|
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
|
-
}
|
|
179
60
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
var body: some View {
|
|
187
|
-
VStack(alignment: .leading, spacing: Spacing.M) {
|
|
188
|
-
MomoText(title, typography: .headerSSemibold)
|
|
189
|
-
content()
|
|
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()
|
|
190
67
|
}
|
|
191
|
-
.
|
|
192
|
-
.
|
|
193
|
-
.background(RoundedRectangle(cornerRadius: Radius.M).fill(theme.colors.background.surface))
|
|
68
|
+
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
69
|
+
.background(color)
|
|
194
70
|
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
private struct Options: View {
|
|
198
|
-
let title: String
|
|
199
|
-
var hint: String? = nil
|
|
200
|
-
let options: [Option]
|
|
201
71
|
|
|
202
|
-
var
|
|
203
|
-
VStack(
|
|
204
|
-
|
|
205
|
-
|
|
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
|
-
}
|
|
72
|
+
private var qrScreen: some View {
|
|
73
|
+
VStack { MomoText("QR scanner placeholder") }
|
|
74
|
+
.frame(maxWidth: .infinity)
|
|
75
|
+
.padding(24)
|
|
245
76
|
}
|
|
246
77
|
}
|
|
247
78
|
|
|
@@ -249,6 +80,10 @@ private struct IconOptions: View {
|
|
|
249
80
|
|
|
250
81
|
struct BottomTabDemo: View {
|
|
251
82
|
var body: some View {
|
|
252
|
-
|
|
83
|
+
if #available(iOS 16.0, *) {
|
|
84
|
+
BottomTabDemoContent()
|
|
85
|
+
} else {
|
|
86
|
+
Text("Bottom tab demo requires iOS 16+").padding()
|
|
87
|
+
}
|
|
253
88
|
}
|
|
254
89
|
}
|
package/package.json
CHANGED
package/build.gradle.kts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
plugins {
|
|
2
|
-
// this is necessary to avoid the plugins to be loaded multiple times
|
|
3
|
-
// in each subproject's classloader
|
|
4
|
-
alias(libs.plugins.android.application) apply false
|
|
5
|
-
alias(libs.plugins.android.library) apply false
|
|
6
|
-
alias(libs.plugins.compose) apply false
|
|
7
|
-
alias(libs.plugins.kotlin.compose.compiler) apply false
|
|
8
|
-
alias(libs.plugins.jetbrains.kotlin.multiplatform) apply false
|
|
9
|
-
alias(libs.plugins.jetbrains.kotlin.serialization) apply false
|
|
10
|
-
alias(libs.plugins.vanniktech.mavenPublish) apply false
|
|
11
|
-
}
|
package/compose/build.gradle.kts
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
// import com.vanniktech.maven.publish.JavadocJar
|
|
2
|
-
// import com.vanniktech.maven.publish.KotlinMultiplatform
|
|
3
|
-
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
4
|
-
|
|
5
|
-
plugins {
|
|
6
|
-
alias(libs.plugins.jetbrains.kotlin.multiplatform)
|
|
7
|
-
alias(libs.plugins.android.library)
|
|
8
|
-
alias(libs.plugins.compose)
|
|
9
|
-
alias(libs.plugins.kotlin.compose.compiler)
|
|
10
|
-
// alias(libs.plugins.vanniktech.mavenPublish)
|
|
11
|
-
id(libs.plugins.jetbrains.kotlin.cocoapods.get().pluginId)
|
|
12
|
-
kotlin("plugin.serialization")
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
val gitlabName: String = findProperty("name") as String? ?: ""
|
|
16
|
-
val gitlabRepo: String = findProperty("repo") as String? ?: ""
|
|
17
|
-
val gitlabUrl: String = findProperty("url") as String? ?: ""
|
|
18
|
-
val gitlabGroup: String = findProperty("group") as String? ?: ""
|
|
19
|
-
val gitlabArtifactId: String = findProperty("artifact.id") as String? ?: ""
|
|
20
|
-
val gitlabVersion: String = findProperty("version") as String? ?: ""
|
|
21
|
-
val gitlabUser: String = findProperty("gitlab.user") as String? ?: ""
|
|
22
|
-
val gitlabKey: String = findProperty("gitlab.password") as String? ?: ""
|
|
23
|
-
|
|
24
|
-
kotlin {
|
|
25
|
-
androidTarget {
|
|
26
|
-
compilerOptions {
|
|
27
|
-
jvmTarget.set(JvmTarget.JVM_17)
|
|
28
|
-
}
|
|
29
|
-
publishLibraryVariants("release")
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
val fwName = gitlabArtifactId
|
|
33
|
-
val iosTargets = listOf(iosArm64(), iosSimulatorArm64())
|
|
34
|
-
iosTargets.forEach {
|
|
35
|
-
it.binaries.framework {
|
|
36
|
-
baseName = fwName
|
|
37
|
-
binaryOption("bundleId", "$gitlabGroup.$fwName")
|
|
38
|
-
isStatic = true
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
cocoapods {
|
|
43
|
-
version = "0.168.1-beta.30-debug"
|
|
44
|
-
summary = "IOS Shared module"
|
|
45
|
-
homepage = "https://momo.vn"
|
|
46
|
-
ios.deploymentTarget = "15.0"
|
|
47
|
-
|
|
48
|
-
framework {
|
|
49
|
-
baseName = fwName
|
|
50
|
-
isStatic = true
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
pod("lottie-ios") {
|
|
54
|
-
moduleName = "Lottie"
|
|
55
|
-
version = "4.4.3"
|
|
56
|
-
extraOpts += listOf("-compiler-option", "-fmodules")
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
sourceSets {
|
|
61
|
-
all {
|
|
62
|
-
languageSettings.optIn("vn.momo.kits.modifier.InternalApi")
|
|
63
|
-
}
|
|
64
|
-
commonMain.dependencies {
|
|
65
|
-
implementation(compose.runtime)
|
|
66
|
-
implementation(compose.material)
|
|
67
|
-
implementation(compose.material3)
|
|
68
|
-
implementation(compose.components.resources)
|
|
69
|
-
implementation(libs.compose.ui.backhandler)
|
|
70
|
-
implementation(libs.ktor.client.core)
|
|
71
|
-
implementation(libs.jetbrains.coroutines.core)
|
|
72
|
-
implementation(libs.navigation.multiplatform)
|
|
73
|
-
implementation(libs.coil.multiplatform.compose)
|
|
74
|
-
implementation(libs.coil.multiplatform.core)
|
|
75
|
-
implementation(libs.coil.multiplatform.network.ktor)
|
|
76
|
-
implementation(libs.jetbrains.serialization.json)
|
|
77
|
-
implementation(libs.kotlinx.datetime)
|
|
78
|
-
api(libs.native.max.api)
|
|
79
|
-
implementation(libs.compottie)
|
|
80
|
-
implementation(libs.gif.image)
|
|
81
|
-
}
|
|
82
|
-
androidMain.dependencies {
|
|
83
|
-
implementation(libs.ktor.client.okhttp)
|
|
84
|
-
implementation(libs.airbnb.lottie)
|
|
85
|
-
}
|
|
86
|
-
iosMain.dependencies {
|
|
87
|
-
implementation(libs.ktor.client.darwin)
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
android {
|
|
93
|
-
namespace = "vn.momo.kits.kits"
|
|
94
|
-
compileSdk = 35
|
|
95
|
-
compileOptions {
|
|
96
|
-
sourceCompatibility = JavaVersion.VERSION_17
|
|
97
|
-
targetCompatibility = JavaVersion.VERSION_17
|
|
98
|
-
}
|
|
99
|
-
defaultConfig {
|
|
100
|
-
minSdk = 24
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
dependencies {
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
repositories {
|
|
108
|
-
google {
|
|
109
|
-
mavenContent {
|
|
110
|
-
includeGroupAndSubgroups("androidx")
|
|
111
|
-
includeGroupAndSubgroups("com.android")
|
|
112
|
-
includeGroupAndSubgroups("com.google")
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
mavenCentral()
|
|
116
|
-
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") }
|
|
117
|
-
maven {
|
|
118
|
-
url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
|
|
119
|
-
credentials {username = "download_packages"; password = "gldt-bjDqLpU_sPcHDuXau2ws" }
|
|
120
|
-
}
|
|
121
|
-
maven {
|
|
122
|
-
url = uri("https://artifacts.mservice.com.vn/repository/maven-momo-app/")
|
|
123
|
-
credentials {
|
|
124
|
-
username = "viewer"
|
|
125
|
-
password = "viewer"
|
|
126
|
-
}
|
|
127
|
-
isAllowInsecureProtocol = true
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
compose {
|
|
132
|
-
resources {
|
|
133
|
-
publicResClass = true
|
|
134
|
-
packageOfResClass = "vn.momo.uikits.resources"
|
|
135
|
-
generateResClass = always
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// publishing {
|
|
140
|
-
// repositories {
|
|
141
|
-
// maven {
|
|
142
|
-
// name = "${gitlabRepo}Packages"
|
|
143
|
-
// credentials {
|
|
144
|
-
// username = gitlabUser
|
|
145
|
-
// password = gitlabKey
|
|
146
|
-
// }
|
|
147
|
-
// url = uri("$gitlabUrl")
|
|
148
|
-
// }
|
|
149
|
-
// }
|
|
150
|
-
// }
|
|
151
|
-
|
|
152
|
-
// mavenPublishing {
|
|
153
|
-
// configure(
|
|
154
|
-
// KotlinMultiplatform(
|
|
155
|
-
// javadocJar = JavadocJar.Empty(),
|
|
156
|
-
// sourcesJar = true,
|
|
157
|
-
// androidVariantsToPublish = listOf("release")
|
|
158
|
-
// )
|
|
159
|
-
// )
|
|
160
|
-
//
|
|
161
|
-
// repositories {
|
|
162
|
-
// maven {
|
|
163
|
-
// name = "${gitlabRepo}Packages"
|
|
164
|
-
// credentials { username = gitlabUser; password = gitlabKey }
|
|
165
|
-
// url = uri("$gitlabUrl")
|
|
166
|
-
// }
|
|
167
|
-
// }
|
|
168
|
-
//
|
|
169
|
-
// coordinates(gitlabGroup.toString(), gitlabArtifactId, gitlabVersion.toString())
|
|
170
|
-
//
|
|
171
|
-
// pom {
|
|
172
|
-
// name = "$gitlabName Klib"
|
|
173
|
-
// description = "$gitlabName"
|
|
174
|
-
// url = "https://gitlab.mservice.com.vn"
|
|
175
|
-
// licenses {
|
|
176
|
-
// license {
|
|
177
|
-
// name = "The Apache License, Version 2.0"
|
|
178
|
-
// url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
|
179
|
-
// distribution = "https://www.apache.org/licenses/LICENSE-2.0.txt"
|
|
180
|
-
// }
|
|
181
|
-
// }
|
|
182
|
-
// developers {
|
|
183
|
-
// developer {
|
|
184
|
-
// id = "kotlin-hands-on"
|
|
185
|
-
// name = "Kotlin Developer Advocate"
|
|
186
|
-
// url = "https://github.com/kotlin-hands-on/"
|
|
187
|
-
// }
|
|
188
|
-
// }
|
|
189
|
-
// }
|
|
190
|
-
// }
|
|
191
|
-
|
|
192
|
-
// Xcode 27 rejects iOS < 15; KGP's synthetic Podfile only raises pods to 12 (KT-57741), leaving lottie-ios at 13.
|
|
193
|
-
tasks.named("podGenIos") {
|
|
194
|
-
doLast {
|
|
195
|
-
val podfile = layout.buildDirectory.file("cocoapods/synthetic/ios/Podfile").get().asFile
|
|
196
|
-
podfile.writeText(podfile.readText().replace("major < 12 ||", "major < 15 ||").replace("#{12}", "#{15}"))
|
|
197
|
-
}
|
|
198
|
-
}
|