@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,182 @@
1
+ //
2
+ // ThemeDemo.swift
3
+ // iosApp
4
+ //
5
+ // Created by sophia on 25/2/26.
6
+ //
7
+
8
+ import MoMoUIKits
9
+ import SwiftUI
10
+
11
+ // MARK: - ThemeDemo
12
+
13
+ struct ThemeDemo: View {
14
+ @Environment(\.appTheme) private var theme
15
+ @State private var isDarkMode: Bool = false
16
+
17
+ var body: some View {
18
+ ScrollView {
19
+ VStack(alignment: .leading, spacing: 0) {
20
+
21
+ // MARK: Dark Mode Toggle
22
+ Toggle(isOn: $isDarkMode) {
23
+ Text("Dark Mode")
24
+ .font(.headline)
25
+ }
26
+ .padding(.horizontal, 16)
27
+ .padding(.vertical, 12)
28
+ .onChange(of: isDarkMode) { _ in
29
+ // Theme switching is handled via parent environment
30
+ }
31
+
32
+ Divider()
33
+
34
+ // MARK: Primary / Secondary
35
+ SectionHeader("Primary & Secondary")
36
+ ThemeColorRow(label: "primary", color: theme.colors.primary)
37
+ ThemeColorRow(label: "secondary", color: theme.colors.secondary)
38
+
39
+ // MARK: Background
40
+ SectionHeader("Background")
41
+ ThemeColorRow(label: "default", color: theme.colors.background.default)
42
+ ThemeColorRow(label: "surface", color: theme.colors.background.surface)
43
+ ThemeColorRow(label: "tonal", color: theme.colors.background.tonal)
44
+ ThemeColorRow(label: "pressed", color: theme.colors.background.pressed)
45
+ ThemeColorRow(label: "selected", color: theme.colors.background.selected)
46
+ ThemeColorRow(label: "disable", color: theme.colors.background.disable)
47
+
48
+ // MARK: Text
49
+ SectionHeader("Text")
50
+ ThemeColorRow(label: "default", color: theme.colors.text.default)
51
+ ThemeColorRow(label: "secondary", color: theme.colors.text.secondary)
52
+ ThemeColorRow(label: "hint", color: theme.colors.text.hint)
53
+ ThemeColorRow(label: "disable", color: theme.colors.text.disable)
54
+
55
+ // MARK: Border
56
+ SectionHeader("Border")
57
+ ThemeColorRow(label: "default", color: theme.colors.border.default)
58
+ ThemeColorRow(label: "disable", color: theme.colors.border.disable)
59
+
60
+ // MARK: Success
61
+ SectionHeader("Success")
62
+ ThemeColorRow(label: "primary", color: theme.colors.success.primary)
63
+ ThemeColorRow(label: "secondary", color: theme.colors.success.secondary)
64
+ ThemeColorRow(label: "container", color: theme.colors.success.container)
65
+
66
+ // MARK: Warning
67
+ SectionHeader("Warning")
68
+ ThemeColorRow(label: "primary", color: theme.colors.warning.primary)
69
+ ThemeColorRow(label: "secondary", color: theme.colors.warning.secondary)
70
+ ThemeColorRow(label: "container", color: theme.colors.warning.container)
71
+
72
+ // MARK: Error
73
+ SectionHeader("Error")
74
+ ThemeColorRow(label: "primary", color: theme.colors.error.primary)
75
+ ThemeColorRow(label: "secondary", color: theme.colors.error.secondary)
76
+ ThemeColorRow(label: "container", color: theme.colors.error.container)
77
+
78
+ // MARK: Highlight
79
+ SectionHeader("Highlight")
80
+ ThemeColorRow(label: "primary", color: theme.colors.highlight.primary)
81
+ ThemeColorRow(label: "secondary", color: theme.colors.highlight.secondary)
82
+ ThemeColorRow(label: "container", color: theme.colors.highlight.container)
83
+
84
+ // MARK: Interactive
85
+ SectionHeader("Interactive")
86
+ ThemeColorRow(label: "primary", color: theme.colors.interactive.primary)
87
+ ThemeColorRow(label: "secondary", color: theme.colors.interactive.secondary)
88
+ ThemeColorRow(label: "container", color: theme.colors.interactive.container)
89
+
90
+ Spacer(minLength: 32)
91
+ }
92
+ }
93
+ .navigationTitle("Theme")
94
+ .background(isDarkMode ? Colors.black10.ignoresSafeArea() : theme.colors.background.default.ignoresSafeArea())
95
+ .environment(\.appTheme, isDarkMode ? darkTheme : defaultTheme)
96
+ }
97
+ }
98
+
99
+ // MARK: - SectionHeader
100
+
101
+ private struct SectionHeader: View {
102
+ let title: String
103
+
104
+ init(_ title: String) {
105
+ self.title = title
106
+ }
107
+
108
+ var body: some View {
109
+ Text(title)
110
+ .font(.headline)
111
+ .fontWeight(.bold)
112
+ .padding(.horizontal, 16)
113
+ .padding(.top, 20)
114
+ .padding(.bottom, 8)
115
+ }
116
+ }
117
+
118
+ // MARK: - ThemeColorRow
119
+
120
+ private struct ThemeColorRow: View {
121
+ @Environment(\.appTheme) private var theme
122
+ let label: String
123
+ let color: Color
124
+
125
+ var body: some View {
126
+ HStack(spacing: 12) {
127
+ RoundedRectangle(cornerRadius: 8)
128
+ .fill(color)
129
+ .frame(width: 36, height: 36)
130
+ .overlay(
131
+ RoundedRectangle(cornerRadius: 8)
132
+ .stroke(theme.colors.border.default, lineWidth: 1)
133
+ )
134
+
135
+ Text(label)
136
+ .font(.body)
137
+ .foregroundColor(theme.colors.text.default)
138
+
139
+ Spacer()
140
+
141
+ Text(color.toHexString())
142
+ .font(.caption)
143
+ .foregroundColor(theme.colors.text.hint)
144
+ .padding(.horizontal, 8)
145
+ .padding(.vertical, 4)
146
+ .background(theme.colors.background.tonal)
147
+ .clipShape(Capsule())
148
+ }
149
+ .padding(.horizontal, 16)
150
+ .padding(.vertical, 4)
151
+ }
152
+ }
153
+
154
+ // MARK: - Color+Hex helper
155
+
156
+ extension Color {
157
+ /// Returns a hex string like "#EB2F96" from a SwiftUI Color.
158
+ func toHexString() -> String {
159
+ guard let cgColor = UIColor(self).cgColor.converted(
160
+ to: CGColorSpaceCreateDeviceRGB(),
161
+ intent: .defaultIntent,
162
+ options: nil
163
+ ) else { return "#??????" }
164
+ guard let components = cgColor.components, components.count >= 3 else { return "#??????" }
165
+ let r = Int((components[0] * 255).rounded())
166
+ let g = Int((components[1] * 255).rounded())
167
+ let b = Int((components[2] * 255).rounded())
168
+ return String(format: "#%02X%02X%02X", r, g, b)
169
+ }
170
+ }
171
+
172
+ // MARK: - Preview
173
+
174
+ #Preview {
175
+ if #available(iOS 16.0, *) {
176
+ NavigationStack {
177
+ ThemeDemo()
178
+ }
179
+ } else {
180
+ // Fallback on earlier versions
181
+ }
182
+ }
@@ -0,0 +1,109 @@
1
+ //
2
+ // TitleDemo.swift
3
+ // Example
4
+ //
5
+ import SwiftUI
6
+ import MoMoUIKits
7
+
8
+ struct TitleDemo: View {
9
+ var body: some View {
10
+ ScrollView {
11
+ VStack(alignment: .leading, spacing: 24) {
12
+ section("Section Type") {
13
+ Title(
14
+ title: "Section Small",
15
+ type: .section,
16
+ size: .small
17
+ )
18
+ Title(
19
+ title: "Section Medium",
20
+ type: .section,
21
+ size: .medium,
22
+ icon: "basic_home",
23
+ description: "This is a medium section with icon."
24
+ )
25
+ Title(
26
+ title: "Section Large",
27
+ type: .section,
28
+ size: .large,
29
+ showTrailingAction: true,
30
+ badgeLabel: "NEW",
31
+ onPressTrailingAction: { }
32
+ )
33
+ }
34
+
35
+ section("Card Type") {
36
+ Title(
37
+ title: "Card Small Text Only",
38
+ type: .card,
39
+ size: .small,
40
+ textOnly: true
41
+ )
42
+ Title(
43
+ title: "Card Medium with Right Action",
44
+ type: .card,
45
+ size: .medium,
46
+ icon: "basic_home",
47
+ showRightAction: true,
48
+ buttonTitle: "Action",
49
+ onPressRightAction: { }
50
+ )
51
+ Title(
52
+ title: "Card Large Full",
53
+ type: .card,
54
+ size: .large,
55
+ icon: "basic_home",
56
+ showRightAction: true,
57
+ badgeLabel: "99+",
58
+ onPressRightAction: { },
59
+ description: "A large card title with description, badge and right arrow."
60
+ )
61
+ }
62
+
63
+ section("Icon Alignment") {
64
+ Title(
65
+ title: "Icon Top",
66
+ type: .section,
67
+ icon: "basic_home",
68
+ iconAlign: .top,
69
+ description: "Icon aligned to top"
70
+ )
71
+ Title(
72
+ title: "Icon Center",
73
+ type: .section,
74
+ icon: "basic_home",
75
+ iconAlign: .center,
76
+ description: "Icon aligned to center"
77
+ )
78
+ Title(
79
+ title: "Icon Bottom",
80
+ type: .section,
81
+ icon: "basic_home",
82
+ iconAlign: .bottom,
83
+ description: "Icon aligned to bottom"
84
+ )
85
+ }
86
+ }
87
+ .padding(16)
88
+ }
89
+ }
90
+
91
+ @ViewBuilder
92
+ private func section<Content: View>(
93
+ _ title: String,
94
+ @ViewBuilder content: () -> Content
95
+ ) -> some View {
96
+ VStack(alignment: .leading, spacing: 8) {
97
+ MomoText(title, typography: .headerSSemibold, color: Colors.textSecondary)
98
+ content()
99
+ }
100
+ }
101
+ }
102
+
103
+ struct TitleDemo_Previews: PreviewProvider {
104
+ static var previews: some View {
105
+ NavigationView {
106
+ TitleDemo()
107
+ }
108
+ }
109
+ }
@@ -0,0 +1,187 @@
1
+ //
2
+ // TooltipDemo.swift
3
+ // Example
4
+ //
5
+
6
+ import Foundation
7
+ import MoMoUIKits
8
+ import SwiftUI
9
+
10
+ // MARK: - TooltipDemo
11
+
12
+ struct TooltipDemo: View {
13
+ // Placement
14
+ @StateObject private var topState = TooltipState()
15
+ @StateObject private var bottomState = TooltipState()
16
+ @StateObject private var leftState = TooltipState()
17
+ @StateObject private var rightState = TooltipState()
18
+
19
+ // Alignment
20
+ @StateObject private var startState = TooltipState()
21
+ @StateObject private var centerState = TooltipState()
22
+ @StateObject private var endState = TooltipState()
23
+
24
+ // With Buttons
25
+ @StateObject private var singleBtnState = TooltipState()
26
+ @StateObject private var twoBtnState = TooltipState()
27
+
28
+ // Description Only
29
+ @StateObject private var descState = TooltipState()
30
+
31
+ var body: some View {
32
+ ScrollView {
33
+ VStack(alignment: .leading, spacing: 48) {
34
+ // MARK: - Placement
35
+
36
+ section("Placement") {
37
+ Tooltip(
38
+ state: topState,
39
+ title: "Top",
40
+ description: "Tooltip on top of the anchor.",
41
+ placement: .top,
42
+ onPressClose: { topState.hide() }
43
+ ) {
44
+ Button(title: "Top", action: { topState.toggle() }, size: .small, isFull: false)
45
+ }
46
+
47
+ Tooltip(
48
+ state: bottomState,
49
+ title: "Bottom",
50
+ description: "Tooltip below the anchor.",
51
+ placement: .bottom,
52
+ onPressClose: { bottomState.hide() }
53
+ ) {
54
+ Button(title: "Bottom", action: { bottomState.toggle() }, size: .small, isFull: false)
55
+ }
56
+
57
+ HStack {
58
+ Tooltip(
59
+ state: rightState,
60
+ title: "Right",
61
+ description: "Tooltip on the right.",
62
+ placement: .right,
63
+ onPressClose: { rightState.hide() }
64
+ ) {
65
+ Button(title: "Right", action: { rightState.toggle() }, size: .small, isFull: false)
66
+ }
67
+ Spacer().frame(width: 12)
68
+ Tooltip(
69
+ state: leftState,
70
+ title: "Left",
71
+ description: "Tooltip on the left.",
72
+ placement: .left,
73
+ onPressClose: { leftState.hide() }
74
+ ) {
75
+ Button(title: "Left", action: { leftState.toggle() }, size: .small, isFull: false)
76
+ }
77
+ }
78
+ }
79
+
80
+ // MARK: - Alignment
81
+
82
+ section("Alignment") {
83
+ Tooltip(
84
+ state: startState,
85
+ title: "Start",
86
+ description: "Aligned to start.",
87
+ placement: .bottom,
88
+ align: .start,
89
+ onPressClose: { startState.hide() }
90
+ ) {
91
+ Button(title: "Start", action: { startState.toggle() }, size: .small, isFull: false)
92
+ }
93
+
94
+ Tooltip(
95
+ state: centerState,
96
+ title: "Center",
97
+ description: "Aligned to center.",
98
+ placement: .bottom,
99
+ align: .center,
100
+ onPressClose: { centerState.hide() }
101
+ ) {
102
+ Button(title: "Center", action: { centerState.toggle() }, size: .small, isFull: false)
103
+ }
104
+
105
+ Tooltip(
106
+ state: endState,
107
+ title: "End",
108
+ description: "Aligned to end.",
109
+ placement: .bottom,
110
+ align: .end,
111
+ onPressClose: { endState.hide() }
112
+ ) {
113
+ Button(title: "End", action: { endState.toggle() }, size: .small, isFull: false)
114
+ }
115
+ }
116
+
117
+ // MARK: - With Buttons
118
+
119
+ section("With Buttons") {
120
+ Tooltip(
121
+ state: singleBtnState,
122
+ title: "Single Button",
123
+ description: "Tooltip with one action button.",
124
+ buttons: [
125
+ TooltipButton(title: "Got it", onPress: { singleBtnState.hide() })
126
+ ],
127
+ placement: .bottom,
128
+ onPressClose: { singleBtnState.hide() }
129
+ ) {
130
+ Button(title: "1 Button", action: { singleBtnState.toggle() }, size: .small, isFull: false)
131
+ }
132
+
133
+ Tooltip(
134
+ state: twoBtnState,
135
+ title: "Two Buttons",
136
+ description: "Tooltip with primary and secondary actions.",
137
+ buttons: [
138
+ TooltipButton(title: "Confirm", onPress: { twoBtnState.hide() }),
139
+ TooltipButton(title: "Cancel", onPress: { twoBtnState.hide() })
140
+ ],
141
+ placement: .bottom,
142
+ onPressClose: { twoBtnState.hide() }
143
+ ) {
144
+ Button(title: "2 Buttons", action: { twoBtnState.toggle() }, size: .small, isFull: false)
145
+ }
146
+ }
147
+
148
+ // MARK: - Description Only
149
+
150
+ section("Description Only") {
151
+ Tooltip(
152
+ state: descState,
153
+ description: "This tooltip has no title, just a description.",
154
+ placement: .top,
155
+ onPressClose: { descState.hide() }
156
+ ) {
157
+ Button(title: "No Title", action: { descState.toggle() }, size: .small, isFull: false)
158
+ }
159
+ }
160
+ }
161
+ .padding(.vertical, 48)
162
+ .padding(.horizontal, 16)
163
+ }
164
+ }
165
+
166
+ // MARK: - Helpers
167
+
168
+ @ViewBuilder
169
+ private func section<Content: View>(
170
+ _ title: String,
171
+ @ViewBuilder content: () -> Content
172
+ ) -> some View {
173
+ VStack(alignment: .leading, spacing: 24) {
174
+ Text(title)
175
+ .font(.headline)
176
+ content()
177
+ }
178
+ }
179
+ }
180
+
181
+ #if DEBUG
182
+ struct TooltipDemo_Previews: PreviewProvider {
183
+ static var previews: some View {
184
+ TooltipDemo()
185
+ }
186
+ }
187
+ #endif
@@ -0,0 +1,87 @@
1
+ //
2
+ // TypographyDemo.swift
3
+ // Example
4
+ //
5
+ // Created by dung.pham2 on 29/11/24.
6
+ //
7
+ import SwiftUI
8
+ import MoMoUIKits
9
+
10
+ struct TypographyDemo: View {
11
+ var body: some View {
12
+ ScrollView {
13
+ VStack(alignment: .leading, spacing: 12) {
14
+ // New supported typography styles
15
+ MomoText("Headline Default Bold", typography: .headlineDefaultBold)
16
+ .background(Color.red.opacity(0.3))
17
+ .cornerRadius(4)
18
+ MomoText("Header M Bold", typography: .headerMBold)
19
+ .background(Color.orange.opacity(0.3))
20
+ .cornerRadius(4)
21
+ MomoText("Header Default Bold", typography: .headerDefaultBold)
22
+ .background(Color.yellow.opacity(0.3))
23
+ .cornerRadius(4)
24
+ MomoText("Header S Semibold", typography: .headerSSemibold)
25
+ .background(Color.green.opacity(0.3))
26
+ .cornerRadius(4)
27
+ MomoText("Header XS Semibold", typography: .headerXsSemibold)
28
+ .background(Color.blue.opacity(0.3))
29
+ .cornerRadius(4)
30
+
31
+ Divider().padding(.vertical, 8)
32
+
33
+ // Body Default Regular
34
+ MomoText("Body Default Regular", typography: .bodyDefaultRegular)
35
+ .background(Color.purple.opacity(0.3))
36
+ .cornerRadius(4)
37
+ MomoText("Description Default Regular", typography: .descriptionDefaultRegular)
38
+ .background(Color.pink.opacity(0.3))
39
+ .cornerRadius(4)
40
+ MomoText("Description XS Regular", typography: .descriptionXsRegular)
41
+ .background(Color.gray.opacity(0.3))
42
+ .cornerRadius(4)
43
+
44
+ Divider().padding(.vertical, 8)
45
+
46
+ // Label Default Medium
47
+ MomoText("Label Default Medium", typography: .labelDefaultMedium)
48
+ .background(Color.red.opacity(0.3))
49
+ .cornerRadius(4)
50
+ MomoText("Label S Medium", typography: .labelSMedium)
51
+ .background(Color.orange.opacity(0.3))
52
+ .cornerRadius(4)
53
+ MomoText("Label XS Medium", typography: .labelXsMedium)
54
+ .background(Color.yellow.opacity(0.3))
55
+ .cornerRadius(4)
56
+
57
+ Divider().padding(.vertical, 8)
58
+
59
+ // Action Default Bold
60
+ MomoText("Action Default Bold", typography: .actionDefaultBold)
61
+ .background(Color.green.opacity(0.3))
62
+ .cornerRadius(4)
63
+ MomoText("Action S Bold", typography: .actionSBold)
64
+ .background(Color.blue.opacity(0.3))
65
+ .cornerRadius(4)
66
+ MomoText("Action XS Bold", typography: .actionXsBold)
67
+ .background(Color.purple.opacity(0.3))
68
+ .cornerRadius(4)
69
+ MomoText("Action XXS Bold", typography: .actionXxsBold)
70
+ .background(Color.pink.opacity(0.3))
71
+ .cornerRadius(4)
72
+
73
+ Divider().padding(.vertical, 16)
74
+ }
75
+ .padding(16)
76
+ }
77
+ }
78
+ }
79
+
80
+ struct TypographyDemo_Previews: PreviewProvider {
81
+ static var previews: some View {
82
+ NavigationView {
83
+ TypographyDemo()
84
+ }
85
+ }
86
+ }
87
+
@@ -0,0 +1,131 @@
1
+ //
2
+ // UploaderDemo.swift
3
+ // Example
4
+ //
5
+
6
+ import SwiftUI
7
+ import MoMoUIKits
8
+
9
+ struct UploaderDemo: View {
10
+ private let mockURL = "https://static.momocdn.net/app/img/kits/navigation-bar.png"
11
+
12
+ // Playground state
13
+ @State private var playgroundImages: [UploadImage] = []
14
+ @State private var numberOfImages: Double = 3
15
+ @State private var disabled = false
16
+ @State private var width: Double = 64
17
+ @State private var height: Double = 64
18
+
19
+ var body: some View {
20
+ ScrollView {
21
+ VStack(alignment: .leading, spacing: 24) {
22
+ section("Default — single slot, no images") {
23
+ Uploader(
24
+ images: [],
25
+ numberOfImages: 1,
26
+ onAdd: {}
27
+ )
28
+ }
29
+
30
+ section("With image + cancel button") {
31
+ Uploader(
32
+ images: [UploadImage(uri: mockURL)],
33
+ numberOfImages: 3,
34
+ onAdd: {},
35
+ onCancel: { _, _ in }
36
+ )
37
+ }
38
+
39
+ section("Multiple images (slot full — picker hidden)") {
40
+ Uploader(
41
+ images: [
42
+ UploadImage(uri: mockURL),
43
+ UploadImage(uri: mockURL),
44
+ UploadImage(uri: mockURL),
45
+ ],
46
+ numberOfImages: 3,
47
+ onAdd: {},
48
+ onCancel: { _, _ in }
49
+ )
50
+ }
51
+
52
+ section("Loading state") {
53
+ Uploader(
54
+ images: [UploadImage(uri: mockURL, loading: true)],
55
+ numberOfImages: 3,
56
+ onAdd: {},
57
+ onCancel: { _, _ in }
58
+ )
59
+ }
60
+
61
+ section("Disabled") {
62
+ Uploader(
63
+ images: [],
64
+ numberOfImages: 1,
65
+ disabled: true,
66
+ onAdd: {}
67
+ )
68
+ }
69
+
70
+ section("Custom size (80 x 80)") {
71
+ Uploader(
72
+ images: [UploadImage(uri: mockURL)],
73
+ numberOfImages: 3,
74
+ width: 80,
75
+ height: 80,
76
+ onAdd: {},
77
+ onCancel: { _, _ in }
78
+ )
79
+ }
80
+
81
+ Divider()
82
+
83
+ section("Playground") {
84
+ VStack(alignment: .leading, spacing: 12) {
85
+ Uploader(
86
+ images: playgroundImages,
87
+ numberOfImages: Int(numberOfImages),
88
+ disabled: disabled,
89
+ width: CGFloat(width),
90
+ height: CGFloat(height),
91
+ onAdd: {
92
+ playgroundImages.append(UploadImage(uri: mockURL))
93
+ },
94
+ onCancel: { _, index in
95
+ if playgroundImages.indices.contains(index) {
96
+ playgroundImages.remove(at: index)
97
+ }
98
+ },
99
+ onPressImage: { _, _ in }
100
+ )
101
+
102
+ VStack(alignment: .leading, spacing: 4) {
103
+ Text("numberOfImages: \(Int(numberOfImages))")
104
+ Slider(value: $numberOfImages, in: 1...6, step: 1)
105
+
106
+ Toggle("disabled", isOn: $disabled)
107
+
108
+ Text("width: \(Int(width))")
109
+ Slider(value: $width, in: 48...120, step: 1)
110
+
111
+ Text("height: \(Int(height))")
112
+ Slider(value: $height, in: 48...120, step: 1)
113
+ }
114
+ .font(.footnote)
115
+ }
116
+ }
117
+ }
118
+ .padding()
119
+ }
120
+ }
121
+
122
+ @ViewBuilder
123
+ private func section<Content: View>(_ title: String, @ViewBuilder content: () -> Content) -> some View {
124
+ VStack(alignment: .leading, spacing: 8) {
125
+ Text(title)
126
+ .font(.subheadline)
127
+ .foregroundColor(.secondary)
128
+ content()
129
+ }
130
+ }
131
+ }