@momo-kits/native-kits 0.162.2-debug → 0.162.2-sp.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.
- package/.claude/settings.local.json +55 -0
- package/compose/build.gradle.kts +1 -1
- package/compose/compose.podspec +1 -1
- package/gradle.properties +1 -1
- package/ios/Application/Components.swift +34 -43
- package/ios/Application/FloatingButton.swift +10 -8
- package/ios/Application/Navigation/BottomTab/BottomTab.swift +102 -0
- package/ios/Application/Navigation/BottomTab/BottomTabBar.swift +215 -0
- package/ios/Application/Navigation/BottomTab/CurvedContainer.swift +65 -0
- package/ios/Application/Navigation/HeaderBackProps.swift +66 -0
- package/ios/Application/Navigation/HeaderTitle.swift +57 -0
- package/ios/Application/Navigation/HeaderUser.swift +209 -0
- package/ios/Application/Navigation/NavigationContainer.swift +151 -0
- package/ios/Application/Navigation/NavigationOptions.swift +109 -0
- package/ios/Application/Navigation/Navigator.swift +360 -0
- package/ios/Application/Navigation/Overplay/BottomSheet.swift +176 -0
- package/ios/Application/Navigation/Overplay/ModalScreen.swift +68 -0
- package/ios/Application/Navigation/Overplay/SnackBar.swift +144 -0
- package/ios/Application/Navigation/component/Header.swift +178 -0
- package/ios/Application/Navigation/component/HeaderBackground.swift +83 -0
- package/ios/Application/Navigation/component/HeaderColor.swift +65 -0
- package/ios/Application/StackScreen.swift +449 -0
- package/ios/Avatar/Avatar.swift +193 -0
- package/ios/Badge/Badge.swift +11 -13
- package/ios/Badge/BadgeRibbon.swift +12 -19
- package/ios/BaselineView/BaselineView.swift +163 -0
- package/ios/Button/Button.swift +62 -23
- package/ios/Carousel/Carousel.swift +181 -0
- package/ios/Checkbox/Checkbox.swift +14 -12
- package/ios/Chip/Chip.swift +23 -9
- package/ios/Collapse/Collapse.swift +182 -0
- package/ios/Colors+Radius+Spacing/Colors.swift +1 -1
- package/ios/Colors+Radius+Spacing/Theme.swift +295 -0
- package/ios/DateTimePicker/DateTimePicker.swift +210 -0
- package/ios/DateTimePicker/DateTimePickerTypes.swift +55 -0
- package/ios/DateTimePicker/DateTimePickerUtils.swift +167 -0
- package/ios/DateTimePicker/WheelPicker.swift +161 -0
- package/ios/Divider/Divider.swift +16 -0
- package/ios/Icon/Icon.swift +6 -1
- package/ios/IconButton/IconButton.swift +112 -0
- package/ios/Information/Information.swift +151 -0
- package/ios/Input/Input.swift +42 -25
- package/ios/Input/InputPhoneNumber.swift +21 -19
- package/ios/Input/InputSearch.swift +101 -45
- package/ios/Input/InputTextArea.swift +67 -40
- package/ios/InputDropDown/InputDropDown.swift +198 -0
- package/ios/InputMoney/InputMoney.swift +335 -0
- package/ios/InputOTP/InputOTP.swift +210 -0
- package/ios/Loader/Loader.swift +113 -0
- package/ios/MoMoUIKits.podspec +5 -0
- package/ios/OTPKeyboard/KeyboardButton.swift +1 -1
- package/ios/Pagination/PaginationDot.swift +61 -0
- package/ios/Pagination/PaginationNumber.swift +35 -0
- package/ios/Pagination/PaginationScroll.swift +101 -0
- package/ios/Pagination/PaginationWhiteDot.swift +37 -0
- package/ios/Popup/PopupDisplay.swift +10 -12
- package/ios/Popup/PopupInput.swift +2 -6
- package/ios/Popup/PopupNotify.swift +219 -0
- package/ios/ProgressInfo/ProgressInfo.swift +294 -0
- package/ios/Radio/Radio.swift +70 -0
- package/ios/Rating/Rating.swift +82 -0
- package/ios/Skeleton/Skeleton.swift +99 -0
- package/ios/Slider/Slider.swift +237 -0
- package/ios/Stepper/Stepper.swift +220 -0
- package/ios/Steps/Steps.swift +451 -0
- package/ios/SuggestAction/SuggestAction.swift +97 -0
- package/ios/Swipeable/SwipeCell.swift +185 -0
- package/ios/Swipeable/SwipeCellModel.swift +21 -0
- package/ios/TabView/TabView.swift +530 -0
- package/ios/Tag/Tag.swift +98 -0
- package/ios/Template/TrustBanner/TrustBanner.swift +2 -0
- package/ios/Title/Title.swift +269 -0
- package/ios/Tooltip/Tooltip.swift +482 -0
- package/ios/Typography/Text.swift +77 -5
- package/ios/Typography/Typography.swift +9 -0
- package/ios/Uploader/Uploader.swift +183 -0
- package/ios/native-kits.podspec +58 -8
- package/ios-demo/MoMoUIKitsDemo.podspec +18 -0
- package/ios-demo/README.md +120 -0
- package/ios-demo/Resources/dot_loading.json +558 -0
- package/ios-demo/Resources/icon.json +4052 -0
- package/ios-demo/Resources/lottie_circle_loader.json +1 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/DemoScaffold.swift +48 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsBadgeDemoView.swift +25 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsButtonDemoView.swift +26 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsCheckboxDemoView.swift +19 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsChipDemoView.swift +33 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsInputDemoView.swift +48 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsPopupDemoView.swift +21 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsRadioDemoView.swift +17 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsTypographyDemoView.swift +28 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoContext.swift +31 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoFactory.swift +72 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +110 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AvatarDemo.swift +93 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BadgeDemo.swift +269 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BaselineView.swift +117 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +89 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ButtonDemo.swift +100 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CarouselDemo.swift +126 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CheckboxDemo.swift +63 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ChipDemo.swift +20 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CollapseDemo.swift +93 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +107 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DateTimePickerDemo.swift +124 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DividerDemo.swift +14 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/HeaderUserDemo.swift +49 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +261 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconButtonDemo.swift +58 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ImageDemo.swift +78 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InformationDemo.swift +138 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDemo.swift +111 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDropDownDemo.swift +136 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputMoneyDemo.swift +107 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputOTPDemo.swift +73 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +100 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputSearchDemo.swift +32 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputTextAreaDemo.swift +57 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LoaderDemo.swift +70 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +227 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PaginationDemo.swift +72 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +175 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +121 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +76 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ProgressInfoDemo.swift +89 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RadioDemo.swift +32 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RatingDemo.swift +56 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SkeletonDemo.swift +32 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SliderDemo.swift +150 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SnackBarDemo.swift +138 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepperDemo.swift +103 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepsDemo.swift +94 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SuggestActionDemo.swift +79 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwipeDemo.swift +152 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwitchDemo.swift +33 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TabViewDemo.swift +190 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TagDemo.swift +34 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ThemeDemo.swift +182 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TitleDemo.swift +109 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TooltipDemo.swift +187 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +87 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/UploaderDemo.swift +131 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SwiftUIDemoBrowserView.swift +50 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoModels.swift +15 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoRegistry.swift +73 -0
- package/local.properties +8 -0
- package/package.json +1 -1
- package/publish.sh +50 -0
- package/scripts/gen-ios-color.mjs +136 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
//
|
|
2
|
+
// TitleDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
import SwiftUI
|
|
6
|
+
import MoMoUIKits
|
|
7
|
+
|
|
8
|
+
struct TitleDemo: View {
|
|
9
|
+
var body: some View {
|
|
10
|
+
ScrollView {
|
|
11
|
+
VStack(alignment: .leading, spacing: 24) {
|
|
12
|
+
section("Section Type") {
|
|
13
|
+
Title(
|
|
14
|
+
title: "Section Small",
|
|
15
|
+
type: .section,
|
|
16
|
+
size: .small
|
|
17
|
+
)
|
|
18
|
+
Title(
|
|
19
|
+
title: "Section Medium",
|
|
20
|
+
type: .section,
|
|
21
|
+
size: .medium,
|
|
22
|
+
icon: "basic_home",
|
|
23
|
+
description: "This is a medium section with icon."
|
|
24
|
+
)
|
|
25
|
+
Title(
|
|
26
|
+
title: "Section Large",
|
|
27
|
+
type: .section,
|
|
28
|
+
size: .large,
|
|
29
|
+
showTrailingAction: true,
|
|
30
|
+
badgeLabel: "NEW",
|
|
31
|
+
onPressTrailingAction: { }
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
section("Card Type") {
|
|
36
|
+
Title(
|
|
37
|
+
title: "Card Small Text Only",
|
|
38
|
+
type: .card,
|
|
39
|
+
size: .small,
|
|
40
|
+
textOnly: true
|
|
41
|
+
)
|
|
42
|
+
Title(
|
|
43
|
+
title: "Card Medium with Right Action",
|
|
44
|
+
type: .card,
|
|
45
|
+
size: .medium,
|
|
46
|
+
icon: "basic_home",
|
|
47
|
+
showRightAction: true,
|
|
48
|
+
buttonTitle: "Action",
|
|
49
|
+
onPressRightAction: { }
|
|
50
|
+
)
|
|
51
|
+
Title(
|
|
52
|
+
title: "Card Large Full",
|
|
53
|
+
type: .card,
|
|
54
|
+
size: .large,
|
|
55
|
+
icon: "basic_home",
|
|
56
|
+
showRightAction: true,
|
|
57
|
+
badgeLabel: "99+",
|
|
58
|
+
onPressRightAction: { },
|
|
59
|
+
description: "A large card title with description, badge and right arrow."
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
section("Icon Alignment") {
|
|
64
|
+
Title(
|
|
65
|
+
title: "Icon Top",
|
|
66
|
+
type: .section,
|
|
67
|
+
icon: "basic_home",
|
|
68
|
+
iconAlign: .top,
|
|
69
|
+
description: "Icon aligned to top"
|
|
70
|
+
)
|
|
71
|
+
Title(
|
|
72
|
+
title: "Icon Center",
|
|
73
|
+
type: .section,
|
|
74
|
+
icon: "basic_home",
|
|
75
|
+
iconAlign: .center,
|
|
76
|
+
description: "Icon aligned to center"
|
|
77
|
+
)
|
|
78
|
+
Title(
|
|
79
|
+
title: "Icon Bottom",
|
|
80
|
+
type: .section,
|
|
81
|
+
icon: "basic_home",
|
|
82
|
+
iconAlign: .bottom,
|
|
83
|
+
description: "Icon aligned to bottom"
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
.padding(16)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@ViewBuilder
|
|
92
|
+
private func section<Content: View>(
|
|
93
|
+
_ title: String,
|
|
94
|
+
@ViewBuilder content: () -> Content
|
|
95
|
+
) -> some View {
|
|
96
|
+
VStack(alignment: .leading, spacing: 8) {
|
|
97
|
+
MomoText(title, typography: .headerSSemibold, color: Colors.textSecondary)
|
|
98
|
+
content()
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
struct TitleDemo_Previews: PreviewProvider {
|
|
104
|
+
static var previews: some View {
|
|
105
|
+
NavigationView {
|
|
106
|
+
TitleDemo()
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
//
|
|
2
|
+
// TooltipDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
import Foundation
|
|
7
|
+
import MoMoUIKits
|
|
8
|
+
import SwiftUI
|
|
9
|
+
|
|
10
|
+
// MARK: - TooltipDemo
|
|
11
|
+
|
|
12
|
+
struct TooltipDemo: View {
|
|
13
|
+
// Placement
|
|
14
|
+
@StateObject private var topState = TooltipState()
|
|
15
|
+
@StateObject private var bottomState = TooltipState()
|
|
16
|
+
@StateObject private var leftState = TooltipState()
|
|
17
|
+
@StateObject private var rightState = TooltipState()
|
|
18
|
+
|
|
19
|
+
// Alignment
|
|
20
|
+
@StateObject private var startState = TooltipState()
|
|
21
|
+
@StateObject private var centerState = TooltipState()
|
|
22
|
+
@StateObject private var endState = TooltipState()
|
|
23
|
+
|
|
24
|
+
// With Buttons
|
|
25
|
+
@StateObject private var singleBtnState = TooltipState()
|
|
26
|
+
@StateObject private var twoBtnState = TooltipState()
|
|
27
|
+
|
|
28
|
+
// Description Only
|
|
29
|
+
@StateObject private var descState = TooltipState()
|
|
30
|
+
|
|
31
|
+
var body: some View {
|
|
32
|
+
ScrollView {
|
|
33
|
+
VStack(alignment: .leading, spacing: 48) {
|
|
34
|
+
// MARK: - Placement
|
|
35
|
+
|
|
36
|
+
section("Placement") {
|
|
37
|
+
Tooltip(
|
|
38
|
+
state: topState,
|
|
39
|
+
title: "Top",
|
|
40
|
+
description: "Tooltip on top of the anchor.",
|
|
41
|
+
placement: .top,
|
|
42
|
+
onPressClose: { topState.hide() }
|
|
43
|
+
) {
|
|
44
|
+
Button(title: "Top", action: { topState.toggle() }, size: .small, isFull: false)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
Tooltip(
|
|
48
|
+
state: bottomState,
|
|
49
|
+
title: "Bottom",
|
|
50
|
+
description: "Tooltip below the anchor.",
|
|
51
|
+
placement: .bottom,
|
|
52
|
+
onPressClose: { bottomState.hide() }
|
|
53
|
+
) {
|
|
54
|
+
Button(title: "Bottom", action: { bottomState.toggle() }, size: .small, isFull: false)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
HStack {
|
|
58
|
+
Tooltip(
|
|
59
|
+
state: rightState,
|
|
60
|
+
title: "Right",
|
|
61
|
+
description: "Tooltip on the right.",
|
|
62
|
+
placement: .right,
|
|
63
|
+
onPressClose: { rightState.hide() }
|
|
64
|
+
) {
|
|
65
|
+
Button(title: "Right", action: { rightState.toggle() }, size: .small, isFull: false)
|
|
66
|
+
}
|
|
67
|
+
Spacer().frame(width: 12)
|
|
68
|
+
Tooltip(
|
|
69
|
+
state: leftState,
|
|
70
|
+
title: "Left",
|
|
71
|
+
description: "Tooltip on the left.",
|
|
72
|
+
placement: .left,
|
|
73
|
+
onPressClose: { leftState.hide() }
|
|
74
|
+
) {
|
|
75
|
+
Button(title: "Left", action: { leftState.toggle() }, size: .small, isFull: false)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// MARK: - Alignment
|
|
81
|
+
|
|
82
|
+
section("Alignment") {
|
|
83
|
+
Tooltip(
|
|
84
|
+
state: startState,
|
|
85
|
+
title: "Start",
|
|
86
|
+
description: "Aligned to start.",
|
|
87
|
+
placement: .bottom,
|
|
88
|
+
align: .start,
|
|
89
|
+
onPressClose: { startState.hide() }
|
|
90
|
+
) {
|
|
91
|
+
Button(title: "Start", action: { startState.toggle() }, size: .small, isFull: false)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
Tooltip(
|
|
95
|
+
state: centerState,
|
|
96
|
+
title: "Center",
|
|
97
|
+
description: "Aligned to center.",
|
|
98
|
+
placement: .bottom,
|
|
99
|
+
align: .center,
|
|
100
|
+
onPressClose: { centerState.hide() }
|
|
101
|
+
) {
|
|
102
|
+
Button(title: "Center", action: { centerState.toggle() }, size: .small, isFull: false)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
Tooltip(
|
|
106
|
+
state: endState,
|
|
107
|
+
title: "End",
|
|
108
|
+
description: "Aligned to end.",
|
|
109
|
+
placement: .bottom,
|
|
110
|
+
align: .end,
|
|
111
|
+
onPressClose: { endState.hide() }
|
|
112
|
+
) {
|
|
113
|
+
Button(title: "End", action: { endState.toggle() }, size: .small, isFull: false)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// MARK: - With Buttons
|
|
118
|
+
|
|
119
|
+
section("With Buttons") {
|
|
120
|
+
Tooltip(
|
|
121
|
+
state: singleBtnState,
|
|
122
|
+
title: "Single Button",
|
|
123
|
+
description: "Tooltip with one action button.",
|
|
124
|
+
buttons: [
|
|
125
|
+
TooltipButton(title: "Got it", onPress: { singleBtnState.hide() })
|
|
126
|
+
],
|
|
127
|
+
placement: .bottom,
|
|
128
|
+
onPressClose: { singleBtnState.hide() }
|
|
129
|
+
) {
|
|
130
|
+
Button(title: "1 Button", action: { singleBtnState.toggle() }, size: .small, isFull: false)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
Tooltip(
|
|
134
|
+
state: twoBtnState,
|
|
135
|
+
title: "Two Buttons",
|
|
136
|
+
description: "Tooltip with primary and secondary actions.",
|
|
137
|
+
buttons: [
|
|
138
|
+
TooltipButton(title: "Confirm", onPress: { twoBtnState.hide() }),
|
|
139
|
+
TooltipButton(title: "Cancel", onPress: { twoBtnState.hide() })
|
|
140
|
+
],
|
|
141
|
+
placement: .bottom,
|
|
142
|
+
onPressClose: { twoBtnState.hide() }
|
|
143
|
+
) {
|
|
144
|
+
Button(title: "2 Buttons", action: { twoBtnState.toggle() }, size: .small, isFull: false)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// MARK: - Description Only
|
|
149
|
+
|
|
150
|
+
section("Description Only") {
|
|
151
|
+
Tooltip(
|
|
152
|
+
state: descState,
|
|
153
|
+
description: "This tooltip has no title, just a description.",
|
|
154
|
+
placement: .top,
|
|
155
|
+
onPressClose: { descState.hide() }
|
|
156
|
+
) {
|
|
157
|
+
Button(title: "No Title", action: { descState.toggle() }, size: .small, isFull: false)
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
.padding(.vertical, 48)
|
|
162
|
+
.padding(.horizontal, 16)
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// MARK: - Helpers
|
|
167
|
+
|
|
168
|
+
@ViewBuilder
|
|
169
|
+
private func section<Content: View>(
|
|
170
|
+
_ title: String,
|
|
171
|
+
@ViewBuilder content: () -> Content
|
|
172
|
+
) -> some View {
|
|
173
|
+
VStack(alignment: .leading, spacing: 24) {
|
|
174
|
+
Text(title)
|
|
175
|
+
.font(.headline)
|
|
176
|
+
content()
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
#if DEBUG
|
|
182
|
+
struct TooltipDemo_Previews: PreviewProvider {
|
|
183
|
+
static var previews: some View {
|
|
184
|
+
TooltipDemo()
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
#endif
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
//
|
|
2
|
+
// TypographyDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
// Created by dung.pham2 on 29/11/24.
|
|
6
|
+
//
|
|
7
|
+
import SwiftUI
|
|
8
|
+
import MoMoUIKits
|
|
9
|
+
|
|
10
|
+
struct TypographyDemo: View {
|
|
11
|
+
var body: some View {
|
|
12
|
+
ScrollView {
|
|
13
|
+
VStack(alignment: .leading, spacing: 12) {
|
|
14
|
+
// New supported typography styles
|
|
15
|
+
MomoText("Headline Default Bold", typography: .headlineDefaultBold)
|
|
16
|
+
.background(Color.red.opacity(0.3))
|
|
17
|
+
.cornerRadius(4)
|
|
18
|
+
MomoText("Header M Bold", typography: .headerMBold)
|
|
19
|
+
.background(Color.orange.opacity(0.3))
|
|
20
|
+
.cornerRadius(4)
|
|
21
|
+
MomoText("Header Default Bold", typography: .headerDefaultBold)
|
|
22
|
+
.background(Color.yellow.opacity(0.3))
|
|
23
|
+
.cornerRadius(4)
|
|
24
|
+
MomoText("Header S Semibold", typography: .headerSSemibold)
|
|
25
|
+
.background(Color.green.opacity(0.3))
|
|
26
|
+
.cornerRadius(4)
|
|
27
|
+
MomoText("Header XS Semibold", typography: .headerXsSemibold)
|
|
28
|
+
.background(Color.blue.opacity(0.3))
|
|
29
|
+
.cornerRadius(4)
|
|
30
|
+
|
|
31
|
+
Divider().padding(.vertical, 8)
|
|
32
|
+
|
|
33
|
+
// Body Default Regular
|
|
34
|
+
MomoText("Body Default Regular", typography: .bodyDefaultRegular)
|
|
35
|
+
.background(Color.purple.opacity(0.3))
|
|
36
|
+
.cornerRadius(4)
|
|
37
|
+
MomoText("Description Default Regular", typography: .descriptionDefaultRegular)
|
|
38
|
+
.background(Color.pink.opacity(0.3))
|
|
39
|
+
.cornerRadius(4)
|
|
40
|
+
MomoText("Description XS Regular", typography: .descriptionXsRegular)
|
|
41
|
+
.background(Color.gray.opacity(0.3))
|
|
42
|
+
.cornerRadius(4)
|
|
43
|
+
|
|
44
|
+
Divider().padding(.vertical, 8)
|
|
45
|
+
|
|
46
|
+
// Label Default Medium
|
|
47
|
+
MomoText("Label Default Medium", typography: .labelDefaultMedium)
|
|
48
|
+
.background(Color.red.opacity(0.3))
|
|
49
|
+
.cornerRadius(4)
|
|
50
|
+
MomoText("Label S Medium", typography: .labelSMedium)
|
|
51
|
+
.background(Color.orange.opacity(0.3))
|
|
52
|
+
.cornerRadius(4)
|
|
53
|
+
MomoText("Label XS Medium", typography: .labelXsMedium)
|
|
54
|
+
.background(Color.yellow.opacity(0.3))
|
|
55
|
+
.cornerRadius(4)
|
|
56
|
+
|
|
57
|
+
Divider().padding(.vertical, 8)
|
|
58
|
+
|
|
59
|
+
// Action Default Bold
|
|
60
|
+
MomoText("Action Default Bold", typography: .actionDefaultBold)
|
|
61
|
+
.background(Color.green.opacity(0.3))
|
|
62
|
+
.cornerRadius(4)
|
|
63
|
+
MomoText("Action S Bold", typography: .actionSBold)
|
|
64
|
+
.background(Color.blue.opacity(0.3))
|
|
65
|
+
.cornerRadius(4)
|
|
66
|
+
MomoText("Action XS Bold", typography: .actionXsBold)
|
|
67
|
+
.background(Color.purple.opacity(0.3))
|
|
68
|
+
.cornerRadius(4)
|
|
69
|
+
MomoText("Action XXS Bold", typography: .actionXxsBold)
|
|
70
|
+
.background(Color.pink.opacity(0.3))
|
|
71
|
+
.cornerRadius(4)
|
|
72
|
+
|
|
73
|
+
Divider().padding(.vertical, 16)
|
|
74
|
+
}
|
|
75
|
+
.padding(16)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
struct TypographyDemo_Previews: PreviewProvider {
|
|
81
|
+
static var previews: some View {
|
|
82
|
+
NavigationView {
|
|
83
|
+
TypographyDemo()
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
//
|
|
2
|
+
// UploaderDemo.swift
|
|
3
|
+
// Example
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
import SwiftUI
|
|
7
|
+
import MoMoUIKits
|
|
8
|
+
|
|
9
|
+
struct UploaderDemo: View {
|
|
10
|
+
private let mockURL = "https://static.momocdn.net/app/img/kits/navigation-bar.png"
|
|
11
|
+
|
|
12
|
+
// Playground state
|
|
13
|
+
@State private var playgroundImages: [UploadImage] = []
|
|
14
|
+
@State private var numberOfImages: Double = 3
|
|
15
|
+
@State private var disabled = false
|
|
16
|
+
@State private var width: Double = 64
|
|
17
|
+
@State private var height: Double = 64
|
|
18
|
+
|
|
19
|
+
var body: some View {
|
|
20
|
+
ScrollView {
|
|
21
|
+
VStack(alignment: .leading, spacing: 24) {
|
|
22
|
+
section("Default — single slot, no images") {
|
|
23
|
+
Uploader(
|
|
24
|
+
images: [],
|
|
25
|
+
numberOfImages: 1,
|
|
26
|
+
onAdd: {}
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
section("With image + cancel button") {
|
|
31
|
+
Uploader(
|
|
32
|
+
images: [UploadImage(uri: mockURL)],
|
|
33
|
+
numberOfImages: 3,
|
|
34
|
+
onAdd: {},
|
|
35
|
+
onCancel: { _, _ in }
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
section("Multiple images (slot full — picker hidden)") {
|
|
40
|
+
Uploader(
|
|
41
|
+
images: [
|
|
42
|
+
UploadImage(uri: mockURL),
|
|
43
|
+
UploadImage(uri: mockURL),
|
|
44
|
+
UploadImage(uri: mockURL),
|
|
45
|
+
],
|
|
46
|
+
numberOfImages: 3,
|
|
47
|
+
onAdd: {},
|
|
48
|
+
onCancel: { _, _ in }
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
section("Loading state") {
|
|
53
|
+
Uploader(
|
|
54
|
+
images: [UploadImage(uri: mockURL, loading: true)],
|
|
55
|
+
numberOfImages: 3,
|
|
56
|
+
onAdd: {},
|
|
57
|
+
onCancel: { _, _ in }
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
section("Disabled") {
|
|
62
|
+
Uploader(
|
|
63
|
+
images: [],
|
|
64
|
+
numberOfImages: 1,
|
|
65
|
+
disabled: true,
|
|
66
|
+
onAdd: {}
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
section("Custom size (80 x 80)") {
|
|
71
|
+
Uploader(
|
|
72
|
+
images: [UploadImage(uri: mockURL)],
|
|
73
|
+
numberOfImages: 3,
|
|
74
|
+
width: 80,
|
|
75
|
+
height: 80,
|
|
76
|
+
onAdd: {},
|
|
77
|
+
onCancel: { _, _ in }
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
Divider()
|
|
82
|
+
|
|
83
|
+
section("Playground") {
|
|
84
|
+
VStack(alignment: .leading, spacing: 12) {
|
|
85
|
+
Uploader(
|
|
86
|
+
images: playgroundImages,
|
|
87
|
+
numberOfImages: Int(numberOfImages),
|
|
88
|
+
disabled: disabled,
|
|
89
|
+
width: CGFloat(width),
|
|
90
|
+
height: CGFloat(height),
|
|
91
|
+
onAdd: {
|
|
92
|
+
playgroundImages.append(UploadImage(uri: mockURL))
|
|
93
|
+
},
|
|
94
|
+
onCancel: { _, index in
|
|
95
|
+
if playgroundImages.indices.contains(index) {
|
|
96
|
+
playgroundImages.remove(at: index)
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
onPressImage: { _, _ in }
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
VStack(alignment: .leading, spacing: 4) {
|
|
103
|
+
Text("numberOfImages: \(Int(numberOfImages))")
|
|
104
|
+
Slider(value: $numberOfImages, in: 1...6, step: 1)
|
|
105
|
+
|
|
106
|
+
Toggle("disabled", isOn: $disabled)
|
|
107
|
+
|
|
108
|
+
Text("width: \(Int(width))")
|
|
109
|
+
Slider(value: $width, in: 48...120, step: 1)
|
|
110
|
+
|
|
111
|
+
Text("height: \(Int(height))")
|
|
112
|
+
Slider(value: $height, in: 48...120, step: 1)
|
|
113
|
+
}
|
|
114
|
+
.font(.footnote)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
.padding()
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@ViewBuilder
|
|
123
|
+
private func section<Content: View>(_ title: String, @ViewBuilder content: () -> Content) -> some View {
|
|
124
|
+
VStack(alignment: .leading, spacing: 8) {
|
|
125
|
+
Text(title)
|
|
126
|
+
.font(.subheadline)
|
|
127
|
+
.foregroundColor(.secondary)
|
|
128
|
+
content()
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import SwiftUI
|
|
2
|
+
import MoMoUIKits
|
|
3
|
+
|
|
4
|
+
struct SwiftUIDemoBrowserView: View {
|
|
5
|
+
let context: MoMoUIKitsDemoContext
|
|
6
|
+
@State private var searchText = ""
|
|
7
|
+
|
|
8
|
+
var body: some View {
|
|
9
|
+
Group {
|
|
10
|
+
if #available(iOS 16.0, *) {
|
|
11
|
+
HomeView()
|
|
12
|
+
} else {
|
|
13
|
+
fallbackBrowser
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
.environment(\.appTheme, defaultTheme)
|
|
17
|
+
.environmentObject(
|
|
18
|
+
ApplicationEnvironment(applicationContext: context.miniAppContext)
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
private var fallbackBrowser: some View {
|
|
23
|
+
NavigationView {
|
|
24
|
+
List {
|
|
25
|
+
ForEach(ScreenUsages) { item in
|
|
26
|
+
NavigationLink(destination: item.destination) {
|
|
27
|
+
MomoText(item.title, typography: .headerDefaultBold)
|
|
28
|
+
.padding(.vertical, 8)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
.listStyle(.insetGrouped)
|
|
33
|
+
.navigationTitle("UI Kits SwiftUI")
|
|
34
|
+
}
|
|
35
|
+
.navigationViewStyle(.stack)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private var filteredSections: [UIKitsDemoSection] {
|
|
39
|
+
guard !searchText.isEmpty else { return UIKitsDemoRegistry.sections }
|
|
40
|
+
|
|
41
|
+
return UIKitsDemoRegistry.sections.compactMap { section in
|
|
42
|
+
let items = section.items.filter { item in
|
|
43
|
+
item.title.localizedCaseInsensitiveContains(searchText)
|
|
44
|
+
|| item.subtitle.localizedCaseInsensitiveContains(searchText)
|
|
45
|
+
}
|
|
46
|
+
guard !items.isEmpty else { return nil }
|
|
47
|
+
return UIKitsDemoSection(id: section.id, title: section.title, items: items)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import SwiftUI
|
|
2
|
+
|
|
3
|
+
struct UIKitsDemoItem: Identifiable {
|
|
4
|
+
let id: String
|
|
5
|
+
let title: String
|
|
6
|
+
let subtitle: String
|
|
7
|
+
let destination: AnyView
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
struct UIKitsDemoSection: Identifiable {
|
|
11
|
+
let id: String
|
|
12
|
+
let title: String
|
|
13
|
+
let items: [UIKitsDemoItem]
|
|
14
|
+
}
|
|
15
|
+
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import SwiftUI
|
|
2
|
+
|
|
3
|
+
enum UIKitsDemoRegistry {
|
|
4
|
+
static let sections: [UIKitsDemoSection] = [
|
|
5
|
+
UIKitsDemoSection(
|
|
6
|
+
id: "components",
|
|
7
|
+
title: "Components",
|
|
8
|
+
items: [
|
|
9
|
+
UIKitsDemoItem(
|
|
10
|
+
id: "typography",
|
|
11
|
+
title: "Typography",
|
|
12
|
+
subtitle: "Text styles and semantic colors",
|
|
13
|
+
destination: AnyView(UIKitsTypographyDemoView())
|
|
14
|
+
),
|
|
15
|
+
UIKitsDemoItem(
|
|
16
|
+
id: "button",
|
|
17
|
+
title: "Button",
|
|
18
|
+
subtitle: "Primary, secondary, outline, loading",
|
|
19
|
+
destination: AnyView(UIKitsButtonDemoView())
|
|
20
|
+
),
|
|
21
|
+
UIKitsDemoItem(
|
|
22
|
+
id: "badge",
|
|
23
|
+
title: "Badge",
|
|
24
|
+
subtitle: "Numeric and label badges",
|
|
25
|
+
destination: AnyView(UIKitsBadgeDemoView())
|
|
26
|
+
),
|
|
27
|
+
UIKitsDemoItem(
|
|
28
|
+
id: "chip",
|
|
29
|
+
title: "Chip",
|
|
30
|
+
subtitle: "Selectable labels and compact filters",
|
|
31
|
+
destination: AnyView(UIKitsChipDemoView())
|
|
32
|
+
)
|
|
33
|
+
]
|
|
34
|
+
),
|
|
35
|
+
UIKitsDemoSection(
|
|
36
|
+
id: "inputs",
|
|
37
|
+
title: "Inputs",
|
|
38
|
+
items: [
|
|
39
|
+
UIKitsDemoItem(
|
|
40
|
+
id: "input",
|
|
41
|
+
title: "Input",
|
|
42
|
+
subtitle: "Text, error, password, disabled states",
|
|
43
|
+
destination: AnyView(UIKitsInputDemoView())
|
|
44
|
+
),
|
|
45
|
+
UIKitsDemoItem(
|
|
46
|
+
id: "checkbox",
|
|
47
|
+
title: "Checkbox",
|
|
48
|
+
subtitle: "Checked, indeterminate, disabled",
|
|
49
|
+
destination: AnyView(UIKitsCheckboxDemoView())
|
|
50
|
+
),
|
|
51
|
+
UIKitsDemoItem(
|
|
52
|
+
id: "radio",
|
|
53
|
+
title: "Radio",
|
|
54
|
+
subtitle: "Single choice controls",
|
|
55
|
+
destination: AnyView(UIKitsRadioDemoView())
|
|
56
|
+
)
|
|
57
|
+
]
|
|
58
|
+
),
|
|
59
|
+
UIKitsDemoSection(
|
|
60
|
+
id: "feedback",
|
|
61
|
+
title: "Feedback",
|
|
62
|
+
items: [
|
|
63
|
+
UIKitsDemoItem(
|
|
64
|
+
id: "popup",
|
|
65
|
+
title: "Popup Notify",
|
|
66
|
+
subtitle: "Notification popup content and actions",
|
|
67
|
+
destination: AnyView(UIKitsPopupDemoView())
|
|
68
|
+
)
|
|
69
|
+
]
|
|
70
|
+
)
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
|
package/local.properties
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
#Tue Jun 02 17:05:32 ICT 2026
|
|
8
|
+
sdk.dir=/Users/sophia/Library/Android/sdk
|