@momo-kits/native-kits 0.169.8-beta.5 → 0.169.8-beta.6

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.
@@ -9,8 +9,6 @@ public let HEADER_HEIGHT: CGFloat = 52
9
9
  /// Room the back button, the gaps around the title and the right cluster take from the header row
10
10
  /// (Compose `HEADER_ACTIONS_WIDTH`).
11
11
  let headerActionsWidth: CGFloat = HeaderLayoutMetrics.buttonSize + HeaderLayoutMetrics.titleGap * 2 + HeaderLayoutMetrics.clusterWidth
12
- // Side padding, 48pt back and toolkit on the iPhone Duo status bar row.
13
- private let statusBarRowActionsWidth: CGFloat = 227
14
12
 
15
13
  public enum TitlePosition {
16
14
  case left, center
@@ -294,8 +292,7 @@ func headerSearchProps(
294
292
  func headerTitleMaxWidth(_ layout: ScreenLayout, _ contentLayout: ContentLayout) -> CGFloat {
295
293
  let clearance = layout.statusBarClearance.map { $0.left + $0.right } ?? 0
296
294
  if layout.sideBar != nil { return layout.contentWidth - Spacing.M * 2 - clearance }
297
- if layout.statusBarClearance != nil { return layout.width - statusBarRowActionsWidth - clearance }
298
- return layout.headerLayout(contentLayout).frameWidth - headerActionsWidth
295
+ return layout.headerLayout(contentLayout).frameWidth - headerActionsWidth - clearance
299
296
  }
300
297
 
301
298
  // MARK: - Header
@@ -355,14 +352,11 @@ public struct NavigationHeader: View {
355
352
  /// iPhone Duo side bar holds back and the toolkit; a custom header right stays in the bar.
356
353
  private var useSideBar: Bool { layout.sideBar != nil }
357
354
 
358
- /// iPhone Duo inner portrait: the row sits on the status bar, between its clusters, with 48pt controls.
359
- private var statusBarRow: Bool { layout.statusBarClearance != nil && !useSideBar }
360
-
361
355
  /// Max centered title width; on the status bar row the clusters are lopsided, so both sides
362
356
  /// keep the wider one's room.
363
357
  private var centerTitleMaxWidth: CGFloat {
364
358
  guard let clearance = layout.statusBarClearance else { return headerLayout.frameWidth / 2 }
365
- let back = goBack == nil || useSideBar ? 0 : DuoMetrics.controlSize + Spacing.S
359
+ let back = goBack == nil || useSideBar ? 0 : HeaderLayoutMetrics.buttonSize + HeaderLayoutMetrics.titleGap
366
360
  let inset = max(clearance.left + back, clearance.right + headerRightWidth) + Spacing.S
367
361
  return max(layout.contentWidth - (Spacing.M + inset) * 2, 0)
368
362
  }
@@ -387,16 +381,7 @@ public struct NavigationHeader: View {
387
381
  ZStack {
388
382
  HStack(spacing: 0) {
389
383
  if let goBack, !useSideBar {
390
- if statusBarRow {
391
- SideBarButton(
392
- icon: "arrow-back",
393
- headerColor: headerColor,
394
- accessibilityId: "btn_navigation_back",
395
- action: goBack
396
- )
397
- } else {
398
- BackButton(color: headerColor, onBack: goBack)
399
- }
384
+ BackButton(color: headerColor, onBack: goBack)
400
385
  Spacer().frame(width: HeaderLayoutMetrics.titleGap)
401
386
  }
402
387
 
@@ -408,23 +393,13 @@ public struct NavigationHeader: View {
408
393
  }
409
394
 
410
395
  if let headerRight, !(useSideBar && toolkitHeaderRight(headerRight) != nil) {
411
- Group {
412
- if statusBarRow, let toolkit = toolkitHeaderRight(headerRight) {
413
- Toolkit(
414
- headerRight: toolkit.data ?? HeaderRightData(),
415
- tintColor: toolkit.tintColor,
416
- layout: .sideBarRow
417
- )
418
- } else {
419
- AnyView(headerRight())
420
- }
421
- }
422
- .environment(\.headerColor, headerColor)
423
- .background(
424
- GeometryReader { geo in
425
- Color.clear.preference(key: HeaderRightWidthKey.self, value: geo.size.width)
426
- }
427
- )
396
+ AnyView(headerRight())
397
+ .environment(\.headerColor, headerColor)
398
+ .background(
399
+ GeometryReader { geo in
400
+ Color.clear.preference(key: HeaderRightWidthKey.self, value: geo.size.width)
401
+ }
402
+ )
428
403
  }
429
404
  }
430
405
  .padding(.leading, headerLayout.frameInset + (layout.statusBarClearance?.left ?? 0))
@@ -138,9 +138,9 @@ private struct NavigationButtonConfig {
138
138
  let onPress: () -> Void
139
139
  }
140
140
 
141
- /// `sideBarColumn`: the iPhone Duo side bar; `sideBarRow`: the Duo header row on the status bar, same 48pt controls.
141
+ /// `sideBarColumn`: the iPhone Duo side bar, 48pt controls; `bar`: every header row, iPhone Duo status bar row included.
142
142
  enum ToolkitLayout {
143
- case bar, sideBarColumn, sideBarRow
143
+ case bar, sideBarColumn
144
144
  }
145
145
 
146
146
  struct Toolkit: View {
@@ -293,16 +293,14 @@ struct Toolkit: View {
293
293
  case .bar:
294
294
  horizontalBody
295
295
  case .sideBarColumn:
296
- VStack(spacing: Spacing.M) { sideBarControls(horizontal: false) }
297
- case .sideBarRow:
298
- HStack(spacing: Spacing.M) { sideBarControls(horizontal: true) }
296
+ VStack(spacing: Spacing.M) { sideBarControls }
299
297
  }
300
298
  }
301
299
  .onAppear(perform: loadFavoriteState)
302
300
  }
303
301
 
304
302
  @ViewBuilder
305
- private func sideBarControls(horizontal: Bool) -> some View {
303
+ private var sideBarControls: some View {
306
304
  let config = navigationButtonConfig
307
305
  let useHelpCenter = usesHelpCenter(context)
308
306
  if showsShortcut(headerRight, context) {
@@ -314,7 +312,7 @@ struct Toolkit: View {
314
312
  action: config.onPress
315
313
  )
316
314
  }
317
- SideBarGroup(headerColor: headerColor, itemCount: useHelpCenter ? 2 : 1, horizontal: horizontal) {
315
+ SideBarGroup(headerColor: headerColor, itemCount: useHelpCenter ? 2 : 1) {
318
316
  if useHelpCenter {
319
317
  SideBarGroupItem(
320
318
  icon: "help_center",
@@ -137,26 +137,17 @@ struct SideBarButton: View {
137
137
  }
138
138
  }
139
139
 
140
- /// 48pt glass capsule grouping related controls, one item per 50pt: vertical in the side bar,
141
- /// horizontal on a header row.
140
+ /// 48pt vertical glass capsule grouping related side bar controls, one item per 50pt.
142
141
  struct SideBarGroup<Content: View>: View {
143
142
  let headerColor: HeaderColor
144
143
  let itemCount: Int
145
- var horizontal: Bool = false
146
144
  @ViewBuilder let content: () -> Content
147
145
 
148
146
  var body: some View {
149
147
  let length = itemCount > 1 ? DuoMetrics.itemPitch * CGFloat(itemCount) : DuoMetrics.controlSize
150
- Group {
151
- if horizontal {
152
- HStack(spacing: 0) { content() }
153
- .frame(width: length, height: DuoMetrics.controlSize)
154
- } else {
155
- VStack(spacing: 0) { content() }
156
- .frame(width: DuoMetrics.controlSize, height: length)
157
- }
158
- }
159
- .modifier(SideBarGlass(headerColor: headerColor, shape: RoundedRectangle(cornerRadius: Radius.XL)))
148
+ VStack(spacing: 0) { content() }
149
+ .frame(width: DuoMetrics.controlSize, height: length)
150
+ .modifier(SideBarGlass(headerColor: headerColor, shape: RoundedRectangle(cornerRadius: Radius.XL)))
160
151
  }
161
152
  }
162
153
 
@@ -749,10 +749,9 @@ private struct SearchAnimatedHeader: View {
749
749
  let maxTop = layout.headerHeight - layout.insets.top
750
750
  // stretch screens on wide windows keep the search in the header's centered frame
751
751
  let minSide = layout.headerLayout(contentLayout).frameInset
752
- // collapsed on the iPhone Duo status bar row, the search stays between its clusters (48pt back there)
752
+ // collapsed on the iPhone Duo status bar row, the search stays between its clusters
753
753
  let clearance = layout.statusBarClearance
754
- let backWidth: CGFloat = clearance != nil && !useSideBar ? DuoMetrics.controlSize : HeaderLayoutMetrics.buttonSize
755
- let maxStart = (clearance?.left ?? 0) + (hiddenBack || useSideBar ? minSide : backWidth + minSide + HeaderLayoutMetrics.titleGap)
754
+ let maxStart = (clearance?.left ?? 0) + (hiddenBack || useSideBar ? minSide : HeaderLayoutMetrics.buttonSize + minSide + HeaderLayoutMetrics.titleGap)
756
755
  let maxEnd = (clearance?.right ?? 0) + (useSideBar && hasToolkit
757
756
  ? minSide
758
757
  : headerRightWidth + (hasHeaderRight ? minSide + Spacing.M : minSide))
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKits'
3
- s.version = '0.169.8-beta.5'
3
+ s.version = '0.169.8-beta.6'
4
4
  s.summary = 'MoMoUIKits for iOS'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'MoMoUIKitsDemo'
3
- s.version = '0.169.8-beta.5'
3
+ s.version = '0.169.8-beta.6'
4
4
  s.summary = 'Demo browser for MoMoUIKits SwiftUI components'
5
5
  s.homepage = 'https://momo.vn'
6
6
  s.license = { :type => 'MIT' }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/native-kits",
3
- "version": "0.169.8-beta.5",
3
+ "version": "0.169.8-beta.6",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "publish:local": "bash publish.sh local"