@momo-kits/native-kits 0.163.1-beta.8-debug → 0.163.1-beta.9-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 (220) hide show
  1. package/CLAUDE.md +1 -1
  2. package/compose/build.gradle.kts +1 -1
  3. package/compose/compose.podspec +1 -1
  4. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
  5. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +30 -3
  6. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +5 -0
  7. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +1 -1
  8. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +3 -0
  9. package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +56 -0
  10. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +4 -0
  11. package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +22 -0
  12. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +8 -2
  13. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +63 -0
  14. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +32 -19
  15. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +49 -0
  16. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +1 -1
  17. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +1 -1
  18. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +3 -1
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +93 -75
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +26 -7
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +3 -1
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +23 -2
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +9 -0
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +11 -0
  25. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +66 -0
  26. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +26 -3
  27. package/gradle.properties +1 -1
  28. package/ios/Application/ApplicationEnvironment.swift +15 -2
  29. package/ios/Application/Components.swift +50 -44
  30. package/ios/Application/FloatingButton.swift +10 -9
  31. package/ios/Application/HeaderRight.swift +79 -45
  32. package/ios/Application/Localize.swift +277 -0
  33. package/ios/Application/MaxApi.swift +18 -0
  34. package/ios/Application/Navigation/BottomTab/BottomTab.swift +104 -0
  35. package/ios/Application/Navigation/BottomTab/BottomTabBar.swift +215 -0
  36. package/ios/Application/Navigation/BottomTab/CurvedContainer.swift +65 -0
  37. package/ios/Application/Navigation/HeaderBackProps.swift +66 -0
  38. package/ios/Application/Navigation/HeaderTitle.swift +57 -0
  39. package/ios/Application/Navigation/HeaderUser.swift +209 -0
  40. package/ios/Application/Navigation/NavigationContainer.swift +200 -0
  41. package/ios/Application/Navigation/NavigationOptions.swift +109 -0
  42. package/ios/Application/Navigation/Navigator.swift +385 -0
  43. package/ios/Application/Navigation/Overplay/BottomSheet.swift +256 -0
  44. package/ios/Application/Navigation/Overplay/ModalScreen.swift +74 -0
  45. package/ios/Application/Navigation/Overplay/SnackBar.swift +144 -0
  46. package/ios/Application/Navigation/Tracking/ScreenTracker.swift +117 -0
  47. package/ios/Application/Navigation/component/Header.swift +178 -0
  48. package/ios/Application/Navigation/component/HeaderBackground.swift +83 -0
  49. package/ios/Application/Navigation/component/HeaderColor.swift +65 -0
  50. package/ios/Application/Screen.swift +2 -1
  51. package/ios/Application/StackScreen.swift +501 -0
  52. package/ios/Avatar/Avatar.swift +193 -0
  53. package/ios/Badge/Badge.swift +11 -14
  54. package/ios/Badge/BadgeRibbon.swift +92 -21
  55. package/ios/BaselineView/BaselineView.swift +163 -0
  56. package/ios/Button/Button.swift +124 -29
  57. package/ios/Carousel/Carousel.swift +196 -0
  58. package/ios/Checkbox/Checkbox.swift +23 -28
  59. package/ios/Chip/Chip.swift +56 -33
  60. package/ios/Collapse/Collapse.swift +192 -0
  61. package/ios/Colors+Radius+Spacing/Colors.swift +20 -17
  62. package/ios/Colors+Radius+Spacing/Spacing.swift +3 -1
  63. package/ios/Colors+Radius+Spacing/Theme.swift +295 -0
  64. package/ios/DateTimePicker/DateTimePicker.swift +212 -0
  65. package/ios/DateTimePicker/DateTimePickerTypes.swift +55 -0
  66. package/ios/DateTimePicker/DateTimePickerUtils.swift +167 -0
  67. package/ios/DateTimePicker/WheelPicker.swift +165 -0
  68. package/ios/Divider/Divider.swift +16 -0
  69. package/ios/Extensions/ActiveOpacityButtonStyle.swift +14 -0
  70. package/ios/Extensions/Color++.swift +32 -0
  71. package/ios/Icon/Icon.swift +10 -1
  72. package/ios/IconButton/IconButton.swift +140 -0
  73. package/ios/Image/Image.swift +16 -3
  74. package/ios/Information/Information.swift +3 -1
  75. package/ios/Input/ErrorView.swift +3 -1
  76. package/ios/Input/Input.swift +72 -33
  77. package/ios/Input/InputPhoneNumber.swift +33 -21
  78. package/ios/Input/InputSearch.swift +107 -48
  79. package/ios/Input/InputTextArea.swift +134 -64
  80. package/ios/InputDropDown/InputDropDown.swift +201 -0
  81. package/ios/InputMoney/InputMoney.swift +347 -0
  82. package/ios/InputOTP/InputOTP.swift +210 -0
  83. package/ios/Loader/Loader.swift +113 -0
  84. package/ios/MoMoUIKits.podspec +5 -0
  85. package/ios/Pagination/PaginationDot.swift +61 -0
  86. package/ios/Pagination/PaginationNumber.swift +35 -0
  87. package/ios/Pagination/PaginationScroll.swift +101 -0
  88. package/ios/Pagination/PaginationWhiteDot.swift +37 -0
  89. package/ios/Popup/PopupDisplay.swift +11 -20
  90. package/ios/Popup/PopupInput.swift +2 -8
  91. package/ios/Popup/PopupNotify.swift +218 -0
  92. package/ios/Popup/PopupPromotion.swift +16 -8
  93. package/ios/ProgressInfo/ProgressInfo.swift +296 -0
  94. package/ios/Radio/Radio.swift +69 -0
  95. package/ios/Rating/Rating.swift +82 -0
  96. package/ios/Resources/MoMoUIKitsColors.xcassets/AccentColor.colorset/Contents.json +11 -0
  97. package/ios/Resources/MoMoUIKitsColors.xcassets/Background.colorset/Contents.json +38 -0
  98. package/ios/Resources/MoMoUIKitsColors.xcassets/Border.colorset/Contents.json +38 -0
  99. package/ios/Resources/MoMoUIKitsColors.xcassets/Card.colorset/Contents.json +38 -0
  100. package/ios/Resources/MoMoUIKitsColors.xcassets/Contents.json +6 -0
  101. package/ios/Resources/MoMoUIKitsColors.xcassets/Error.colorset/Contents.json +38 -0
  102. package/ios/Resources/MoMoUIKitsColors.xcassets/Primary.colorset/Contents.json +38 -0
  103. package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryDark.colorset/Contents.json +38 -0
  104. package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryLight.colorset/Contents.json +38 -0
  105. package/ios/Resources/MoMoUIKitsColors.xcassets/Secondary.colorset/Contents.json +38 -0
  106. package/ios/Resources/MoMoUIKitsColors.xcassets/Success.colorset/Contents.json +38 -0
  107. package/ios/Resources/MoMoUIKitsColors.xcassets/Text.colorset/Contents.json +38 -0
  108. package/ios/Resources/MoMoUIKitsColors.xcassets/TextSecondary.colorset/Contents.json +38 -0
  109. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/Contents.json +9 -0
  110. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-default.colorset/Contents.json +38 -0
  111. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-disable.colorset/Contents.json +38 -0
  112. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-pressed.colorset/Contents.json +38 -0
  113. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-selected.colorset/Contents.json +38 -0
  114. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-surface.colorset/Contents.json +38 -0
  115. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-tonal.colorset/Contents.json +38 -0
  116. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-default.colorset/Contents.json +38 -0
  117. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-disable.colorset/Contents.json +38 -0
  118. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/gradient.colorset/Contents.json +38 -0
  119. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/primary.colorset/Contents.json +38 -0
  120. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/secondary.colorset/Contents.json +38 -0
  121. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-container.colorset/Contents.json +38 -0
  122. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-primary.colorset/Contents.json +38 -0
  123. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-secondary.colorset/Contents.json +38 -0
  124. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-default.colorset/Contents.json +38 -0
  125. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-disable.colorset/Contents.json +38 -0
  126. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-hint.colorset/Contents.json +38 -0
  127. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-secondary.colorset/Contents.json +38 -0
  128. package/ios/Resources/MoMoUIKitsColors.xcassets/Warning.colorset/Contents.json +38 -0
  129. package/ios/Skeleton/Skeleton.swift +99 -0
  130. package/ios/Slider/Slider.swift +237 -0
  131. package/ios/Stepper/Stepper.swift +220 -0
  132. package/ios/Steps/Steps.swift +467 -0
  133. package/ios/SuggestAction/SuggestAction.swift +99 -0
  134. package/ios/Swipeable/SwipeCell.swift +187 -0
  135. package/ios/Swipeable/SwipeCellModel.swift +21 -0
  136. package/ios/Switch/Switch.swift +53 -28
  137. package/ios/TabView/TabView.swift +534 -0
  138. package/ios/Tag/Tag.swift +98 -0
  139. package/ios/Template/TrustBanner/TrustBanner.swift +6 -7
  140. package/ios/Title/Title.swift +269 -0
  141. package/ios/Tooltip/Tooltip.swift +485 -0
  142. package/ios/Typography/FontScaleStore.swift +19 -0
  143. package/ios/Typography/Text.swift +79 -5
  144. package/ios/Typography/Typography.swift +3 -0
  145. package/ios/Uploader/Uploader.swift +174 -0
  146. package/ios/native-kits.podspec +61 -8
  147. package/ios-demo/MoMoUIKitsDemo.podspec +20 -0
  148. package/ios-demo/README.md +120 -0
  149. package/ios-demo/Resources/dot_loading.json +558 -0
  150. package/ios-demo/Resources/icon.json +4052 -0
  151. package/ios-demo/Resources/lottie_circle_loader.json +1 -0
  152. package/ios-demo/Sources/MoMoUIKitsDemo/DemoScaffold.swift +48 -0
  153. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsBadgeDemoView.swift +25 -0
  154. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsButtonDemoView.swift +26 -0
  155. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsCheckboxDemoView.swift +19 -0
  156. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsChipDemoView.swift +33 -0
  157. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsInputDemoView.swift +48 -0
  158. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsPopupDemoView.swift +21 -0
  159. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsRadioDemoView.swift +17 -0
  160. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsTypographyDemoView.swift +28 -0
  161. package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoContext.swift +31 -0
  162. package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoFactory.swift +24 -0
  163. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +110 -0
  164. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AvatarDemo.swift +93 -0
  165. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BadgeDemo.swift +269 -0
  166. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BaselineView.swift +117 -0
  167. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +89 -0
  168. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ButtonDemo.swift +100 -0
  169. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CarouselDemo.swift +126 -0
  170. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CheckboxDemo.swift +63 -0
  171. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ChipDemo.swift +20 -0
  172. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CollapseDemo.swift +93 -0
  173. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +107 -0
  174. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DateTimePickerDemo.swift +124 -0
  175. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DividerDemo.swift +14 -0
  176. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/HeaderUserDemo.swift +49 -0
  177. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +279 -0
  178. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconButtonDemo.swift +58 -0
  179. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ImageDemo.swift +78 -0
  180. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InformationDemo.swift +138 -0
  181. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDemo.swift +111 -0
  182. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDropDownDemo.swift +136 -0
  183. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputMoneyDemo.swift +107 -0
  184. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputOTPDemo.swift +73 -0
  185. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +100 -0
  186. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputSearchDemo.swift +32 -0
  187. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputTextAreaDemo.swift +57 -0
  188. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LoaderDemo.swift +70 -0
  189. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +188 -0
  190. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +229 -0
  191. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PaginationDemo.swift +72 -0
  192. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +175 -0
  193. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +121 -0
  194. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +76 -0
  195. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ProgressInfoDemo.swift +89 -0
  196. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RadioDemo.swift +32 -0
  197. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RatingDemo.swift +56 -0
  198. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SkeletonDemo.swift +32 -0
  199. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SliderDemo.swift +150 -0
  200. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SnackBarDemo.swift +138 -0
  201. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepperDemo.swift +103 -0
  202. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepsDemo.swift +94 -0
  203. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SuggestActionDemo.swift +79 -0
  204. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwipeDemo.swift +152 -0
  205. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwitchDemo.swift +33 -0
  206. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TabViewDemo.swift +190 -0
  207. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TagDemo.swift +34 -0
  208. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ThemeDemo.swift +182 -0
  209. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TitleDemo.swift +109 -0
  210. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TooltipDemo.swift +187 -0
  211. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +87 -0
  212. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/UploaderDemo.swift +131 -0
  213. package/ios-demo/Sources/MoMoUIKitsDemo/SwiftUIDemoBrowserView.swift +51 -0
  214. package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoModels.swift +15 -0
  215. package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoRegistry.swift +73 -0
  216. package/local.properties +2 -2
  217. package/package.json +1 -1
  218. package/publish.sh +53 -0
  219. package/scripts/gen-ios-color.mjs +136 -0
  220. package/.claude/settings.local.json +0 -62
