@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.
Files changed (149) hide show
  1. package/.claude/settings.local.json +55 -0
  2. package/compose/build.gradle.kts +1 -1
  3. package/compose/compose.podspec +1 -1
  4. package/gradle.properties +1 -1
  5. package/ios/Application/Components.swift +34 -43
  6. package/ios/Application/FloatingButton.swift +10 -8
  7. package/ios/Application/Navigation/BottomTab/BottomTab.swift +102 -0
  8. package/ios/Application/Navigation/BottomTab/BottomTabBar.swift +215 -0
  9. package/ios/Application/Navigation/BottomTab/CurvedContainer.swift +65 -0
  10. package/ios/Application/Navigation/HeaderBackProps.swift +66 -0
  11. package/ios/Application/Navigation/HeaderTitle.swift +57 -0
  12. package/ios/Application/Navigation/HeaderUser.swift +209 -0
  13. package/ios/Application/Navigation/NavigationContainer.swift +151 -0
  14. package/ios/Application/Navigation/NavigationOptions.swift +109 -0
  15. package/ios/Application/Navigation/Navigator.swift +360 -0
  16. package/ios/Application/Navigation/Overplay/BottomSheet.swift +176 -0
  17. package/ios/Application/Navigation/Overplay/ModalScreen.swift +68 -0
  18. package/ios/Application/Navigation/Overplay/SnackBar.swift +144 -0
  19. package/ios/Application/Navigation/component/Header.swift +178 -0
  20. package/ios/Application/Navigation/component/HeaderBackground.swift +83 -0
  21. package/ios/Application/Navigation/component/HeaderColor.swift +65 -0
  22. package/ios/Application/StackScreen.swift +449 -0
  23. package/ios/Avatar/Avatar.swift +193 -0
  24. package/ios/Badge/Badge.swift +11 -13
  25. package/ios/Badge/BadgeRibbon.swift +12 -19
  26. package/ios/BaselineView/BaselineView.swift +163 -0
  27. package/ios/Button/Button.swift +62 -23
  28. package/ios/Carousel/Carousel.swift +181 -0
  29. package/ios/Checkbox/Checkbox.swift +14 -12
  30. package/ios/Chip/Chip.swift +23 -9
  31. package/ios/Collapse/Collapse.swift +182 -0
  32. package/ios/Colors+Radius+Spacing/Colors.swift +1 -1
  33. package/ios/Colors+Radius+Spacing/Theme.swift +295 -0
  34. package/ios/DateTimePicker/DateTimePicker.swift +210 -0
  35. package/ios/DateTimePicker/DateTimePickerTypes.swift +55 -0
  36. package/ios/DateTimePicker/DateTimePickerUtils.swift +167 -0
  37. package/ios/DateTimePicker/WheelPicker.swift +161 -0
  38. package/ios/Divider/Divider.swift +16 -0
  39. package/ios/Icon/Icon.swift +6 -1
  40. package/ios/IconButton/IconButton.swift +112 -0
  41. package/ios/Information/Information.swift +151 -0
  42. package/ios/Input/Input.swift +42 -25
  43. package/ios/Input/InputPhoneNumber.swift +21 -19
  44. package/ios/Input/InputSearch.swift +101 -45
  45. package/ios/Input/InputTextArea.swift +67 -40
  46. package/ios/InputDropDown/InputDropDown.swift +198 -0
  47. package/ios/InputMoney/InputMoney.swift +335 -0
  48. package/ios/InputOTP/InputOTP.swift +210 -0
  49. package/ios/Loader/Loader.swift +113 -0
  50. package/ios/MoMoUIKits.podspec +5 -0
  51. package/ios/OTPKeyboard/KeyboardButton.swift +1 -1
  52. package/ios/Pagination/PaginationDot.swift +61 -0
  53. package/ios/Pagination/PaginationNumber.swift +35 -0
  54. package/ios/Pagination/PaginationScroll.swift +101 -0
  55. package/ios/Pagination/PaginationWhiteDot.swift +37 -0
  56. package/ios/Popup/PopupDisplay.swift +10 -12
  57. package/ios/Popup/PopupInput.swift +2 -6
  58. package/ios/Popup/PopupNotify.swift +219 -0
  59. package/ios/ProgressInfo/ProgressInfo.swift +294 -0
  60. package/ios/Radio/Radio.swift +70 -0
  61. package/ios/Rating/Rating.swift +82 -0
  62. package/ios/Skeleton/Skeleton.swift +99 -0
  63. package/ios/Slider/Slider.swift +237 -0
  64. package/ios/Stepper/Stepper.swift +220 -0
  65. package/ios/Steps/Steps.swift +451 -0
  66. package/ios/SuggestAction/SuggestAction.swift +97 -0
  67. package/ios/Swipeable/SwipeCell.swift +185 -0
  68. package/ios/Swipeable/SwipeCellModel.swift +21 -0
  69. package/ios/TabView/TabView.swift +530 -0
  70. package/ios/Tag/Tag.swift +98 -0
  71. package/ios/Template/TrustBanner/TrustBanner.swift +2 -0
  72. package/ios/Title/Title.swift +269 -0
  73. package/ios/Tooltip/Tooltip.swift +482 -0
  74. package/ios/Typography/Text.swift +77 -5
  75. package/ios/Typography/Typography.swift +9 -0
  76. package/ios/Uploader/Uploader.swift +183 -0
  77. package/ios/native-kits.podspec +58 -8
  78. package/ios-demo/MoMoUIKitsDemo.podspec +18 -0
  79. package/ios-demo/README.md +120 -0
  80. package/ios-demo/Resources/dot_loading.json +558 -0
  81. package/ios-demo/Resources/icon.json +4052 -0
  82. package/ios-demo/Resources/lottie_circle_loader.json +1 -0
  83. package/ios-demo/Sources/MoMoUIKitsDemo/DemoScaffold.swift +48 -0
  84. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsBadgeDemoView.swift +25 -0
  85. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsButtonDemoView.swift +26 -0
  86. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsCheckboxDemoView.swift +19 -0
  87. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsChipDemoView.swift +33 -0
  88. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsInputDemoView.swift +48 -0
  89. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsPopupDemoView.swift +21 -0
  90. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsRadioDemoView.swift +17 -0
  91. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsTypographyDemoView.swift +28 -0
  92. package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoContext.swift +31 -0
  93. package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoFactory.swift +72 -0
  94. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +110 -0
  95. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AvatarDemo.swift +93 -0
  96. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BadgeDemo.swift +269 -0
  97. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BaselineView.swift +117 -0
  98. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +89 -0
  99. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ButtonDemo.swift +100 -0
  100. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CarouselDemo.swift +126 -0
  101. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CheckboxDemo.swift +63 -0
  102. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ChipDemo.swift +20 -0
  103. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CollapseDemo.swift +93 -0
  104. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +107 -0
  105. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DateTimePickerDemo.swift +124 -0
  106. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DividerDemo.swift +14 -0
  107. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/HeaderUserDemo.swift +49 -0
  108. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +261 -0
  109. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconButtonDemo.swift +58 -0
  110. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ImageDemo.swift +78 -0
  111. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InformationDemo.swift +138 -0
  112. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDemo.swift +111 -0
  113. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDropDownDemo.swift +136 -0
  114. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputMoneyDemo.swift +107 -0
  115. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputOTPDemo.swift +73 -0
  116. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +100 -0
  117. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputSearchDemo.swift +32 -0
  118. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputTextAreaDemo.swift +57 -0
  119. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LoaderDemo.swift +70 -0
  120. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +227 -0
  121. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PaginationDemo.swift +72 -0
  122. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +175 -0
  123. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +121 -0
  124. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +76 -0
  125. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ProgressInfoDemo.swift +89 -0
  126. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RadioDemo.swift +32 -0
  127. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RatingDemo.swift +56 -0
  128. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SkeletonDemo.swift +32 -0
  129. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SliderDemo.swift +150 -0
  130. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SnackBarDemo.swift +138 -0
  131. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepperDemo.swift +103 -0
  132. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepsDemo.swift +94 -0
  133. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SuggestActionDemo.swift +79 -0
  134. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwipeDemo.swift +152 -0
  135. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwitchDemo.swift +33 -0
  136. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TabViewDemo.swift +190 -0
  137. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TagDemo.swift +34 -0
  138. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ThemeDemo.swift +182 -0
  139. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TitleDemo.swift +109 -0
  140. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TooltipDemo.swift +187 -0
  141. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +87 -0
  142. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/UploaderDemo.swift +131 -0
  143. package/ios-demo/Sources/MoMoUIKitsDemo/SwiftUIDemoBrowserView.swift +50 -0
  144. package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoModels.swift +15 -0
  145. package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoRegistry.swift +73 -0
  146. package/local.properties +8 -0
  147. package/package.json +1 -1
  148. package/publish.sh +50 -0
  149. package/scripts/gen-ios-color.mjs +136 -0
