@momo-kits/native-kits 0.168.1-beta.33-debug → 0.168.1-beta.34

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 (148) hide show
  1. package/CLAUDE.md +2 -2
  2. package/ios/Layout/ModalLayout.swift +125 -0
  3. package/ios/Layout/ScreenLayout.swift +28 -24
  4. package/ios/Navigation/BottomSheet.swift +40 -153
  5. package/ios/Navigation/Component/HeaderRight.swift +1 -1
  6. package/ios/Navigation/ModalScreen.swift +18 -7
  7. package/ios/Popup/PopupLayout.swift +9 -8
  8. package/ios/Popup/PopupNotify.swift +36 -23
  9. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +0 -90
  10. package/package.json +1 -1
  11. package/build.gradle.kts +0 -11
  12. package/compose/build.gradle.kts +0 -198
  13. package/compose/build.gradle.kts.backup +0 -198
  14. package/compose/compose.podspec +0 -47
  15. package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -20
  16. package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
  17. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
  18. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
  19. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -153
  20. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReduceMotion.android.kt +0 -17
  21. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +0 -6
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -110
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/application/DesignSystemKits.kt +0 -62
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -1071
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -269
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -81
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -357
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -115
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -542
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -86
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -231
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -189
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -478
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -114
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -265
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -235
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -223
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -265
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -185
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -84
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -370
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -108
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -308
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -90
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -330
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -473
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -207
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -92
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -560
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -86
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -125
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -207
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -501
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -236
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -180
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -17
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -194
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -287
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -54
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -50
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +0 -321
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -41
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -502
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -148
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -116
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -205
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -422
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -732
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -35
  106. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -232
  107. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -237
  108. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
  109. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +0 -97
  110. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoLiquidSelection.kt +0 -380
  111. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +0 -436
  112. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -169
  113. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -455
  114. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -105
  115. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -106
  116. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -74
  117. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -399
  118. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -39
  119. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -363
  120. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +0 -192
  121. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -133
  122. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
  123. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
  124. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -91
  125. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
  126. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -74
  127. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReduceMotion.kt +0 -7
  128. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +0 -20
  129. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
  130. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
  131. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
  132. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -118
  133. package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -42
  134. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
  135. package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -32
  136. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
  137. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
  138. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -218
  139. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReduceMotion.ios.kt +0 -48
  140. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +0 -138
  141. package/gradle/libs.versions.toml +0 -69
  142. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  143. package/gradle/wrapper/gradle-wrapper.properties +0 -8
  144. package/gradle.properties +0 -26
  145. package/gradlew +0 -252
  146. package/gradlew.bat +0 -94
  147. package/ios-demo/README.md +0 -120
  148. package/settings.gradle.kts +0 -64
@@ -2,25 +2,26 @@ import SDWebImageSwiftUI
2
2
  import SwiftUI
3
3
 
4
4
  extension ScreenLayout {
5
- /// Card width cap on iPhone Duo (the modal bounds, Compose `popupMaxWidth`); unbounded elsewhere,
5
+ /// Card width on foldables (`modalLayout`, Compose `popupMaxWidth`); unbounded on phones,
6
6
  /// where the popup's own padding sets the width.
7
7
  var popupMaxWidth: CGFloat {
8
- isDuoDevice ? duoModalMaxWidth : .infinity
8
+ let modal = modalLayout
9
+ return modal.isFoldable ? modal.popup.maxWidth : .infinity
9
10
  }
10
11
 
11
- /// The modal bounds already keep iPhone Duo popups off the edges, so their own side padding goes.
12
+ /// The placement already keeps foldable popups off the edges, so their own side padding goes.
12
13
  func popupHorizontalPadding(_ padding: CGFloat) -> CGFloat {
13
- isDuoDevice ? 0 : padding
14
+ modalLayout.isFoldable ? 0 : padding
14
15
  }
15
16
 
16
- /// Tallest a popup gets on iPhone Duo, landscape and the inner display included; nil elsewhere.
17
+ /// Tallest a popup gets on foldables; nil on phones.
17
18
  var popupMaxHeight: CGFloat? {
18
- isDuoDevice ? duoModalMaxHeight : nil
19
+ modalLayout.popup.maxHeight
19
20
  }
20
21
 
21
- /// Rounder on iPhone Duo, closer to its system alerts.
22
22
  func popupRadius(_ regular: CGFloat = Radius.L) -> CGFloat {
23
- isDuoDevice ? Radius.XL : regular
23
+ let modal = modalLayout
24
+ return modal.isFoldable ? modal.popup.radius : regular
24
25
  }
25
26
  }
26
27
 