@@ -0,0 +1,218 @@
1
+ import SDWebImageSwiftUI
2
+ import SwiftUI
3
+
4
+ public typealias PopupActionDirection = PopupButtonDirection
5
+
6
+ public struct PopupNotifyProps {
7
+ public var image: String
8
+ public var title: String
9
+ public var description: String
10
+ public var error: String
11
+ public var primary: PopupAction?
12
+ public var secondary: PopupAction?
13
+ public var buttonDirection: PopupActionDirection
14
+ public var onIconClose: () -> Void
15
+ public var isShowCloseIcon: Bool
16
+
17
+ public init(
18
+ image: String = "",
19
+ title: String = "Title",
20
+ description: String = "Description",
21
+ error: String = "",
22
+ primary: PopupAction? = nil,
23
+ secondary: PopupAction? = nil,
24
+ buttonDirection: PopupActionDirection = .row,
25
+ onIconClose: @escaping () -> Void,
26
+ isShowCloseIcon: Bool = true
27
+ ) {
28
+ self.image = image
29
+ self.title = title
30
+ self.description = description
31
+ self.error = error
32
+ self.primary = primary
33
+ self.secondary = secondary
34
+ self.buttonDirection = buttonDirection
35
+ self.onIconClose = onIconClose
36
+ self.isShowCloseIcon = isShowCloseIcon
37
+ }
38
+ }
39
+
40
+ public struct PopupNotify: View {
41
+ @EnvironmentObject private var localize: Localize
42
+
43
+ public let props: PopupNotifyProps
44
+
45
+ @State private var descriptionHeight: CGFloat = 0
46
+
47
+ private var errorCodePrefix: String {
48
+ localize.translate("errorCode")
49
+ }
50
+
51
+ private var maxDescriptionHeight: CGFloat {
52
+ scaleSize(TypographyStyle.bodyDefaultRegular.lineHeight) * 8.5
53
+ }
54
+
55
+ private var shouldUseColumnButtons: Bool {
56
+ switch props.buttonDirection {
57
+ case .column:
58
+ return true
59
+ case .row:
60
+ return false
61
+ case .auto:
62
+ return (props.secondary?.title.count ?? 0) > 12 || (props.primary?.title.count ?? 0) > 12
63
+ }
64
+ }
65
+
66
+ public init(props: PopupNotifyProps) {
67
+ self.props = props
68
+ }
69
+
70
+ public var body: some View {
71
+ ZStack(alignment: .topTrailing) {
72
+ VStack(spacing: 0) {
73
+ if !props.image.isEmpty {
74
+ popupImage
75
+ }
76
+
77
+ VStack(alignment: .leading, spacing: 0) {
78
+ MomoText(
79
+ props.title,
80
+ typography: .headerDefaultBold,
81
+ maxLines: 2,
82
+ accessibilityId: "title_popup_permission"
83
+ )
84
+ .padding(.bottom, Spacing.S)
85
+
86
+ descriptionContent
87
+
88
+ if !props.error.isEmpty {
89
+ MomoText(
90
+ errorCodePrefix + props.error,
91
+ typography: .descriptionXsRegular,
92
+ color: Colors.black12,
93
+ maxLines: 1
94
+ )
95
+ .padding(.top, Spacing.S)
96
+ }
97
+ }
98
+ .frame(maxWidth: .infinity, alignment: .leading)
99
+ .padding(Spacing.XL)
100
+
101
+ actionButtons
102
+ .padding(.horizontal, Spacing.XL)
103
+ .padding(.bottom, Spacing.XL)
104
+ }
105
+ .background(Colors.black01)
106
+ .clipShape(RoundedRectangle(cornerRadius: Radius.L))
107
+
108
+ if props.isShowCloseIcon {
109
+ closeButton
110
+ .offset(x: 1, y: -11)
111
+ }
112
+ }
113
+ .padding(.horizontal, Spacing.M)
114
+ .accessibilityElement(children: .ignore)
115
+ .accessibilityIdentifier("popup_notify")
116
+ }
117
+
118
+ private var popupImage: some View {
119
+ WebImage(url: URL(string: props.image), isAnimating: .constant(true))
120
+ .resizable()
121
+ .placeholder {
122
+ Rectangle()
123
+ .fill(Colors.black03)
124
+ .aspectRatio(1.777, contentMode: .fit)
125
+ .frame(maxWidth: .infinity)
126
+ }
127
+ .aspectRatio(1.777, contentMode: .fit)
128
+ .frame(maxWidth: .infinity)
129
+ .clipShape(RoundedCorner(radius: Radius.L, corners: [.topLeft, .topRight]))
130
+ }
131
+
132
+ @ViewBuilder
133
+ private var descriptionContent: some View {
134
+ if descriptionHeight > maxDescriptionHeight {
135
+ ScrollView(.vertical, showsIndicators: false) {
136
+ descriptionText
137
+ }
138
+ .frame(height: maxDescriptionHeight)
139
+ } else {
140
+ descriptionText
141
+ }
142
+ }
143
+
144
+ private var descriptionText: some View {
145
+ MomoText(
146
+ props.description,
147
+ typography: .bodyDefaultRegular,
148
+ accessibilityId: "description_popup_permission"
149
+ )
150
+ .frame(maxWidth: .infinity, alignment: .leading)
151
+ .background(
152
+ GeometryReader { proxy in
153
+ Color.clear
154
+ .onAppear { descriptionHeight = proxy.size.height }
155
+ .onChange(of: props.description) { _ in
156
+ descriptionHeight = proxy.size.height
157
+ }
158
+ }
159
+ )
160
+ }
161
+
162
+ @ViewBuilder
163
+ private var actionButtons: some View {
164
+ if shouldUseColumnButtons {
165
+ VStack(spacing: Spacing.S) {
166
+ primaryButton
167
+ if props.secondary != nil {
168
+ secondaryButton
169
+ }
170
+ }
171
+ } else {
172
+ HStack(spacing: Spacing.S) {
173
+ if props.secondary != nil {
174
+ secondaryButton
175
+ .frame(maxWidth: .infinity)
176
+ }
177
+ primaryButton
178
+ .frame(maxWidth: .infinity)
179
+ }
180
+ }
181
+ }
182
+
183
+ private var primaryButton: some View {
184
+ Button(
185
+ title: props.primary?.title ?? "",
186
+ action: { props.primary?.onPress?() },
187
+ size: .medium
188
+ )
189
+ .accessibilityIdentifier("btn_popup_allow")
190
+ }
191
+
192
+ private var secondaryButton: some View {
193
+ Button(
194
+ title: props.secondary?.title ?? "",
195
+ action: { props.secondary?.onPress?() },
196
+ type: .text,
197
+ size: .medium
198
+ )
199
+ .accessibilityIdentifier("btn_popup_cancel")
200
+ }
201
+
202
+ private var closeButton: some View {
203
+ SwiftUI.Button(action: props.onIconClose) {
204
+ ZStack {
205
+ Circle()
206
+ .fill(Colors.black17)
207
+ .overlay(
208
+ Circle()
209
+ .stroke(Colors.black01, lineWidth: 2)
210
+ )
211
+ .frame(width: 22, height: 22)
212
+
213
+ Icon(source: "navigation_close", size: 16, color: Colors.black01)
214
+ }
215
+ }
216
+ .accessibilityIdentifier("ic_popup_close")
217
+ }
218
+ }
@@ -2,6 +2,8 @@ import SwiftUI
2
2
  import SDWebImageSwiftUI