@@ -0,0 +1,261 @@
1
+ //
2
+ // Home.swift
3
+ // Example
4
+ //
5
+ // Created by sophia on 7/2/25.
6
+ //
7
+
8
+ import SwiftUI
9
+ import MoMoUIKits
10
+
11
+ public struct ScreenUsage: Hashable, Identifiable {
12
+ public let id = UUID()
13
+ public let title: String
14
+ public let destination: AnyView
15
+ public let icon: String
16
+
17
+ public init(title: String, destination: AnyView, icon: String) {
18
+ self.title = title
19
+ self.destination = destination
20
+ self.icon = icon
21
+ }
22
+
23
+ public static func == (lhs: ScreenUsage, rhs: ScreenUsage) -> Bool {
24
+ lhs.id == rhs.id
25
+ }
26
+
27
+ public func hash(into hasher: inout Hasher) {
28
+ hasher.combine(id)
29
+ }
30
+ }
31
+
32
+ public func getIcon(icon: String) -> String {
33
+ return "https://static.momocdn.net/app/img/kits/UIKIT/\(icon).png"
34
+ }
35
+
36
+ public let ScreenUsages: [ScreenUsage] = [
37
+ // ScreenUsage(title: "ScreenUsage", destination: AnyView(ContentView()), icon: getIcon(icon: "Layout")),
38
+ ScreenUsage(title: "Badge", destination: AnyView(BadgeDemo()), icon: getIcon(icon: "Badge")),
39
+ ScreenUsage(title: "Button", destination: AnyView(ButtonDemo()), icon: getIcon(icon: "Button")),
40
+ ScreenUsage(title: "CheckBox", destination: AnyView(CheckboxDemo()), icon: getIcon(icon: "Checkbox")),
41
+ ScreenUsage(title: "Chip", destination: AnyView(ChipDemo()), icon: getIcon(icon: "Chip")),
42
+ // ScreenUsage(title: "IconButton", destination: AnyView(ContentView()), icon: getIcon(icon: "Button")),
43
+ // ScreenUsage(title: "Icon", destination: AnyView(ContentView()), icon: getIcon(icon: "Icon")),
44
+ ScreenUsage(title: "Image", destination: AnyView(ImageDemo()), icon: getIcon(icon: "Layout")),
45
+ ScreenUsage(title: "Baseline View", destination: AnyView(BaselineViewDemo()), icon: getIcon(icon: "Layout")),
46
+ // ScreenUsage(title: "InputMoney", destination: AnyView(ContentView()), icon: getIcon(icon: "FormInput")),
47
+ ScreenUsage(title: "Input", destination: AnyView(InputDemo()), icon: getIcon(icon: "FormInput")),
48
+ ScreenUsage(title: "Input Phone Number", destination: AnyView(InputPhoneNumberDemo()), icon: getIcon(icon: "FormInput")),
49
+ ScreenUsage(title: "InputTextArea", destination: AnyView(InputTextAreaDemo()), icon: getIcon(icon: "FormInput")),
50
+ ScreenUsage(title: "InputSearch", destination: AnyView(InputSearchDemo()), icon: getIcon(icon: "FormInput")),
51
+ // ScreenUsage(title: "Pagination", destination: AnyView(ContentView()), icon: getIcon(icon: "Badge")),
52
+ // ScreenUsage(title: "InputDropdown", destination: AnyView(ContentView()), icon: getIcon(icon: "FormInput")),
53
+ ScreenUsage(title: "PopupNotify", destination: AnyView(PopupNotifyDemo()), icon: getIcon(icon: "Popup")),
54
+ ScreenUsage(title: "PopupPromotion", destination: AnyView(PopupPromotionDemo()), icon: getIcon(icon: "Popup")),
55
+ ScreenUsage(title: "SnackBar", destination: AnyView(SnackBarDemo()), icon: getIcon(icon: "Popup")),
56
+ // ScreenUsage(title: "Radio", destination: AnyView(ContentView()), icon: getIcon(icon: "Radio")),
57
+ // ScreenUsage(title: "Skeleton", destination: AnyView(ContentView()), icon: getIcon(icon: "Skeleton")),
58
+ ScreenUsage(title: "Switch", destination: AnyView(SwitchDemo()), icon: getIcon(icon: "Toggle")),
59
+ // ScreenUsage(title: "Tag", destination: AnyView(ContentView()), icon: getIcon(icon: "Skeleton")),
60
+ ScreenUsage(title: "Text", destination: AnyView(TypographyDemo()), icon: getIcon(icon: "Typography")),
61
+ // ScreenUsage(title: "TrustBanner", destination: AnyView(TrustBanner(onPress: {_ in })), icon: getIcon(icon: "Typography")),
62
+ ScreenUsage(title: "Information", destination: AnyView(InformationDemo()), icon: getIcon(icon: "Typography")),
63
+ ScreenUsage(title: "Avatar", destination: AnyView(AvatarDemo()), icon: getIcon(icon: "Avatar")),
64
+ ScreenUsage(title: "Carousel", destination: AnyView(CarouselDemo()), icon: getIcon(icon: "Carousel")),
65
+ ScreenUsage(title: "Divider", destination: AnyView(DividerDemo()), icon: getIcon(icon: "Divider")),
66
+ ScreenUsage(title: "IconButton", destination: AnyView(IconButtonDemo()), icon: getIcon(icon: "Button")),
67
+ ScreenUsage(title: "Loader", destination: AnyView(LoaderDemo()), icon: getIcon(icon: "Loader")),
68
+ ScreenUsage(title: "Pagination", destination: AnyView(PaginationDemo()), icon: getIcon(icon: "Badge")),
69
+ ScreenUsage(title: "Radio", destination: AnyView(RadioDemo()), icon: getIcon(icon: "Radio")),
70
+ ScreenUsage(title: "Rating", destination: AnyView(RatingDemo()), icon: getIcon(icon: "Rating")),
71
+ ScreenUsage(title: "Skeleton", destination: AnyView(SkeletonDemo()), icon: getIcon(icon: "Skeleton")),
72
+ ScreenUsage(title: "SuggestAction", destination: AnyView(SuggestActionDemo()), icon: getIcon(icon: "Information")),
73
+ ScreenUsage(title: "Tag", destination: AnyView(TagDemo()), icon: getIcon(icon: "Tag")),
74
+ ScreenUsage(title: "Title", destination: AnyView(TitleDemo()), icon: getIcon(icon: "Typography")),
75
+ ScreenUsage(title: "Collapse", destination: AnyView(CollapseDemo()), icon: getIcon(icon: "Layout")),
76
+ ScreenUsage(title: "Stepper", destination: AnyView(StepperDemo()), icon: getIcon(icon: "Layout")),
77
+ ScreenUsage(title: "Uploader", destination: AnyView(UploaderDemo()), icon: getIcon(icon: "FormInput")),
78
+ ScreenUsage(title: "Swipe", destination: AnyView(SwipeDemo()), icon: getIcon(icon: "Layout")),
79
+ ScreenUsage(title: "InputDropDown", destination: AnyView(InputDropDownDemo()), icon: getIcon(icon: "FormInput")),
80
+ ScreenUsage(title: "InputMoney", destination: AnyView(InputMoneyDemo()), icon: getIcon(icon: "FormInput")),
81
+ ScreenUsage(title: "InputOTP", destination: AnyView(InputOTPDemo()), icon: getIcon(icon: "FormInput")),
82
+ ScreenUsage(title: "ProgressInfo", destination: AnyView(ProgressInfoDemo()), icon: getIcon(icon: "Layout")),
83
+ ScreenUsage(title: "Steps", destination: AnyView(StepsDemo()), icon: getIcon(icon: "Layout")),
84
+ ScreenUsage(title: "Slider", destination: AnyView(SliderDemo()), icon: getIcon(icon: "Layout")),
85
+ ScreenUsage(title: "TabView", destination: AnyView(TabViewDemo()), icon: getIcon(icon: "Layout")),
86
+ ScreenUsage(title: "Tooltip", destination: AnyView(TooltipDemo()), icon: getIcon(icon: "Layout")),
87
+ ScreenUsage(title: "DateTimePicker", destination: AnyView(DateTimePickerDemo()), icon: getIcon(icon: "Layout")),
88
+ ScreenUsage(title: "Navigation", destination: AnyView(NavigationDemo()), icon: getIcon(icon: "Layout")),
89
+ ScreenUsage(title: "Bottom Tab", destination: AnyView(BottomTabDemo()), icon: getIcon(icon: "Layout")),
90
+ ScreenUsage(title: "Animated Header", destination: AnyView(AnimatedHeaderDemo()), icon: getIcon(icon: "Layout")),
91
+ ScreenUsage(title: "Theme", destination: AnyView(ThemeDemo()), icon: getIcon(icon: "Typography")),
92
+ ]
93
+
94
+ @available(iOS 16.0, *)
95
+ public struct HomeView: View {
96
+ // Mirrors Compose's `inputSearch` state: bound into the header search and
97
+ // forwarded into the content for filtering.
98
+ @State private var searchText = ""
99
+
100
+ public init() {}
101
+
102
+ public var body: some View {
103
+ NavigationContainer(
104
+ initialScreen: { HomeContentView(searchText: $searchText) },
105
+ options: NavigationOptions(
106
+ // headerTitle = HeaderTitle.Default("Design System")
107
+ title: "Design System",
108
+ titlePosition: .left,
109
+ // headerType = HeaderType.Extended(useAnimated = true, ...)
110
+ headerType: .extended,
111
+ useAnimated: true,
112
+ // hiddenBack = false
113
+ hiddenBack: false,
114
+ scrollable: true,
115
+ useAvoidKeyboard: true,
116
+ // keyboardOptions = KeyboardOptions(keyboardShouldPersistTaps = true)
117
+ keyboardShouldPersistTaps: true,
118
+ // headerRight = HeaderRight.Toolkit(useShortcut = true)
119
+ headerRight: {
120
+ HeaderRight(headerRight: HeaderRightData(useShortcut: true))
121
+ },
122
+ // footerComponent = { Button("Footer Button") }
123
+ footer: {
124
+ AnyView(
125
+ MoMoUIKits.Button(
126
+ title: "Footer Button",
127
+ action: { print("Footer Button") },
128
+ type: .primary,
129
+ size: .large
130
+ )
131
+ )
132
+ },
133
+ // inputSearchProps = InputSearchProps(text = inputSearch, placeholder = "Search input",
134
+ // searchIcon = { Image("...search_ai.png") }, placeholderCustomRender = { gradient Text }, ...)
135
+ inputSearchProps: InputSearchProps(
136
+ text: $searchText,
137
+ placeholder: "Search input",
138
+ onChangeText: { newText in
139
+ searchText = newText.replacingOccurrences(of: "\n", with: " ")
140
+ },
141
+ searchIcon: {
142
+ AnyView(
143
+ ImageView("https://static.momocdn.net/app/app/appx/search_ai.png")
144
+ .frame(width: 24, height: 24)
145
+ .padding(.trailing, Spacing.S)
146
+ )
147
+ },
148
+ placeholderCustomRender: {
149
+ AnyView(
150
+ Text("Search input")
151
+ .font(.header_xs_semibold)
152
+ .lineLimit(1)
153
+ .foregroundStyle(
154
+ LinearGradient(
155
+ colors: [
156
+ Color(hex: 0x18A0FB),
157
+ Color(hex: 0xA851FF),
158
+ Color(hex: 0xFD5FA9),
159
+ Color(hex: 0xFF9040)
160
+ ],
161
+ startPoint: .topLeading,
162
+ endPoint: .bottomTrailing
163
+ )
164
+ )
165
+ )
166
+ }
167
+ ),
168
+ // floatingButtonProps = FloatingButtonProps(icon = "ic_warning", iconColor = White,
169
+ // label = "Warning", size = DEFAULT, position = END)
170
+ // Note: "ic_warning" is an Android asset key; the closest rendering iOS icon URL is used here.
171
+ fabProps: FabProps(
172
+ icon: "https://static.momocdn.net/app/img/authentication/floating_helper.png",
173
+ iconColor: .white,
174
+ label: "Warning",
175
+ onClick: { print("Warning") },
176
+ containerColor: Colors.primary,
177
+ size: .large,
178
+ scrollOffset: nil,
179
+ position: .right,
180
+ bottomPadding: nil
181
+ )
182
+ )
183
+ )
184
+ }
185
+ }
186
+
187
+ @available(iOS 16.0, *)
188
+ public struct HomeContentView: View {
189
+ // Search lives in the header (inputSearchProps); the bound value flows here
190
+ // for filtering, mirroring Compose's `UIKitHome(searchQuery = inputSearch.value)`.
191
+ @Binding var searchText: String
192
+
193
+ public init(searchText: Binding<String>) {
194
+ self._searchText = searchText
195
+ }
196
+
197
+ private var filteredScreenUsages: [ScreenUsage] {
198
+ if searchText.isEmpty {
199
+ return ScreenUsages
200
+ }
201
+ return ScreenUsages.filter { $0.title.localizedCaseInsensitiveContains(searchText) }
202
+ }
203
+
204
+ public var body: some View {
205
+ ScrollView {
206
+ VStack(alignment: .leading, spacing: 16) {
207
+ HomeItemView(screenUsages: filteredScreenUsages)
208
+ }
209
+ }
210
+ }
211
+ }
212
+
213
+ @available(iOS 16.0, *)
214
+ public struct HomeItemView: View {
215
+ @EnvironmentObject var navigator: Navigator
216
+ let screenUsages: [ScreenUsage]
217
+
218
+ public init(screenUsages: [ScreenUsage]) {
219
+ self.screenUsages = screenUsages
220
+ }
221
+
222
+ public var body: some View {
223
+ ForEach(screenUsages) { screenUsage in
224
+ SwiftUI.Button {
225
+ let options = screenUsage.title == "Bottom Tab"
226
+ ? NavigationOptions(
227
+ title: screenUsage.title,
228
+ headerType: .none,
229
+ scrollable: false
230
+ )
231
+ : NavigationOptions(title: screenUsage.title)
232
+ navigator.push(
233
+ { screenUsage.destination },
234
+ options: options
235
+ )
236
+ } label: {
237
+ itemRow(screenUsage)
238
+ }
239
+ }
240
+ }
241
+
242
+ @ViewBuilder
243
+ private func itemRow(_ screenUsage: ScreenUsage) -> some View {
244
+ VStack(alignment: .leading) {
245
+ HStack {
246
+ ImageView(screenUsage.icon).frame(width: 26, height: 26)
247
+ MomoText(screenUsage.title)
248
+ }
249
+ Divider()
250
+ }
251
+ .padding(.horizontal, 16)
252
+ .padding(.vertical, 8)
253
+ }
254
+ }
255
+
256
+ @available(iOS 16.0, *)
257
+ public struct HomeView_Previews: PreviewProvider {
258
+ public static var previews: some View {
259
+ HomeView()
260
+ }
261
+ }
@@ -0,0 +1,58 @@
1
+ import MoMoUIKits
2
+ import SwiftUI
3
+
4
+ // MARK: - IconButtonDemo
5
+
6
+ struct IconButtonDemo: View {
7
+ var body: some View {
8
+ ScrollView {
9
+ VStack(alignment: .leading, spacing: 24) {
10
+ Group {
11
+ Text("Source")
12
+ .font(.headline)
13
+ HStack(spacing: 12) {
14
+ IconButton(icon: url, onClick: onPress, type: .primary)
15
+ IconButton(icon: url2, onClick: onPress, type: .primary)
16
+ IconButton(icon: url3, onClick: onPress, type: .primary)
17
+ IconButton(icon: url4, onClick: onPress, type: .primary)
18
+ }
19
+ }
20
+
21
+ Group {
22
+ Text("Type")
23
+ .font(.headline)
24
+ HStack(spacing: 12) {
25
+ IconButton(icon: url, onClick: onPress, type: .primary)
26
+ IconButton(icon: url, onClick: onPress, type: .secondary)
27
+ IconButton(icon: url, onClick: onPress, type: .tonal)
28
+ IconButton(icon: url, onClick: onPress, type: .outline)
29
+ IconButton(icon: url, onClick: onPress, type: .disabled)
30
+ IconButton(icon: url, onClick: onPress, type: .danger)
31
+ }
32
+ }
33
+
34
+ Group {
35
+ Text("Size")
36
+ .font(.headline)
37
+ HStack(spacing: 12) {
38
+ IconButton(icon: url, onClick: onPress, type: .primary, size: .large)
39
+ IconButton(icon: url, onClick: onPress, type: .primary, size: .small)
40
+ }
41
+ }
42
+ }
43
+ .padding(16)
44
+ }
45
+ .padding(.top)
46
+ }
47
+
48
+ func onPress() {
49
+ print("IconButton")
50
+ }
51
+
52
+ // MARK: Private
53
+
54
+ private let url = "travel_plane"
55
+ private let url2 = "shopping_coupon"
56
+ private let url3 = "shopping_store"
57
+ private let url4 = "time_alarm_check"
58
+ }
@@ -0,0 +1,78 @@
1
+ //
2
+ // ImageDemo.swift
3
+ // Example
4
+ //
5
+ // Created by dung.pham2 on 2/12/24.
6
+ //
7
+
8
+ import SwiftUI
9
+ import MoMoUIKits
10
+
11
+ struct ImageDemo: View {
12
+ // MARK: - Properties
13
+ @State private var time = 1000
14
+
15
+ // MARK: - Body
16
+ var body: some View {
17
+ NavigationView {
18
+ ScrollView {
19
+ VStack(spacing: 16) { // Equivalent to Spacing.M
20
+ HStack {
21
+ ImageView("https://source.unsplash.com/random/\(time)")
22
+ .frame(width: 100, height: 100)
23
+
24
+ Spacer()
25
+
26
+ ImageView("https://abc.com")
27
+ .frame(width: 100, height: 100)
28
+ }
29
+
30
+ ImageView("https://source.unsplash.com/random/\(time)")
31
+ .frame(maxWidth: .infinity)
32
+ .frame(height: 100)
33
+ .aspectRatio(contentMode: .fill)
34
+ .clipped()
35
+
36
+ ImageView("https://images.unsplash.com/photo-1509395062183-67c5ad6faff9")
37
+ .frame(maxWidth: .infinity)
38
+ .frame(height: 100)
39
+ .aspectRatio(contentMode: .fill)
40
+ .clipped()
41
+
42
+ ImageView("https://source.unsplash.com/random/\(time)")
43
+ .frame(maxWidth: .infinity)
44
+ .frame(height: 100)
45
+ .aspectRatio(contentMode: .fill)
46
+ .clipped()
47
+
48
+ ImageView("https://source.unsplash.com/random/\(time)")
49
+ .frame(maxWidth: .infinity)
50
+ .frame(height: 100)
51
+ .aspectRatio(contentMode: .fit)
52
+
53
+ ImageView("https://source.unsplash.com/random/\(time)")
54
+ .frame(maxWidth: .infinity)
55
+ .frame(height: 100)
56
+ .aspectRatio(contentMode: .fit)
57
+
58
+ ImageView("https://source.unsplash.com/random/\(time)")
59
+ .frame(maxWidth: .infinity)
60
+ .frame(height: 100)
61
+ .aspectRatio(contentMode: .fit)
62
+ }
63
+ .padding()
64
+ }
65
+ }
66
+ .onAppear {
67
+ startTimer()
68
+ }
69
+ }
70
+
71
+ // MARK: - Methods
72
+ private func startTimer() {
73
+ Timer.scheduledTimer(withTimeInterval: 5, repeats: true) { _ in
74
+ time = Int.random(in: 1...1000)
75
+ }
76
+ }
77
+ }
78
+
@@ -0,0 +1,138 @@
1
+ //
2
+ // InformationDemo.swift
3
+ // Example
4
+ //
5
+ // Created by product2 on 6/18/26.
6
+ //
7
+
8
+ import Foundation
9
+ import MoMoUIKits
10
+ import SwiftUI
11
+
12
+ // MARK: - InformationDemo
13
+
14
+ struct InformationDemo: View {
15
+ @State private var showDismissible = true
16
+
17
+ var body: some View {
18
+ ScrollView {
19
+ VStack(alignment: .leading, spacing: 24) {
20
+ // MARK: - States
21
+
22
+ section("States") {
23
+ Information(
24
+ title: "Default",
25
+ description: "This is a default information message.",
26
+ showIconClose: true,
27
+ onPressClose: {}
28
+ )
29
+ Information(
30
+ title: "Warning",
31
+ description: "This is a warning information message.",
32
+ state: .warning
33
+ )
34
+ Information(
35
+ title: "Error",
36
+ description: "This is an error information message.",
37
+ state: .error
38
+ )
39
+ }
40
+
41
+ // MARK: - Without title
42
+
43
+ section("Description only") {
44
+ Information(
45
+ description: "Information without a title, only a description."
46
+ )
47
+ Information(
48
+ description: "Warning without a title.",
49
+ state: .warning
50
+ )
51
+ }
52
+
53
+ // MARK: - With action
54
+
55
+ section("With action") {
56
+ Information(
57
+ title: "Update available",
58
+ description: "A new version is ready to install.",
59
+ onPressAction: { print("Action pressed") },
60
+ action: "Update now"
61
+ )
62
+ Information(
63
+ title: "Payment failed",
64
+ description: "We couldn't process your payment.",
65
+ state: .error,
66
+ onPressAction: { print("Retry pressed") },
67
+ action: "Retry"
68
+ )
69
+ }
70
+
71
+ // MARK: - With close button
72
+
73
+ section("Dismissible") {
74
+ if showDismissible {
75
+ Information(
76
+ title: "Dismissible",
77
+ description: "Tap the close icon to dismiss this banner.",
78
+ onPressClose: { showDismissible = false }
79
+ )
80
+ } else {
81
+ Information(
82
+ description: "Banner dismissed. Toggle to show again.",
83
+ state: .warning,
84
+ onPressAction: { showDismissible = true }, showIcon: true,
85
+ action: "Show again"
86
+
87
+ )
88
+ }
89
+ }
90
+
91
+ // MARK: - With image
92
+
93
+ section("With image") {
94
+ Information(
95
+ title: "Custom image",
96
+ description: "Uses a remote image instead of the state icon.",
97
+ image: "https://images.unsplash.com/photo-1509395062183-67c5ad6faff9",
98
+ onPressClose: { print("Close pressed") }
99
+ )
100
+ }
101
+
102
+ // MARK: - Without icon
103
+
104
+ section("Without icon") {
105
+ Information(
106
+ title: "No icon",
107
+ description: "showIcon is set to false.",
108
+ showIcon: false
109
+ )
110
+ }
111
+ }
112
+ .padding(.vertical, 16)
113
+ }
114
+ }
115
+
116
+ // MARK: - Helpers
117
+
118
+ @ViewBuilder
119
+ private func section<Content: View>(
120
+ _ title: String,
121
+ @ViewBuilder content: () -> Content
122
+ ) -> some View {
123
+ VStack(alignment: .leading, spacing: 12) {
124
+ Text(title)
125
+ .font(.headline)
126
+ content()
127
+ }
128
+ .padding(.horizontal, 16)
129
+ }
130
+ }
131
+
132
+ #if DEBUG
133
+ struct InformationDemo_Previews: PreviewProvider {
134
+ static var previews: some View {
135
+ InformationDemo()
136
+ }
137
+ }
138
+ #endif
@@ -0,0 +1,111 @@
1
+ //
2
+ // InputDemo.swift
3
+ // Example
4
+ //
5
+ // Created by dung.pham2 on 29/11/24.
6
+ //
7
+
8
+ import SwiftUI
9
+ import MoMoUIKits
10
+
11
+ struct InputDemo: View {
12
+ @State private var textValue1 = ""
13
+ @State private var textValue2 = ""
14
+ @State private var textValue3 = ""
15
+ @State private var textValue4 = ""
16
+ @State private var textValue5 = ""
17
+ @State private var textValue6 = ""
18
+ @State private var textValue7 = ""
19
+ @State private var textValue8 = ""
20
+ @State private var textValue9 = ""
21
+
22
+ var body: some View {
23
+ ScrollView {
24
+ VStack(alignment: .leading, spacing: 20) {
25
+ Text("Input Demo")
26
+ .font(.title1)
27
+
28
+ Group {
29
+ Text("Size")
30
+ .font(.headerText1)
31
+
32
+ Input(text: $textValue1, placeholder: "Small", size: .small, autofocus: true)
33
+ Input(text: $textValue1, placeholder: "Large", size: .large)
34
+ }
35
+
36
+ Group {
37
+ Text("Secure Text Entry")
38
+ .font(.headerText1)
39
+
40
+ Input(text: $textValue2, placeholder: "Enter here", floatingValue: "Momo", floatingIcon: "01.MoMo", secureTextEntry: true, autofocus: true)
41
+ Input(text: $textValue2, placeholder: "Enter here", floatingValue: "Momo", floatingIcon: "01.MoMo", size: .large, secureTextEntry: true)
42
+ }
43
+
44
+ Group {
45
+ Text("Floating Value")
46
+ .font(.headerText1)
47
+
48
+ Input(text: $textValue3, placeholder: "Enter here", floatingValue: "Momo", floatingIcon: "01.MoMo")
49
+
50
+ }
51
+
52
+ Group {
53
+ Text("Hint")
54
+ .font(.headerText1)
55
+
56
+ Input(text: $textValue4, placeholder: "Enter here", hintText: textValue4.isEmpty ? "Hint text" : textValue4 )
57
+ }
58
+
59
+ Group {
60
+ Text("Error")
61
+ .font(.headerText1)
62
+
63
+ Input(text: $textValue4, placeholder: "Enter here", error: textValue4.isEmpty ? "Error" : textValue4 )
64
+ }
65
+
66
+ Group {
67
+ Text("Disabled")
68
+ .font(.headerText1)
69
+
70
+ Input(text: $textValue5, placeholder: "Enter here", disabled: true, leadingIcon: "01.MoMo"
71
+ )
72
+ }
73
+
74
+ Group {
75
+ Text("Leading Icon")
76
+ .font(.headerText1)
77
+
78
+ Input(text: $textValue6, placeholder: "Leading Icon", floatingValue: "Small Input", leadingIcon: "01.MoMo"
79
+ )
80
+
81
+ Input(text: $textValue7, placeholder: "Leading Icon", floatingValue: "Large Input", size: .large, leadingIcon: "01.MoMo"
82
+ )
83
+ }
84
+
85
+ Group {
86
+ Text("Trailing Icon")
87
+ .font(.headerText1)
88
+
89
+ Input(text: $textValue8, placeholder: "Trailing Icon", floatingValue: "Trailing", rightIcon: "01.MoMo")
90
+ }
91
+
92
+ Group {
93
+ Text("Loading")
94
+ .font(.headerText1)
95
+
96
+ Input(text: $textValue8, placeholder: "Loading", floatingValue: "Loading", loading: true, required: true)
97
+ }
98
+
99
+ Group {
100
+ Text("Font Weight")
101
+ .font(.headerText1)
102
+
103
+ Input(text: $textValue9, placeholder: "Font Weight", floatingValue: "Regular Font Weight", required: true, fontWeight: .regular)
104
+
105
+ Input(text: $textValue9, placeholder: "Font Weight", floatingValue: "Bold Font Weight", required: true, fontWeight: .bold)
106
+ }
107
+ }
108
+ .padding()
109
+ }
110
+ }
111
+ }