@@ -55,7 +55,8 @@ public struct PopupNotify: View {
55
55
  public let props: PopupNotifyProps
56
56
 
57
57
  @State private var descriptionHeight: CGFloat = 0
58
- @State private var actionsHeight: CGFloat = 0
58
+ @State private var descriptionFrameHeight: CGFloat = 0
59
+ @State private var cardHeight: CGFloat = 0
59
60
  @State private var oneLineHeight: CGFloat = 0
60
61
  @State private var twoLinesHeight: CGFloat = 0
61
62
 
@@ -63,10 +64,17 @@ public struct PopupNotify: View {
63
64
  localize.translate("errorCode")
64
65
  }
65
66
 
66
- // ~8.5 lines as laid out (Compose measures the real lines); nominal line height until measured
67
+ // ~8.5 lines as laid out (Compose measures the real lines); nominal line height until measured.
68
+ // With a max height (foldables) only the description gives way: image, title and actions stay.
67
69
  private var maxDescriptionHeight: CGFloat {
68
- popupLinesHeight(8.5, oneLine: oneLineHeight, twoLines: twoLinesHeight)
70
+ let lines = popupLinesHeight(8.5, oneLine: oneLineHeight, twoLines: twoLinesHeight)
69
71
  ?? fontScale(TypographyStyle.bodyDefaultRegular.lineHeight) * 8.5
72
+ guard let maxHeight = layout.modalLayout.popup.maxHeight else { return lines }
73
+ return max(min(lines, maxHeight - (cardHeight - descriptionFrameHeight)), 0)
74
+ }
75
+
76
+ private var isCloseInside: Bool {
77
+ layout.modalLayout.isFoldable && props.isShowCloseIcon
70
78
  }
71
79
 
72
80
  private var shouldUseColumnButtons: Bool {
@@ -87,33 +95,35 @@ public struct PopupNotify: View {
87
95
  }
88
96
 
89
97
  public var body: some View {
98
+ let modal = layout.modalLayout
90
99
  ZStack(alignment: .topTrailing) {
91
100
  VStack(spacing: 0) {
92
- // scrolls when iPhone Duo landscape is too short; actions stay visible
93
- PopupScrollBody(maxHeight: layout.popupMaxHeight.map { $0 - actionsHeight }) {
94
- VStack(spacing: 0) {
95
- if !props.image.isEmpty {
96
- PopupHeaderImage(url: props.image)
97
- }
98
- textContent
99
- }
101
+ if !props.image.isEmpty {
102
+ PopupHeaderImage(url: props.image)
100
103
  }
104
+ textContent
101
105
 
102
106
  actionButtons
103
107
  .padding(.horizontal, Spacing.XL)
104
108
  .padding(.bottom, Spacing.XL)
105
- .popupReadHeight($actionsHeight)
106
109
  }
107
110
  .background(theme.colors.background.surface)
108
- .clipShape(RoundedRectangle(cornerRadius: layout.popupRadius()))
109
-
110
- if props.isShowCloseIcon {
111
+ .clipShape(RoundedRectangle(cornerRadius: modal.popup.radius))
112
+ .popupReadHeight($cardHeight)
113
+
114
+ if isCloseInside {
115
+ ModalIconButton(icon: "navigation_close", accessibilityId: "ic_popup_close", action: props.onIconClose)
116
+ .padding(.top, Spacing.M)
117
+ .padding(.trailing, Spacing.M)
118
+ } else if props.isShowCloseIcon {
119
+ // phones: straddles the card's top right corner
111
120
  PopupCloseButton(action: props.onIconClose)
112
121
  .offset(x: 11, y: -11)
113
122
  }
114
123
  }
115
- .frame(maxWidth: layout.popupMaxWidth)
116
- .padding(.horizontal, layout.popupHorizontalPadding(Spacing.M))
124
+ .frame(minWidth: modal.popup.minWidth, maxWidth: modal.popup.maxWidth)
125
+ // phones keep room around the card for the close badge on its corner
126
+ .padding(.horizontal, modal.isFoldable ? 0 : Spacing.M)
117
127
  .accessibilityElement(children: .contain)
118
128
  .accessibilityIdentifier("popup_notify")
119
129
  }
@@ -126,6 +136,7 @@ public struct PopupNotify: View {
126
136
  maxLines: 2,
127
137
  accessibilityId: "title_popup_permission"
128
138
  )
139
+ .padding(.trailing, isCloseInside && props.image.isEmpty ? ModalMetrics.iconButtonSize + Spacing.M - Spacing.XL : 0)
129
140
  .padding(.bottom, Spacing.S)
130
141
 
131
142
  descriptionContent
@@ -145,16 +156,18 @@ public struct PopupNotify: View {
145
156
  .measureLineHeights(typography: .bodyDefaultRegular, oneLine: $oneLineHeight, twoLines: $twoLinesHeight)
146
157
  }
147
158
 
148
- @ViewBuilder
149
159
  private var descriptionContent: some View {
150
- if descriptionHeight > maxDescriptionHeight {
151
- ScrollView(.vertical, showsIndicators: false) {
160
+ Group {
161
+ if descriptionHeight > maxDescriptionHeight {
162
+ ScrollView(.vertical, showsIndicators: false) {
163
+ descriptionText
164
+ }
165
+ .frame(height: maxDescriptionHeight)
166
+ } else {
152
167
  descriptionText
153
168
  }
154
- .frame(height: maxDescriptionHeight)
155
- } else {
156
- descriptionText
157
169
  }
170
+ .popupReadHeight($descriptionFrameHeight)
158
171
  }
159
172
 
160
173
  private var descriptionText: some View {
@@ -202,13 +202,6 @@ private struct NavigationDemoContent: View {
202
202
  )
203
203
  }
204
204
 
205
- row("Header Types") {
206
- navigator.push(
207
- { HeaderTypesScreen() },
208
- options: NavigationOptions(title: "Header Types")
209
- )
210
- }
211
-
212
205
  row("Bottom Tabs") {
213
206
  navigator.push(
214
207
  { BottomTabDemoContent() },
@@ -260,89 +253,6 @@ private struct UpdateOptionsScreen: View {
260
253
  }
261
254
  }
262
255
 
263
- /// Header options switched at runtime (Compose `HeaderTypeUsage`).
264
- @available(iOS 16.0, *)
265
- private struct HeaderTypesScreen: View {
266
- private enum Kind: String, CaseIterable {
267
- case none = "None", `default` = "Default", extended = "Extended", transparent = "Transparent"
268
- }
269
-
270
- @EnvironmentObject private var navigation: Navigation
271
- @State private var kind: AnyHashable = Kind.default
272
- @State private var titlePosition: AnyHashable = TitlePosition.left
273
- @State private var showBack = true
274
- @State private var showHeaderRight = true
275
- @State private var isAnimated = false
276
- @State private var isHeader = false
277
- @State private var isFullScreenContent = false
278
- @State private var searchText = ""
279
-
280
- var body: some View {
281
- VStack(alignment: .leading, spacing: Spacing.M) {
282
- ForEach(Kind.allCases, id: \.self) { item in
283
- Radio(value: item, groupValue: $kind, onChange: applyHeader, label: item.rawValue)
284
- }
285
- Divider()
286
- MomoText("Title Position")
287
- ForEach([TitlePosition.left, TitlePosition.center], id: \.self) { position in
288
- Radio(value: position, groupValue: $titlePosition, onChange: {
289
- navigation.setOptions { $0.titlePosition = position }
290
- }, label: position == .left ? "LEFT" : "CENTER")
291
- }
292
- Divider()
293
- Checkbox($showBack, onChange: { checked in
294
- navigation.setOptions { $0.hiddenBack = !checked }
295
- }, title: "Show Back")
296
- Checkbox($showHeaderRight, onChange: { checked in
297
- navigation.setOptions {
298
- $0.headerRightData = checked ? HeaderRightData() : nil
299
- $0.headerRight = nil
300
- }
301
- }, title: "Show Header Right")
302
- Divider()
303
- Checkbox($isAnimated, onChange: { checked in
304
- if checked { isHeader = false }
305
- applyHeader()
306
- }, title: "Search Animated")
307
- Checkbox($isHeader, onChange: { checked in
308
- if checked { isAnimated = false }
309
- applyHeader()
310
- }, title: "Search Header")
311
- if kind == AnyHashable(Kind.transparent) {
312
- Checkbox($isFullScreenContent, onChange: { _ in applyHeader() }, title: "Is Full Screen Content")
313
- }
314
- Color.clear.frame(height: 1600)
315
- }
316
- .padding(Spacing.M)
317
- }
318
-
319
- private func applyHeader() {
320
- let selected = kind.base as? Kind ?? .default
321
- var search: InputSearchProps?
322
- if isAnimated {
323
- search = InputSearchProps(text: $searchText, placeholder: "Search input")
324
- } else if isHeader {
325
- search = InputSearchProps(text: $searchText, buttonText: "Huỷ", showButtonText: true, placeholder: "Search input")
326
- }
327
- navigation.setOptions {
328
- switch selected {
329
- case .none:
330
- $0.headerType = .none
331
- case .default, .extended:
332
- $0.headerType = selected == .default ? .default : .extended
333
- $0.useAnimated = isAnimated
334
- $0.inputSearchProps = search
335
- case .transparent:
336
- $0.headerType = .default
337
- $0.useAnimated = false
338
- $0.inputSearchProps = nil
339
- }
340
- $0.headerTransparent = selected == .transparent
341
- $0.fullScreenContent = selected == .transparent && isFullScreenContent
342
- }
343
- }
344
- }
345
-
346
256
  @available(iOS 16.0, *)
347
257
  private struct DemoLeafScreen: View {
348
258
  @EnvironmentObject private var navigator: Navigator
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.168.1-beta.33-debug",
3
+ "version": "0.168.1-beta.34",
4
4
  "private": false,
5
5
  "dependeNavigationncies": {},
6
6
  "devDependencies": {},
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
- }
@@ -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.33-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
- }
@@ -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 = gitlabVersion
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 = "$gitlabGroup.$gitlabArtifactId"
94
- compileSdk = libs.versions.android.compileSdk.get().toInt()
95
- compileOptions {
96
- sourceCompatibility = JavaVersion.VERSION_17
97
- targetCompatibility = JavaVersion.VERSION_17
98
- }
99
- defaultConfig {
100
- minSdk = libs.versions.android.minSdk.get().toInt()
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
- }