3
3
 
4
4
  public struct PopupPromotion: View {
5
+ @Environment(\.appTheme) private var theme
6
+
5
7
  var imageUrl: String
6
8
  var onIconClose: (() -> Void)?
7
9
  var onAction: (() -> Void)?
@@ -18,21 +20,26 @@ public struct PopupPromotion: View {
18
20
  }
19
21
 
20
22
  public var body: some View {
23
+ // Mirrors Kotlin's `Modifier.fillMaxWidth().aspectRatio(0.72f)` box with
24
+ // `ContentScale.FillBounds` inside it: a fixed-ratio frame the image stretches
25
+ // to exactly fill (no `.aspectRatio` modifier on the image itself, unlike the
26
+ // previous `.fit`, which letterboxed instead of stretching).
27
+ let boxWidth = UIScreen.main.bounds.width - Spacing.XL * 2
28
+ let boxHeight = boxWidth / 0.72
29
+
21
30
  VStack(spacing: 8) {
22
31
  if(imageUrl.isEmpty) {
23
- Icon(source: "media_fail", size: UIScreen.main.bounds.width - Spacing.XL * 2)
32
+ Icon(source: "media_fail", size: boxWidth)
24
33
  }
25
34
  else {
26
35
  WebImage(url: URL(string: imageUrl)!)
27
36
  .resizable()
28
37
  .placeholder {
29
38
  Color.gray
30
- .aspectRatio(0.72, contentMode: .fit)
31
- .frame(maxWidth: UIScreen.main.bounds.width - Spacing.XL * 2)
39
+ .frame(width: boxWidth, height: boxHeight)
32
40
  .clipped()
33
41
  }
34
- .aspectRatio(0.72, contentMode: .fit)
35
- .frame(maxWidth: UIScreen.main.bounds.width - Spacing.XL * 2, alignment: .center)
42
+ .frame(width: boxWidth, height: boxHeight, alignment: .center)
36
43
  .clipped()
37
44
  .onTapGesture {
38
45
  onAction?()
@@ -53,16 +60,17 @@ public struct PopupPromotion: View {
53
60
  }) {
54
61
  ZStack {
55
62
  Circle()
56
- .strokeBorder(Colors.black01, lineWidth: 2)
57
- .background(Circle().fill(Colors.black17))
63
+ .strokeBorder(theme.colors.background.surface, lineWidth: 2)
64
+ .background(Circle().fill(theme.colors.text.default))
58
65
  .frame(width: 22, height: 22)
59
66
 
60
- Icon(source: "navigation_close", size: 16, color: Colors.black01)
67
+ Icon(source: "navigation_close", size: 16, color: theme.colors.background.surface)
61
68
  }
62
69
  .frame(width: 40, height: 40)
63
70
  .padding(8)
64
71
  .zIndex(1)
65
72
  }
73
+ .buttonStyle(.plain)
66
74
  }
67
75
  }
68
76
 
@@ -0,0 +1,296 @@
1
+ import SwiftUI
2
+
3
+ // MARK: - Data model
4
+
5
+ public struct ProgressInfoItem: Identifiable {
6
+ public let id = UUID()
7
+ public let title: String
8
+ public let description: String?
9
+
10
+ public init(title: String, description: String? = nil) {
11
+ self.title = title
12
+ self.description = description
13
+ }
14
+ }
15
+
16
+ public enum ProgressInfoSize {
17
+ case small
18
+ case large
19
+ }
20
+
21
+ public enum ProgressInfoAlign {
22
+ case left
23
+ case right
24
+ case center
25
+ case stretch
26
+ }
27
+
28
+ // MARK: - Public entry-point
29
+
30
+ /// Display-only step progress indicator.
31
+ ///
32
+ /// - Parameters:
33
+ /// - steps: Ordered list of steps; each has a title and an optional description.
34
+ /// - horizontal: When `true` renders steps in a horizontal row with connector lines;
35
+ /// when `false` (default) renders a vertical column.
36
+ /// - size: Icon diameter: `.small` = 16, `.large` = 24 (default).
37
+ /// - useNumber: Show the 1-based step index inside the icon instead of the default dot.
38
+ /// - align: Alignment of icon + text for the horizontal variant.
39
+ /// - showTitle: Whether step titles are rendered (default `true`).
40
+ /// - showDescription: Whether step descriptions are rendered (default `true`).
41
+ /// - customIcon: Icon source key rendered inside each step circle (overrides the dot;
42
+ /// itself overridden by `useNumber`).
43
+ public struct ProgressInfo: View {
44
+ private let steps: [ProgressInfoItem]
45
+ private let horizontal: Bool
46
+ private let size: ProgressInfoSize
47
+ private let useNumber: Bool
48
+ private let align: ProgressInfoAlign
49
+ private let showTitle: Bool
50
+ private let showDescription: Bool
51
+ private let customIcon: String?
52
+
53
+ public init(
54
+ steps: [ProgressInfoItem],
55
+ horizontal: Bool = false,
56
+ size: ProgressInfoSize = .large,
57
+ useNumber: Bool = false,
58
+ align: ProgressInfoAlign = .center,
59
+ showTitle: Bool = true,
60
+ showDescription: Bool = true,
61
+ customIcon: String? = nil
62
+ ) {
63
+ self.steps = steps
64
+ self.horizontal = horizontal
65
+ self.size = size
66
+ self.useNumber = useNumber
67
+ self.align = align
68
+ self.showTitle = showTitle
69
+ self.showDescription = showDescription
70
+ self.customIcon = customIcon
71
+ }
72
+
73
+ public var body: some View {
74
+ if horizontal {
75
+ ProgressInfoHorizontal(
76
+ steps: steps,
77
+ size: size,
78
+ useNumber: useNumber,
79
+ align: align,
80
+ showTitle: showTitle,
81
+ showDescription: showDescription,
82
+ customIcon: customIcon
83
+ )
84
+ } else {
85
+ ProgressInfoVertical(
86
+ steps: steps,
87
+ size: size,
88
+ useNumber: useNumber,
89
+ showTitle: showTitle,
90
+ showDescription: showDescription,
91
+ customIcon: customIcon
92
+ )
93
+ }
94
+ }
95
+ }
96
+
97
+ // MARK: - Tokens
98
+
99
+ private let progressInfoLineColor = Colors.pink08
100
+ private let progressInfoAccentColor = Colors.pinkMoMoBranding
101
+
102
+ // MARK: - Horizontal variant
103
+
104
+ private struct ProgressInfoHorizontal: View {
105
+ let steps: [ProgressInfoItem]
106
+ let size: ProgressInfoSize
107
+ let useNumber: Bool
108
+ let align: ProgressInfoAlign
109
+ let showTitle: Bool
110
+ let showDescription: Bool
111
+ let customIcon: String?
112
+
113
+ var body: some View {
114
+ HStack(alignment: .top, spacing: 0) {
115
+ ForEach(Array(steps.enumerated()), id: \.element.id) { index, item in
116
+ let isFirst = index == 0
117
+ let isLast = index == steps.count - 1
118
+
119
+ let alignment = columnAlignment(isFirst: isFirst, isLast: isLast)
120
+ let textAlign = textAlignment(isFirst: isFirst, isLast: isLast)
121
+ let endPadding: CGFloat = (!isLast && align != .center && align != .stretch) ? Spacing.XS : 0
122
+ let hideLineLeft = align == .left || (align == .stretch && isFirst)
123
+ let hideLineRight = align == .right || (align == .stretch && isLast)
124
+
125
+ VStack(alignment: alignment, spacing: 0) {
126
+ HStack(spacing: 0) {
127
+ if !hideLineLeft {
128
+ ProgressInfoHorizontalLine()
129
+ }
130
+ ProgressInfoStepIcon(
131
+ index: index,
132
+ size: size,
133
+ useNumber: useNumber,
134
+ customIcon: customIcon
135
+ )
136
+ .padding(.vertical, Spacing.XS)
137
+ if !hideLineRight {
138
+ ProgressInfoHorizontalLine()
139
+ }
140
+ }
141
+ .frame(maxWidth: .infinity)
142
+
143
+ if showTitle && !item.title.isEmpty {
144
+ MomoText(item.title, typography: .headerXsSemibold)
145
+ .multilineTextAlignment(textAlign)
146
+ .frame(maxWidth: .infinity, alignment: frameAlignment(alignment))
147
+ .padding(.bottom, Spacing.XS)
148
+ }
149
+
150
+ if showDescription, let desc = item.description, !desc.isEmpty {
151
+ MomoText(desc, typography: .descriptionDefaultRegular, color: Colors.black12)
152
+ .multilineTextAlignment(textAlign)
153
+ .frame(maxWidth: .infinity, alignment: frameAlignment(alignment))
154
+ }
155
+ }
156
+ .frame(maxWidth: .infinity)
157
+ .padding(.trailing, endPadding)
158
+ }
159
+ }
160
+ .frame(maxWidth: .infinity)
161
+ }
162
+
163
+ private func columnAlignment(isFirst: Bool, isLast: Bool) -> HorizontalAlignment {
164
+ switch align {
165
+ case .left: return .leading
166
+ case .right: return .trailing
167
+ case .center: return .center
168
+ case .stretch:
169
+ if isFirst { return .leading }
170
+ if isLast { return .trailing }
171
+ return .center
172
+ }
173
+ }
174
+
175
+ private func frameAlignment(_ h: HorizontalAlignment) -> Alignment {
176
+ switch h {
177
+ case .leading: return .leading
178
+ case .trailing: return .trailing
179
+ default: return .center
180
+ }
181
+ }
182
+
183
+ private func textAlignment(isFirst: Bool, isLast: Bool) -> TextAlignment {
184
+ switch align {
185
+ case .left: return .leading
186
+ case .right: return .trailing
187
+ case .center: return .center
188
+ case .stretch:
189
+ if isFirst { return .leading }
190
+ if isLast { return .trailing }
191
+ return .center
192
+ }
193
+ }
194
+ }
195
+
196
+ // MARK: - Vertical variant
197
+
198
+ private struct ProgressInfoVertical: View {
199
+ @Environment(\.appTheme) private var theme
200
+
201
+ let steps: [ProgressInfoItem]
202
+ let size: ProgressInfoSize
203
+ let useNumber: Bool
204
+ let showTitle: Bool
205
+ let showDescription: Bool
206
+ let customIcon: String?
207
+
208
+ var body: some View {
209
+ VStack(alignment: .leading, spacing: 0) {
210
+ ForEach(Array(steps.enumerated()), id: \.element.id) { index, item in
211
+ let isLast = index == steps.count - 1
212
+
213
+ HStack(alignment: .top, spacing: 0) {
214
+ VStack(spacing: 0) {
215
+ ProgressInfoStepIcon(
216
+ index: index,
217
+ size: size,
218
+ useNumber: useNumber,
219
+ customIcon: customIcon
220
+ )
221
+ if !isLast {
222
+ Rectangle()
223
+ .fill(theme.colors.primary.opacity(0.2))
224
+ .frame(width: 2)
225
+ .frame(maxHeight: .infinity)
226
+ }
227
+ }
228
+ .frame(minHeight: isLast ? 40 : 48)
229
+
230
+ VStack(alignment: .leading, spacing: 0) {
231
+ if showTitle && !item.title.isEmpty {
232
+ MomoText(item.title, typography: .headerXsSemibold)
233
+ .lineLimit(2)
234
+ .frame(maxWidth: .infinity, alignment: .leading)
235
+ .padding(.trailing, Spacing.S)
236
+ }
237
+ if showDescription, let desc = item.description, !desc.isEmpty {
238
+ MomoText(desc, typography: .descriptionDefaultRegular, color: Colors.black12)
239
+ .frame(maxWidth: .infinity, alignment: .leading)
240
+ }
241
+ }
242
+ .frame(maxWidth: .infinity, alignment: .leading)
243
+ .padding(.trailing, Spacing.S)
244
+ .padding(.bottom, isLast ? 0 : Spacing.S)
245
+ }
246
+ .frame(maxWidth: .infinity, alignment: .leading)
247
+ .fixedSize(horizontal: false, vertical: true)
248
+ }
249
+ }
250
+ .frame(maxWidth: .infinity, alignment: .leading)
251
+ }
252
+ }
253
+
254
+ // MARK: - Step icon
255
+
256
+ private struct ProgressInfoStepIcon: View {
257
+ let index: Int
258
+ let size: ProgressInfoSize
259
+ let useNumber: Bool
260
+ let customIcon: String?
261
+
262
+ var body: some View {
263
+ let containerSize = scaleSize(size == .small ? 16 : 24)
264
+ let dotSize = scaleSize(size == .small ? 6 : 8)
265
+ let iconSize = scaleSize(size == .small ? 12 : 16)
266
+
267
+ ZStack {
268
+ Circle()
269
+ .fill(progressInfoLineColor)
270
+ .overlay(Circle().strokeBorder(progressInfoLineColor, lineWidth: 2))
271
+
272
+ if useNumber {
273
+ MomoText("\(index + 1)", typography: .headerXsSemibold, color: progressInfoAccentColor)
274
+ .multilineTextAlignment(.center)
275
+ } else if let icon = customIcon, !icon.isEmpty {
276
+ Icon(source: icon, size: iconSize, color: progressInfoAccentColor)
277
+ } else {
278
+ Circle()
279
+ .fill(progressInfoAccentColor)
280
+ .frame(width: dotSize, height: dotSize)
281
+ }
282
+ }
283
+ .frame(width: containerSize, height: containerSize)
284
+ }
285
+ }
286
+
287
+ // MARK: - Horizontal connector line
288
+
289
+ private struct ProgressInfoHorizontalLine: View {
290
+ var body: some View {
291
+ Rectangle()
292
+ .fill(progressInfoLineColor)
293
+ .frame(height: 2)
294
+ .frame(maxWidth: .infinity)
295
+ }
296
+ }
@@ -0,0 +1,69 @@
1
+ import Foundation
2
+ import SwiftUI
3
+
4
+ public struct Radio: View {
5
+ @Environment(\.appTheme) private var theme
6
+
7
+ var value: AnyHashable
8
+ @Binding var groupValue: AnyHashable
9
+ var disabled: Bool
10
+ var onChange: (() -> Void)?
11
+ var label: String
12
+
13
+ public init(
14
+ value: AnyHashable,
15
+ groupValue: Binding<AnyHashable>,
16
+ disabled: Bool = false,
17
+ onChange: (() -> Void)? = nil,
18
+ label: String = ""
19
+ ) {
20
+ self.value = value
21
+ self._groupValue = groupValue
22
+ self.disabled = disabled
23
+ self.onChange = onChange
24
+ self.label = label
25
+ }
26
+
27
+ private var selected: Bool {
28
+ value == groupValue
29
+ }
30
+
31
+ private func onTap() {
32
+ groupValue = value
33
+ onChange?()
34
+ }
35
+
36
+ public var body: some View {
37
+ SwiftUI.Button(action: onTap) {
38
+ HStack(spacing: 0) {
39
+ RoundedRectangle(cornerRadius: Radius.M)
40
+ .stroke(borderColor, lineWidth: borderWidth)
41
+ .frame(width: 20, height: 20)
42
+ .padding(.trailing, label.isEmpty ? 0 : Spacing.XS)
43
+
44
+ if !label.isEmpty {
45
+ MomoText(label, typography: .descriptionDefaultRegular)
46
+ }
47
+ }
48
+ .contentShape(Rectangle())
49
+ }
50
+ .buttonStyle(ActiveOpacityButtonStyle())
51
+ .disabled(disabled)
52
+ }
53
+
54
+ private var borderWidth: CGFloat {
55
+ selected ? 6 : 2
56
+ }
57
+
58
+ private var borderColor: Color {
59
+ if disabled && selected {
60
+ return theme.colors.background.tonal
61
+ } else if disabled {
62
+ return theme.colors.text.disable
63
+ } else if selected {
64
+ return theme.colors.primary
65
+ } else {
66
+ return theme.colors.text.default
67
+ }
68
+ }
69
+ }