@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,269 @@
1
+ import SwiftUI
2
+
3
+ // MARK: - Enums
4
+
5
+ public enum TitleType {
6
+ case card
7
+ case section
8
+ }
9
+
10
+ public enum TitleSize {
11
+ case small
12
+ case medium
13
+ case large
14
+ }
15
+
16
+ public enum IconAlign {
17
+ case top
18
+ case center
19
+ case bottom
20
+ }
21
+
22
+ public enum TitleButtonSize {
23
+ case small
24
+ case large
25
+ }
26
+
27
+ // MARK: - Title
28
+
29
+ public struct Title: View {
30
+ @Environment(\.appTheme) private var theme
31
+
32
+ private let title: String
33
+ private let type: TitleType
34
+ private let size: TitleSize
35
+ private let icon: String?
36
+ private let iconColor: Color?
37
+ private let iconAlign: IconAlign
38
+ private let showRightAction: Bool
39
+ private let showTrailingAction: Bool
40
+ private let badgeLabel: String?
41
+ private let buttonTitle: String?
42
+ private let buttonSize: TitleButtonSize
43
+ private let onPressRightAction: () -> Void
44
+ private let onPressTrailingAction: () -> Void
45
+ private let textOnly: Bool
46
+ private let description: String?
47
+
48
+ public init(
49
+ title: String,
50
+ type: TitleType = .section,
51
+ size: TitleSize = .medium,
52
+ icon: String? = nil,
53
+ iconColor: Color? = nil,
54
+ iconAlign: IconAlign = .top,
55
+ showRightAction: Bool = false,
56
+ showTrailingAction: Bool = false,
57
+ badgeLabel: String? = nil,
58
+ buttonTitle: String? = nil,
59
+ buttonSize: TitleButtonSize = .small,
60
+ onPressRightAction: @escaping () -> Void = {},
61
+ onPressTrailingAction: @escaping () -> Void = {},
62
+ textOnly: Bool = false,
63
+ description: String? = nil
64
+ ) {
65
+ self.title = title
66
+ self.type = type
67
+ self.size = size
68
+ self.icon = icon
69
+ self.iconColor = iconColor
70
+ self.iconAlign = iconAlign
71
+ self.showRightAction = showRightAction
72
+ self.showTrailingAction = showTrailingAction
73
+ self.badgeLabel = badgeLabel
74
+ self.buttonTitle = buttonTitle
75
+ self.buttonSize = buttonSize
76
+ self.onPressRightAction = onPressRightAction
77
+ self.onPressTrailingAction = onPressTrailingAction
78
+ self.textOnly = textOnly
79
+ self.description = description
80
+ }
81
+
82
+ // MARK: - Title text style
83
+
84
+ private var titleFontSize: CGFloat {
85
+ switch type {
86
+ case .card:
87
+ switch size {
88
+ case .small: return 14
89
+ case .medium: return 16
90
+ case .large: return 18
91
+ }
92
+ case .section:
93
+ switch size {
94
+ case .small: return 16
95
+ case .medium: return 18
96
+ case .large: return 20
97
+ }
98
+ }
99
+ }
100
+
101
+ private var titleLineHeight: CGFloat {
102
+ switch type {
103
+ case .card:
104
+ switch size {
105
+ case .small: return 20
106
+ case .medium: return 22
107
+ case .large: return 26
108
+ }
109
+ case .section:
110
+ switch size {
111
+ case .small: return 24
112
+ case .medium: return 26
113
+ case .large: return 28
114
+ }
115
+ }
116
+ }
117
+
118
+ private var titleFontWeight: Font.Weight {
119
+ switch type {
120
+ case .card: return .regular
121
+ case .section: return .bold
122
+ }
123
+ }
124
+
125
+ private var titleMaxLines: Int {
126
+ (showTrailingAction || badgeLabel != nil) ? 1 : 2
127
+ }
128
+
129
+ private var iconVerticalAlignment: VerticalAlignment {
130
+ switch iconAlign {
131
+ case .top: return .top
132
+ case .center: return .center
133
+ case .bottom: return .bottom
134
+ }
135
+ }
136
+
137
+ private var trailingBackground: Color {
138
+ type == .section
139
+ ? Colors.black06.opacity(0.6)
140
+ : Colors.black06.opacity(0.3)
141
+ }
142
+
143
+ // MARK: - Body
144
+
145
+ public var body: some View {
146
+ if textOnly {
147
+ titleText
148
+ } else {
149
+ fullLayout
150
+ }
151
+ }
152
+
153
+ private var titleText: some View {
154
+ SwiftUI.Text(title)
155
+ .font(.system(size: scaleSize(titleFontSize), weight: titleFontWeight))
156
+ .ignoreBoldTextSetting()
157
+ .foregroundColor(theme.colors.text.default)
158
+ .lineSpacing(scaleSize(titleLineHeight) - scaleSize(titleFontSize))
159
+ .lineLimit(titleMaxLines)
160
+ .truncationMode(.tail)
161
+ }
162
+
163
+ private var fullLayout: some View {
164
+ HStack(alignment: .center, spacing: 0) {
165
+ HStack(alignment: iconVerticalAlignment, spacing: 0) {
166
+ if let icon = icon {
167
+ Icon(
168
+ source: icon,
169
+ size: 24,
170
+ color: iconColor ?? theme.colors.text.default
171
+ )
172
+ .padding(.trailing, Spacing.S)
173
+ }
174
+
175
+ VStack(alignment: .leading, spacing: 0) {
176
+ HStack(alignment: .center, spacing: 0) {
177
+ HStack(alignment: .center, spacing: 0) {
178
+ titleText
179
+
180
+ if let badgeLabel = badgeLabel {
181
+ Spacer().frame(width: 4)
182
+ Badge(label: badgeLabel)
183
+ }
184
+ }
185
+ if showTrailingAction != true {
186
+ Spacer(minLength: 0)
187
+ }
188
+
189
+ if showTrailingAction && !showRightAction {
190
+ Spacer().frame(width: 8)
191
+ SwiftUI.Button(action: onPressTrailingAction) {
192
+ Icon(source: "arrow_chevron_right_small", size: 18)
193
+ .frame(width: 24, height: 24)
194
+ .background(trailingBackground)
195
+ .clipShape(RoundedRectangle(cornerRadius: 12))
196
+ }
197
+ .buttonStyle(.plain)
198
+ }
199
+ }
200
+
201
+ if let description = description {
202
+ Spacer().frame(height: 4)
203
+ MomoText(
204
+ description,
205
+ typography: .descriptionDefaultRegular,
206
+ color: theme.colors.text.secondary
207
+ )
208
+ }
209
+ }
210
+ }
211
+
212
+ if showRightAction && !showTrailingAction {
213
+ Spacer().frame(width: 8)
214
+ if let buttonTitle = buttonTitle {
215
+ SwiftUI.Button(action: onPressRightAction) {
216
+ MomoText(
217
+ buttonTitle,
218
+ typography: buttonSize == .small ? .actionXsBold : .actionSBold,
219
+ color: theme.colors.primary
220
+ )
221
+ }
222
+ .buttonStyle(.plain)
223
+ } else {
224
+ SwiftUI.Button(action: onPressRightAction) {
225
+ Icon(
226
+ source: "arrow_chevron_right_small",
227
+ size: 22,
228
+ color: theme.colors.primary
229
+ )
230
+ .frame(width: 24, height: 24)
231
+ .background(Colors.pink03.opacity(0.1))
232
+ .clipShape(RoundedRectangle(cornerRadius: 12))
233
+ }
234
+ .buttonStyle(.plain)
235
+ }
236
+ }
237
+ }
238
+ .frame(maxWidth: .infinity, alignment: .leading)
239
+ .padding(8)
240
+ }
241
+ }
242
+
243
+ // MARK: - Preview
244
+
245
+ #if DEBUG
246
+ struct Title_Previews: PreviewProvider {
247
+ static var previews: some View {
248
+ VStack(alignment: .leading, spacing: 12) {
249
+ Title(title: "Section Small", type: .section, size: .small)
250
+ Title(
251
+ title: "Section Medium",
252
+ type: .section,
253
+ size: .medium,
254
+ icon: "basic_home",
255
+ description: "This is a medium section with icon."
256
+ )
257
+ Title(
258
+ title: "Section Large",
259
+ type: .section,
260
+ size: .large,
261
+ showTrailingAction: true,
262
+ badgeLabel: "NEW"
263
+ )
264
+ }
265
+ .padding()
266
+ .previewLayout(.sizeThatFits)
267
+ }
268
+ }
269
+ #endif