@momo-kits/native-kits 0.0.1-beta.4 → 0.0.2-alpha.1

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 (296) hide show
  1. package/CLAUDE.md +99 -0
  2. package/PUBLISH_GUIDE.md +675 -0
  3. package/README.md +184 -5
  4. package/ios/Application/ApplicationEnvironment.swift +71 -0
  5. package/ios/Application/Components.swift +270 -0
  6. package/ios/Application/ComposeApi.swift +22 -0
  7. package/ios/Application/FloatingButton.swift +174 -0
  8. package/ios/Application/HeaderRight.swift +306 -0
  9. package/ios/Application/LanguageSource.swift +93 -0
  10. package/ios/Application/Localize.swift +378 -0
  11. package/ios/Application/LocalizeModifier.swift +30 -0
  12. package/ios/Application/MaxApi.swift +18 -0
  13. package/ios/Application/Navigation/BottomTab/BottomTab.swift +104 -0
  14. package/ios/Application/Navigation/BottomTab/BottomTabBar.swift +215 -0
  15. package/ios/Application/Navigation/BottomTab/CurvedContainer.swift +65 -0
  16. package/ios/Application/Navigation/HeaderBackProps.swift +66 -0
  17. package/ios/Application/Navigation/HeaderTitle.swift +57 -0
  18. package/ios/Application/Navigation/HeaderUser.swift +209 -0
  19. package/ios/Application/Navigation/NavigationContainer.swift +213 -0
  20. package/ios/Application/Navigation/NavigationOptions.swift +109 -0
  21. package/ios/Application/Navigation/Navigator.swift +453 -0
  22. package/ios/Application/Navigation/NavigatorManager.swift +22 -0
  23. package/ios/Application/Navigation/Overplay/BottomSheet.swift +256 -0
  24. package/ios/Application/Navigation/Overplay/ModalScreen.swift +74 -0
  25. package/ios/Application/Navigation/Overplay/SnackBar.swift +144 -0
  26. package/ios/Application/Navigation/Tracking/ScreenTracker.swift +117 -0
  27. package/ios/Application/Navigation/component/Header.swift +178 -0
  28. package/ios/Application/Navigation/component/HeaderBackground.swift +83 -0
  29. package/ios/Application/Navigation/component/HeaderColor.swift +65 -0
  30. package/ios/Application/Navigation/component/HeaderRightWidthKey.swift +11 -0
  31. package/ios/Application/Navigation/component/NavigationFooter.swift +90 -0
  32. package/ios/Application/Navigation/component/NavigationHeaderRight.swift +196 -0
  33. package/ios/Application/Screen.swift +250 -0
  34. package/ios/Application/StackScreen.swift +492 -0
  35. package/ios/Avatar/Avatar.swift +193 -0
  36. package/ios/Badge/Badge.swift +84 -0
  37. package/ios/Badge/BadgeDot.swift +31 -0
  38. package/ios/Badge/BadgeRibbon.swift +319 -0
  39. package/ios/BaselineView/BaselineView.swift +163 -0
  40. package/ios/Button/Button.swift +232 -84
  41. package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +126 -0
  42. package/ios/Carousel/Carousel.swift +196 -0
  43. package/ios/Checkbox/Checkbox.swift +77 -0
  44. package/ios/Chip/Chip.swift +120 -0
  45. package/ios/Collapse/Collapse.swift +192 -0
  46. package/ios/{Colors+Spacing → Colors+Radius+Spacing}/Colors.swift +42 -37
  47. package/ios/Colors+Radius+Spacing/Radius.swift +22 -0
  48. package/ios/{Colors+Spacing → Colors+Radius+Spacing}/Spacing.swift +3 -1
  49. package/ios/Colors+Radius+Spacing/Theme.swift +295 -0
  50. package/ios/DateTimePicker/DateTimePicker.swift +212 -0
  51. package/ios/DateTimePicker/DateTimePickerTypes.swift +55 -0
  52. package/ios/DateTimePicker/DateTimePickerUtils.swift +167 -0
  53. package/ios/DateTimePicker/WheelPicker.swift +165 -0
  54. package/ios/Divider/Divider.swift +16 -0
  55. package/ios/Extensions/ActiveOpacityButtonStyle.swift +14 -0
  56. package/ios/Extensions/Color++.swift +32 -0
  57. package/ios/Icon/Icon.swift +69 -0
  58. package/ios/IconButton/IconButton.swift +140 -0
  59. package/ios/Image/Image.swift +87 -0
  60. package/ios/Information/Information.swift +156 -0
  61. package/ios/Input/ErrorView.swift +58 -0
  62. package/ios/Input/Input.swift +461 -77
  63. package/ios/Input/InputPhoneNumber.swift +192 -0
  64. package/ios/Input/InputSearch.swift +301 -0
  65. package/ios/Input/InputTextArea.swift +318 -0
  66. package/ios/InputDropDown/InputDropDown.swift +201 -0
  67. package/ios/InputMoney/InputMoney.swift +405 -0
  68. package/ios/InputOTP/InputOTP.swift +211 -0
  69. package/ios/Layout/GridContext.swift +30 -0
  70. package/ios/Layout/Item.swift +42 -0
  71. package/ios/Layout/Section.swift +134 -0
  72. package/ios/Loader/Loader.swift +113 -0
  73. package/ios/Lottie/LottieView.swift +86 -0
  74. package/ios/MoMoUIKits.podspec +5 -0
  75. package/ios/OTPKeyboard/KeyboardButton.swift +13 -5
  76. package/ios/OTPKeyboard/OTPKeyboard.swift +1 -1
  77. package/ios/Pagination/PaginationDot.swift +61 -0
  78. package/ios/Pagination/PaginationNumber.swift +35 -0
  79. package/ios/Pagination/PaginationScroll.swift +101 -0
  80. package/ios/Pagination/PaginationWhiteDot.swift +37 -0
  81. package/ios/Popup/PopupDisplay.swift +279 -0
  82. package/ios/Popup/PopupInput.swift +92 -0
  83. package/ios/Popup/PopupNotify.swift +219 -0
  84. package/ios/Popup/PopupPromotion.swift +74 -0
  85. package/ios/PopupView/FullscreenPopup.swift +251 -0
  86. package/ios/{Popup → PopupView}/Modifiers.swift +6 -20
  87. package/ios/{Popup → PopupView}/PopupView.swift +38 -146
  88. package/ios/PopupView/Utils++.swift +281 -0
  89. package/ios/ProgressInfo/ProgressInfo.swift +297 -0
  90. package/ios/Radio/Radio.swift +69 -0
  91. package/ios/Rating/Rating.swift +83 -0
  92. package/{example/ios/Example/Preview Content/Preview Assets.xcassets/Contents.json → ios/Resources/MoMoUIKitsColors.xcassets/AccentColor.colorset/Contents.json} +5 -0
  93. package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Text.colorset/Contents.json +3 -3
  94. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/Contents.json +9 -0
  95. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-default.colorset/Contents.json +38 -0
  96. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-disable.colorset/Contents.json +38 -0
  97. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-pressed.colorset/Contents.json +38 -0
  98. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-selected.colorset/Contents.json +38 -0
  99. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-surface.colorset/Contents.json +38 -0
  100. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-tonal.colorset/Contents.json +38 -0
  101. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-default.colorset/Contents.json +38 -0
  102. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-disable.colorset/Contents.json +38 -0
  103. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/gradient.colorset/Contents.json +38 -0
  104. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/primary.colorset/Contents.json +38 -0
  105. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/secondary.colorset/Contents.json +38 -0
  106. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-container.colorset/Contents.json +38 -0
  107. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-primary.colorset/Contents.json +38 -0
  108. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-secondary.colorset/Contents.json +38 -0
  109. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-default.colorset/Contents.json +38 -0
  110. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-disable.colorset/Contents.json +38 -0
  111. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-hint.colorset/Contents.json +38 -0
  112. package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-secondary.colorset/Contents.json +38 -0
  113. package/ios/ScrollIndicator/ScrollIndicator.swift +110 -0
  114. package/ios/Skeleton/Skeleton.swift +99 -0
  115. package/ios/Slider/Slider.swift +237 -0
  116. package/ios/StatusBarTap/StatusBarTap.h +13 -0
  117. package/ios/StatusBarTap/StatusBarTap.m +75 -0
  118. package/ios/Stepper/Stepper.swift +221 -0
  119. package/ios/Steps/Steps.swift +467 -0
  120. package/ios/SuggestAction/SuggestAction.swift +100 -0
  121. package/ios/Swipeable/SwipeCell.swift +226 -31
  122. package/ios/Swipeable/SwipeCellModel.swift +21 -0
  123. package/ios/Switch/Switch.swift +69 -0
  124. package/ios/TabView/TabView.swift +534 -0
  125. package/ios/Tag/Tag.swift +99 -0
  126. package/ios/Template/Logo/Logo.swift +75 -0
  127. package/ios/Template/TrustBanner/TrustBanner.swift +123 -0
  128. package/ios/Title/Title.swift +270 -0
  129. package/ios/Tooltip/Tooltip.swift +486 -0
  130. package/ios/Typography/FontScale.swift +103 -0
  131. package/ios/Typography/FontScaleStore.swift +58 -0
  132. package/ios/Typography/KitDesignSystem.swift +17 -0
  133. package/ios/Typography/Text.swift +262 -0
  134. package/ios/Typography/Typography.swift +80 -23
  135. package/ios/Uploader/Uploader.swift +174 -0
  136. package/ios/native-kits.podspec +73 -13
  137. package/ios-demo/MoMoUIKitsDemo.podspec +20 -0
  138. package/ios-demo/Resources/dot_loading.json +558 -0
  139. package/ios-demo/Resources/icon.json +4052 -0
  140. package/ios-demo/Resources/lottie_circle_loader.json +1 -0
  141. package/ios-demo/Sources/MoMoUIKitsDemo/DemoScaffold.swift +48 -0
  142. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsBadgeDemoView.swift +25 -0
  143. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsButtonDemoView.swift +26 -0
  144. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsCheckboxDemoView.swift +19 -0
  145. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsChipDemoView.swift +33 -0
  146. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsInputDemoView.swift +48 -0
  147. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsPopupDemoView.swift +21 -0
  148. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsRadioDemoView.swift +17 -0
  149. package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsTypographyDemoView.swift +28 -0
  150. package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoContext.swift +31 -0
  151. package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoFactory.swift +24 -0
  152. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +110 -0
  153. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AvatarDemo.swift +107 -0
  154. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BadgeDemo.swift +75 -0
  155. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BaselineView.swift +117 -0
  156. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +89 -0
  157. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ButtonDemo.swift +108 -0
  158. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CarouselDemo.swift +96 -0
  159. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CheckboxDemo.swift +60 -0
  160. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ChipDemo.swift +76 -0
  161. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CollapseDemo.swift +102 -0
  162. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +107 -0
  163. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DateTimePickerDemo.swift +100 -0
  164. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DemoScreen.swift +420 -0
  165. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DividerDemo.swift +56 -0
  166. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/HeaderUserDemo.swift +49 -0
  167. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +276 -0
  168. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconButtonDemo.swift +93 -0
  169. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconDemo.swift +81 -0
  170. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ImageDemo.swift +65 -0
  171. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InformationDemo.swift +96 -0
  172. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDemo.swift +117 -0
  173. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDropDownDemo.swift +94 -0
  174. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputMoneyDemo.swift +94 -0
  175. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputOTPDemo.swift +88 -0
  176. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +120 -0
  177. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputSearchDemo.swift +85 -0
  178. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputTextAreaDemo.swift +87 -0
  179. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LoaderDemo.swift +73 -0
  180. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LocalizeDemo.swift +235 -0
  181. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +241 -0
  182. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PaginationDemo.swift +68 -0
  183. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PlaygroundData.swift +76 -0
  184. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +175 -0
  185. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +95 -0
  186. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +67 -0
  187. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ProgressInfoDemo.swift +101 -0
  188. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RadioDemo.swift +64 -0
  189. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RatingDemo.swift +68 -0
  190. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SectionDemo.swift +83 -0
  191. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SkeletonDemo.swift +61 -0
  192. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SliderDemo.swift +90 -0
  193. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SnackBarDemo.swift +82 -0
  194. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepperDemo.swift +93 -0
  195. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepsDemo.swift +114 -0
  196. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SuggestActionDemo.swift +90 -0
  197. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwipeDemo.swift +107 -0
  198. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwitchDemo.swift +58 -0
  199. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TabViewDemo.swift +114 -0
  200. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TagDemo.swift +86 -0
  201. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ThemeDemo.swift +181 -0
  202. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TitleDemo.swift +104 -0
  203. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TooltipDemo.swift +118 -0
  204. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +87 -0
  205. package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/UploaderDemo.swift +85 -0
  206. package/ios-demo/Sources/MoMoUIKitsDemo/SwiftUIDemoBrowserView.swift +53 -0
  207. package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoModels.swift +15 -0
  208. package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoRegistry.swift +73 -0
  209. package/package.json +6 -6
  210. package/publish.sh +554 -20
  211. package/scripts/gen-ios-color.mjs +136 -0
  212. package/CODE_OF_CONDUCT.md +0 -133
  213. package/CONTRIBUTING.md +0 -114
  214. package/LICENSE +0 -20
  215. package/android/build.gradle +0 -82
  216. package/android/gradle.properties +0 -5
  217. package/android/src/main/AndroidManifest.xml +0 -4
  218. package/android/src/main/java/com/momoplatform/nativekits/NativeKitsPackage.kt +0 -17
  219. package/android/src/main/java/com/momoplatform/nativekits/NativeKitsViewManager.kt +0 -20
  220. package/example/ios/Example/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -63
  221. package/example/ios/Example/ComponentDetail.swift +0 -35
  222. package/example/ios/Example/ComponentItem.swift +0 -24
  223. package/example/ios/Example/ComponentModel.swift +0 -33
  224. package/example/ios/Example/ContentView.swift +0 -53
  225. package/example/ios/Example/Example.entitlements +0 -10
  226. package/example/ios/Example/Foundation/ButtonDemo.swift +0 -80
  227. package/example/ios/Example/Foundation/Popup/ActionSheets.swift +0 -136
  228. package/example/ios/Example/Foundation/Popup/Floats.swift +0 -127
  229. package/example/ios/Example/Foundation/Popup/Popups.swift +0 -101
  230. package/example/ios/Example/Foundation/PopupDemo.swift +0 -366
  231. package/example/ios/Example/Foundation/TextInputDemo.swift +0 -31
  232. package/example/ios/Example/Foundation/TypographyDemo.swift +0 -53
  233. package/example/ios/Example/Foundation.swift +0 -26
  234. package/example/ios/Example/Info.plist +0 -18
  235. package/example/ios/Example/Library/SwipeableDemo.swift +0 -105
  236. package/example/ios/Example/Library.swift +0 -26
  237. package/example/ios/Example/Main.swift +0 -11
  238. package/example/ios/Example/Overview.swift +0 -20
  239. package/example/ios/Example/Resource/SFProText-Black.ttf +0 -0
  240. package/example/ios/Example/Resource/SFProText-Bold.ttf +0 -0
  241. package/example/ios/Example/Resource/SFProText-Heavy.ttf +0 -0
  242. package/example/ios/Example/Resource/SFProText-Light.ttf +0 -0
  243. package/example/ios/Example/Resource/SFProText-Medium.ttf +0 -0
  244. package/example/ios/Example/Resource/SFProText-Regular.ttf +0 -0
  245. package/example/ios/Example/Resource/SFProText-Semibold.ttf +0 -0
  246. package/example/ios/Example/Resource/SFProText-Thin.ttf +0 -0
  247. package/example/ios/Example/Resource/SFProText-Ultralight.ttf +0 -0
  248. package/example/ios/Example/Resource/foundation.json +0 -33
  249. package/example/ios/Example/Resource/library.json +0 -8
  250. package/example/ios/Example/Utils.swift +0 -30
  251. package/example/ios/Example/ViewModifier/DarkViewModifier.swift +0 -22
  252. package/example/ios/Example.xcodeproj/project.pbxproj +0 -570
  253. package/example/ios/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  254. package/example/ios/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  255. package/example/ios/Example.xcodeproj/project.xcworkspace/xcuserdata/wem.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  256. package/example/ios/Example.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  257. package/example/ios/Example.xcworkspace/contents.xcworkspacedata +0 -10
  258. package/example/ios/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  259. package/example/ios/Example.xcworkspace/xcuserdata/wem.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  260. package/example/ios/Example.xcworkspace/xcuserdata/wem.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -6
  261. package/example/ios/Podfile +0 -6
  262. package/example/ios/Podfile.lock +0 -16
  263. package/example/ios/Pods/Local Podspecs/MoMoUIKits.podspec.json +0 -29
  264. package/example/ios/Pods/Manifest.lock +0 -16
  265. package/example/ios/Pods/Pods.xcodeproj/project.pbxproj +0 -661
  266. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +0 -58
  267. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/Pods-Example.xcscheme +0 -58
  268. package/example/ios/Pods/Pods.xcodeproj/xcuserdata/wem.xcuserdatad/xcschemes/xcschememanagement.plist +0 -25
  269. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-dummy.m +0 -5
  270. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-prefix.pch +0 -12
  271. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits-umbrella.h +0 -16
  272. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.debug.xcconfig +0 -12
  273. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.modulemap +0 -6
  274. package/example/ios/Pods/Target Support Files/MoMoUIKits/MoMoUIKits.release.xcconfig +0 -12
  275. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.markdown +0 -3
  276. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.plist +0 -29
  277. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-dummy.m +0 -5
  278. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example-umbrella.h +0 -16
  279. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig +0 -14
  280. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.modulemap +0 -6
  281. package/example/ios/Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig +0 -14
  282. package/ios/Colors+Spacing/Radius.swift +0 -11
  283. package/ios/Popup/Utils++.swift +0 -163
  284. package/ios/Theme.md +0 -18
  285. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Background.colorset/Contents.json +0 -0
  286. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Border.colorset/Contents.json +0 -0
  287. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Card.colorset/Contents.json +0 -0
  288. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Contents.json +0 -0
  289. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Error.colorset/Contents.json +0 -0
  290. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Primary.colorset/Contents.json +0 -0
  291. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/PrimaryDark.colorset/Contents.json +0 -0
  292. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/PrimaryLight.colorset/Contents.json +0 -0
  293. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Secondary.colorset/Contents.json +0 -0
  294. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Success.colorset/Contents.json +0 -0
  295. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/TextSecondary.colorset/Contents.json +0 -0
  296. /package/{example/ios/Example/Assets.xcassets → ios/Resources/MoMoUIKitsColors.xcassets}/Warning.colorset/Contents.json +0 -0
@@ -0,0 +1,61 @@
1
+ //
2
+ // SkeletonDemo.swift
3
+ // Example
4
+ //
5
+ // Preview + Playground demo (DemoScreen pattern).
6
+ //
7
+
8
+ import MoMoUIKits
9
+ import SwiftUI
10
+
11
+ struct SkeletonDemo: View {
12
+ var body: some View {
13
+ if #available(iOS 16.0, *) {
14
+ DemoScreen(preview: { SkeletonPreview() }, playground: { SkeletonPlayground() })
15
+ } else {
16
+ Text("Requires iOS 16+").padding()
17
+ }
18
+ }
19
+ }
20
+
21
+ // MARK: - Preview
22
+
23
+ private struct SkeletonPreview: View {
24
+ var body: some View {
25
+ BasicColumnBox("Square (aspect 1:1)", alignment: .leading) {
26
+ Skeleton()
27
+ .aspectRatio(1, contentMode: .fit)
28
+ .frame(maxWidth: .infinity)
29
+ }
30
+ BasicColumnBox("Fixed height (32)", alignment: .leading) {
31
+ Skeleton()
32
+ .frame(maxWidth: .infinity)
33
+ .frame(height: 32)
34
+ }
35
+ BasicColumnBox("Lines", alignment: .leading) {
36
+ Skeleton().frame(maxWidth: .infinity).frame(height: 16)
37
+ Skeleton().frame(maxWidth: .infinity).frame(height: 16)
38
+ Skeleton().frame(width: 160).frame(height: 16)
39
+ }
40
+ }
41
+ }
42
+
43
+ // MARK: - Playground
44
+
45
+ @available(iOS 16.0, *)
46
+ private struct SkeletonPlayground: View {
47
+ @State private var height: Double = 32
48
+
49
+ var body: some View {
50
+ PlaygroundTab(
51
+ component: {
52
+ Skeleton()
53
+ .frame(maxWidth: .infinity)
54
+ .frame(height: CGFloat(height))
55
+ },
56
+ params: [
57
+ .slider("Height", $height, min: 16, max: 200, step: 4),
58
+ ]
59
+ )
60
+ }
61
+ }
@@ -0,0 +1,90 @@
1
+ //
2
+ // SliderDemo.swift
3
+ // Example
4
+ //
5
+ // Preview + Playground demo for MomoSlider.
6
+ //
7
+
8
+ import MoMoUIKits
9
+ import SwiftUI
10
+
11
+ struct SliderDemo: View {
12
+ var body: some View {
13
+ if #available(iOS 16.0, *) {
14
+ DemoScreen(preview: { SliderPreview() }, playground: { SliderPlayground() })
15
+ } else {
16
+ Text("Requires iOS 16+").padding()
17
+ }
18
+ }
19
+ }
20
+
21
+ // MARK: - Preview
22
+
23
+ private struct SliderPreview: View {
24
+ var body: some View {
25
+ BasicColumnBox("Range Slider (default)", alignment: .leading) {
26
+ MomoSlider(min: 0, max: 100, step: 1)
27
+ }
28
+ BasicColumnBox("With initial values", alignment: .leading) {
29
+ MomoSlider(min: 0, max: 100, step: 1, low: 20, high: 80)
30
+ }
31
+ BasicColumnBox("Single-thumb (disableRange)", alignment: .leading) {
32
+ MomoSlider(min: 0, max: 100, step: 1, low: 40, disableRange: true)
33
+ }
34
+ BasicColumnBox("Step = 10", alignment: .leading) {
35
+ MomoSlider(min: 0, max: 100, step: 10, low: 20, high: 70)
36
+ }
37
+ BasicColumnBox("Min range = 20", alignment: .leading) {
38
+ MomoSlider(min: 0, max: 100, step: 1, low: 10, high: 90, minRange: 20)
39
+ }
40
+ BasicColumnBox("Floating Label", alignment: .leading) {
41
+ MomoSlider(min: 0, max: 100, step: 1, low: 30, high: 70, floatingLabel: true)
42
+ }
43
+ BasicColumnBox("Disabled", alignment: .leading) {
44
+ MomoSlider(min: 0, max: 100, step: 1, low: 30, high: 70, disabled: true)
45
+ }
46
+ }
47
+ }
48
+
49
+ // MARK: - Playground
50
+
51
+ @available(iOS 16.0, *)
52
+ private struct SliderPlayground: View {
53
+ @State private var low: Double = 20
54
+ @State private var high: Double = 80
55
+ @State private var minRange: Double = 0
56
+ @State private var step: Double = 1
57
+ @State private var disableRange = false
58
+ @State private var floatingLabel = false
59
+ @State private var disabled = false
60
+
61
+ var body: some View {
62
+ PlaygroundTab(
63
+ component: {
64
+ MomoSlider(
65
+ min: 0,
66
+ max: 100,
67
+ step: CGFloat(step),
68
+ low: CGFloat(low),
69
+ high: CGFloat(high),
70
+ minRange: CGFloat(minRange),
71
+ disableRange: disableRange,
72
+ floatingLabel: floatingLabel,
73
+ disabled: disabled,
74
+ onValueChanged: { l, h, _ in low = Double(l); high = Double(h) }
75
+ )
76
+ // Re-seed when structural params change so initial values apply.
77
+ .id("\(disableRange)-\(minRange)-\(step)")
78
+ },
79
+ params: [
80
+ .checkbox("DisableRange", $disableRange),
81
+ .checkbox("FloatingLabel", $floatingLabel),
82
+ .checkbox("Disabled", $disabled),
83
+ .slider("Low", $low, min: 0, max: 100, step: 1),
84
+ .slider("High", $high, min: 0, max: 100, step: 1),
85
+ .slider("MinRange", $minRange, min: 0, max: 40, step: 5),
86
+ .slider("Step", $step, min: 1, max: 10, step: 1),
87
+ ]
88
+ )
89
+ }
90
+ }
@@ -0,0 +1,82 @@
1
+ import MoMoUIKits
2
+ import SwiftUI
3
+
4
+ struct SnackBarDemo: View {
5
+ var body: some View {
6
+ if #available(iOS 16.0, *) {
7
+ DemoScreen(preview: { SnackBarPreview() }, playground: { SnackBarPlayground() })
8
+ } else {
9
+ Text("Requires iOS 16+").padding()
10
+ }
11
+ }
12
+ }
13
+
14
+ // MARK: - Preview
15
+
16
+ @available(iOS 16.0, *)
17
+ private struct SnackBarPreview: View {
18
+ @EnvironmentObject private var navigator: Navigator
19
+
20
+ var body: some View {
21
+ BasicColumnBox("SnackBar", alignment: .leading) {
22
+ MoMoUIKits.Button(title: "Show snack bar", action: { showSnack(1) }, size: .large)
23
+ MoMoUIKits.Button(title: "Show toast", action: { navigator.showSnackBar(.toast(duration: 1)) }, type: .secondary, size: .large)
24
+ MoMoUIKits.Button(title: "Hide snack bar", action: { navigator.hideSnackBar() }, type: .text, size: .large)
25
+ }
26
+ }
27
+
28
+ private func showSnack(_ duration: TimeInterval?) {
29
+ navigator.showSnackBar(.custom(duration: duration) {
30
+ HStack {
31
+ MomoText("Snack bar !!!", color: Colors.black01)
32
+ Spacer()
33
+ }
34
+ .padding(.horizontal, 20)
35
+ .frame(height: 80)
36
+ .frame(maxWidth: .infinity)
37
+ .background(Colors.black17)
38
+ .clipShape(RoundedRectangle(cornerRadius: Radius.M))
39
+ .padding(.horizontal, Spacing.M)
40
+ })
41
+ }
42
+ }
43
+
44
+ // MARK: - Playground
45
+
46
+ @available(iOS 16.0, *)
47
+ private struct SnackBarPlayground: View {
48
+ @EnvironmentObject private var navigator: Navigator
49
+ @State private var duration = "1000"
50
+
51
+ private var seconds: TimeInterval? { Double(duration).map { $0 / 1000 } }
52
+
53
+ var body: some View {
54
+ PlaygroundTab(
55
+ component: {
56
+ VStack(spacing: Spacing.S) {
57
+ MoMoUIKits.Button(title: "Show snack bar", action: { showSnack(seconds) }, size: .large)
58
+ MoMoUIKits.Button(title: "Show toast", action: { navigator.showSnackBar(.toast(duration: seconds)) }, type: .secondary, size: .large)
59
+ MoMoUIKits.Button(title: "Hide snack bar", action: { navigator.hideSnackBar() }, type: .text, size: .large)
60
+ }
61
+ },
62
+ params: [
63
+ .number("Duration (ms)", $duration),
64
+ ]
65
+ )
66
+ }
67
+
68
+ private func showSnack(_ duration: TimeInterval?) {
69
+ navigator.showSnackBar(.custom(duration: duration) {
70
+ HStack {
71
+ MomoText("Snack bar !!!", color: Colors.black01)
72
+ Spacer()
73
+ }
74
+ .padding(.horizontal, 20)
75
+ .frame(height: 80)
76
+ .frame(maxWidth: .infinity)
77
+ .background(Colors.black17)
78
+ .clipShape(RoundedRectangle(cornerRadius: Radius.M))
79
+ .padding(.horizontal, Spacing.M)
80
+ })
81
+ }
82
+ }
@@ -0,0 +1,93 @@
1
+ //
2
+ // StepperDemo.swift
3
+ // Example
4
+ //
5
+ // Preview + Playground demo (mirrors the Compose DemoScreen pattern).
6
+ //
7
+
8
+ import MoMoUIKits
9
+ import SwiftUI
10
+
11
+ struct StepperDemo: View {
12
+ var body: some View {
13
+ if #available(iOS 16.0, *) {
14
+ DemoScreen(preview: { StepperPreview() }, playground: { StepperPlayground() })
15
+ } else {
16
+ Text("Requires iOS 16+").padding()
17
+ }
18
+ }
19
+ }
20
+
21
+ // MARK: - Preview
22
+
23
+ private struct StepperPreview: View {
24
+ @State private var sizeLarge = 5
25
+ @State private var sizeSmall = 5
26
+ @State private var def50 = 50
27
+ @State private var customStep5 = 0
28
+ @State private var editable = 5
29
+ @State private var disabledAll = 5
30
+ @State private var disabledMinus = 5
31
+ @State private var disabledPlus = 5
32
+ @State private var bound = 0
33
+
34
+ var body: some View {
35
+ BasicColumnBox("Size", alignment: .leading) {
36
+ MomoStepper(value: $sizeLarge, size: .large)
37
+ MomoStepper(value: $sizeSmall, size: .small)
38
+ }
39
+ BasicColumnBox("Default (min=0, max=100, step=1)", alignment: .leading) {
40
+ MomoStepper(value: $def50)
41
+ }
42
+ BasicColumnBox("Custom step (5)", alignment: .leading) {
43
+ MomoStepper(value: $customStep5, min: 0, max: 50, step: 5)
44
+ }
45
+ BasicColumnBox("Editable", alignment: .leading) {
46
+ MomoStepper(value: $editable, editable: true)
47
+ }
48
+ BasicColumnBox("Disabled — all", alignment: .leading) {
49
+ MomoStepper(value: $disabledAll, disabled: true)
50
+ }
51
+ BasicColumnBox("Disabled — minus / plus only", alignment: .leading) {
52
+ MomoStepper(value: $disabledMinus, disabled: StepperDisabled(minus: true, plus: false))
53
+ MomoStepper(value: $disabledPlus, disabled: StepperDisabled(minus: false, plus: true))
54
+ }
55
+ BasicColumnBox("Auto-disabled at bounds (0…10)", alignment: .leading) {
56
+ MomoStepper(value: $bound, min: 0, max: 10)
57
+ }
58
+ }
59
+ }
60
+
61
+ // MARK: - Playground
62
+
63
+ @available(iOS 16.0, *)
64
+ private struct StepperPlayground: View {
65
+ @State private var value = 5
66
+ @State private var small = false
67
+ @State private var editable = false
68
+ @State private var disabled = false
69
+ @State private var step = 1.0
70
+
71
+ var body: some View {
72
+ PlaygroundTab(
73
+ component: {
74
+ MomoStepper(
75
+ value: $value,
76
+ min: 0,
77
+ max: 100,
78
+ step: Int(step),
79
+ size: small ? .small : .large,
80
+ disabled: StepperDisabled(disabled),
81
+ editable: editable
82
+ )
83
+ .id("\(small)-\(editable)-\(disabled)-\(Int(step))")
84
+ },
85
+ params: [
86
+ .checkbox("Small", $small),
87
+ .checkbox("Editable", $editable),
88
+ .checkbox("Disabled", $disabled),
89
+ .slider("Step", $step, min: 1, max: 10, step: 1),
90
+ ]
91
+ )
92
+ }
93
+ }
@@ -0,0 +1,114 @@
1
+ //
2
+ // StepsDemo.swift
3
+ // Example
4
+ //
5
+ // Preview + Playground demo, mirroring Compose's StepsUsage.kt.
6
+ //
7
+
8
+ import MoMoUIKits
9
+ import SwiftUI
10
+
11
+ private let sampleSteps: [StepItem] = [
12
+ StepItem(title: "Order placed", description: "Your order has been received", time: "09:00"),
13
+ StepItem(title: "Processing", description: "We are preparing your order", time: "09:15"),
14
+ StepItem(title: "Shipped", description: "Your order is on the way", time: "10:30"),
15
+ StepItem(title: "Delivered", description: "Package delivered successfully", time: "14:00"),
16
+ ]
17
+
18
+ private let shortSteps: [StepItem] = [
19
+ StepItem(title: "Step 1"),
20
+ StepItem(title: "Step 2"),
21
+ StepItem(title: "Step 3"),
22
+ ]
23
+
24
+ private let stepsWithError: [StepItem] = [
25
+ StepItem(title: "Verified"),
26
+ StepItem(title: "Payment", error: true),
27
+ StepItem(title: "Complete"),
28
+ ]
29
+
30
+ private let stepsSizeList: [PlaygroundOption] = [
31
+ .init("large", StepsSize.large),
32
+ .init("small", StepsSize.small),
33
+ ]
34
+
35
+ private let stepsAlignList: [PlaygroundOption] = [
36
+ .init("center", StepsAlign.center),
37
+ .init("left", StepsAlign.left),
38
+ .init("right", StepsAlign.right),
39
+ .init("stretch", StepsAlign.stretch),
40
+ ]
41
+
42
+ struct StepsDemo: View {
43
+ var body: some View {
44
+ if #available(iOS 16.0, *) {
45
+ DemoScreen(preview: { StepsPreview() }, playground: { StepsPlayground() })
46
+ } else {
47
+ Text("Requires iOS 16+").padding()
48
+ }
49
+ }
50
+ }
51
+
52
+ // MARK: - Preview
53
+
54
+ private struct StepsPreview: View {
55
+ var body: some View {
56
+ BasicColumnBox("Vertical — Large (default)", alignment: .leading) {
57
+ Steps(steps: sampleSteps, activeIndex: 1)
58
+ }
59
+ BasicColumnBox("Vertical — Small", alignment: .leading) {
60
+ Steps(steps: sampleSteps, activeIndex: 2, size: .small)
61
+ }
62
+ BasicColumnBox("Vertical — With error", alignment: .leading) {
63
+ Steps(steps: stepsWithError, activeIndex: 1)
64
+ }
65
+ BasicColumnBox("Vertical — Use number", alignment: .leading) {
66
+ Steps(steps: shortSteps, activeIndex: 1, useNumber: true)
67
+ }
68
+ BasicColumnBox("Horizontal — Center", alignment: .leading) {
69
+ Steps(steps: shortSteps, activeIndex: 1, horizontal: true)
70
+ }
71
+ BasicColumnBox("Horizontal — With time", alignment: .leading) {
72
+ Steps(steps: sampleSteps, activeIndex: 2, horizontal: true)
73
+ }
74
+ BasicColumnBox("Horizontal — With error", alignment: .leading) {
75
+ Steps(steps: stepsWithError, activeIndex: 1, horizontal: true)
76
+ }
77
+ }
78
+ }
79
+
80
+ // MARK: - Playground
81
+
82
+ @available(iOS 16.0, *)
83
+ private struct StepsPlayground: View {
84
+ @State private var activeIndex: Double = 1
85
+ @State private var size: PlaygroundOption? = stepsSizeList.first { $0.key == "large" }
86
+ @State private var align: PlaygroundOption? = stepsAlignList.first { $0.key == "center" }
87
+ @State private var horizontal = false
88
+ @State private var useNumber = false
89
+ @State private var disabled = false
90
+
91
+ var body: some View {
92
+ PlaygroundTab(
93
+ component: {
94
+ Steps(
95
+ steps: sampleSteps,
96
+ activeIndex: Int(activeIndex),
97
+ horizontal: horizontal,
98
+ size: (size?.value as? StepsSize) ?? .large,
99
+ useNumber: useNumber,
100
+ align: (align?.value as? StepsAlign) ?? .center,
101
+ disabled: disabled
102
+ )
103
+ },
104
+ params: [
105
+ .slider("ActiveIndex", $activeIndex, min: 0, max: 3, step: 1),
106
+ .radio("Size", stepsSizeList, $size),
107
+ .radio("Align", stepsAlignList, $align),
108
+ .checkbox("Horizontal", $horizontal),
109
+ .checkbox("UseNumber", $useNumber),
110
+ .checkbox("Disabled", $disabled),
111
+ ]
112
+ )
113
+ }
114
+ }
@@ -0,0 +1,90 @@
1
+ import MoMoUIKits
2
+ import SwiftUI
3
+
4
+ struct SuggestActionDemo: View {
5
+ var body: some View {
6
+ if #available(iOS 16.0, *) {
7
+ DemoScreen(preview: { SuggestActionPreview() }, playground: { SuggestActionPlayground() })
8
+ } else {
9
+ Text("Requires iOS 16+").padding()
10
+ }
11
+ }
12
+ }
13
+
14
+ // MARK: - Preview
15
+
16
+ private struct SuggestActionPreview: View {
17
+ @State private var visible1 = true
18
+ @State private var visible2 = true
19
+ @State private var visible3 = true
20
+
21
+ var body: some View {
22
+ BasicColumnBox("Default", alignment: .leading) {
23
+ SuggestAction(
24
+ message: "You have a new suggestion available for you.",
25
+ buttonTitle: "View",
26
+ visible: visible1,
27
+ onClose: { visible1 = false },
28
+ onPressButton: { visible1 = false }
29
+ )
30
+ }
31
+ BasicColumnBox("With bold message", alignment: .leading) {
32
+ SuggestAction(
33
+ message: "You have a new suggestion available for you.",
34
+ buttonTitle: "View",
35
+ boldMessage: "new suggestion",
36
+ visible: visible2,
37
+ onClose: { visible2 = false },
38
+ onPressButton: { visible2 = false }
39
+ )
40
+ }
41
+ BasicColumnBox("With image", alignment: .leading) {
42
+ SuggestAction(
43
+ message: "Complete your profile to unlock more features.",
44
+ buttonTitle: "Go",
45
+ boldMessage: "Complete",
46
+ image: "https://static.momocdn.net/app/img/kits/trustBanner/ic_secu.png",
47
+ visible: visible3,
48
+ onClose: { visible3 = false },
49
+ onPressButton: { visible3 = false }
50
+ )
51
+ }
52
+ MoMoUIKits.Button(
53
+ title: "Reset all",
54
+ action: { visible1 = true; visible2 = true; visible3 = true },
55
+ type: .primary,
56
+ isFull: false
57
+ )
58
+ }
59
+ }
60
+
61
+ // MARK: - Playground
62
+
63
+ @available(iOS 16.0, *)
64
+ private struct SuggestActionPlayground: View {
65
+ @State private var message = "You have a new suggestion available for you."
66
+ @State private var buttonTitle = "View"
67
+ @State private var boldMessage = "suggestion"
68
+ @State private var visible = true
69
+
70
+ var body: some View {
71
+ PlaygroundTab(
72
+ component: {
73
+ SuggestAction(
74
+ message: message,
75
+ buttonTitle: buttonTitle,
76
+ boldMessage: boldMessage,
77
+ visible: visible,
78
+ onClose: { visible = false },
79
+ onPressButton: { visible = false }
80
+ )
81
+ },
82
+ params: [
83
+ .string("Message", $message),
84
+ .string("ButtonTitle", $buttonTitle),
85
+ .string("BoldMessage", $boldMessage),
86
+ .checkbox("Visible", $visible),
87
+ ]
88
+ )
89
+ }
90
+ }
@@ -0,0 +1,107 @@
1
+ //
2
+ // SwipeDemo.swift
3
+ // Example
4
+ //
5
+ // Preview + Playground demo, mirroring Compose's SwipeUsage.kt.
6
+ //
7
+
8
+ import MoMoUIKits
9
+ import SwiftUI
10
+
11
+ private func swipeContent(_ text: String) -> some View {
12
+ HStack {
13
+ MomoText(text, typography: .bodyDefaultRegular, color: Colors.text)
14
+ Spacer(minLength: 0)
15
+ }
16
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
17
+ .padding(.horizontal, Spacing.M)
18
+ .background(Colors.card)
19
+ }
20
+
21
+ struct SwipeDemo: View {
22
+ var body: some View {
23
+ if #available(iOS 16.0, *) {
24
+ DemoScreen(preview: { SwipePreview() }, playground: { SwipePlayground() })
25
+ } else {
26
+ Text("Requires iOS 16+").padding()
27
+ }
28
+ }
29
+ }
30
+
31
+ // MARK: - Preview
32
+
33
+ private struct SwipePreview: View {
34
+ private var editAction: SwipeAction {
35
+ SwipeAction(label: "Edit", icon: "24_basic_copy", backgroundColor: Colors.blue03, onPress: {})
36
+ }
37
+ private var deleteAction: SwipeAction {
38
+ SwipeAction(label: "Delete", icon: "24_basic_delete", backgroundColor: Colors.red03, onPress: {})
39
+ }
40
+ private var archiveAction: SwipeAction {
41
+ SwipeAction(label: "Archive", icon: "24_basic_flag", backgroundColor: Colors.orange03, onPress: {})
42
+ }
43
+
44
+ var body: some View {
45
+ BasicColumnBox("Right actions only", alignment: .leading) {
46
+ Swipe(rightActions: [deleteAction]) { swipeContent("Swipe left to delete") }
47
+ }
48
+ BasicColumnBox("Left actions only", alignment: .leading) {
49
+ Swipe(leftActions: [editAction, archiveAction]) { swipeContent("Swipe right for actions") }
50
+ }
51
+ BasicColumnBox("Both sides", alignment: .leading) {
52
+ Swipe(leftActions: [editAction], rightActions: [deleteAction]) { swipeContent("Swipe both directions") }
53
+ }
54
+ BasicColumnBox("Multiple right actions", alignment: .leading) {
55
+ Swipe(rightActions: [editAction, archiveAction, deleteAction]) { swipeContent("3 right actions") }
56
+ }
57
+ BasicColumnBox("With itemRadius", alignment: .leading) {
58
+ Swipe(rightActions: [deleteAction], itemRadius: Radius.S) { swipeContent("Rounded corners") }
59
+ }
60
+ BasicColumnBox("Custom height", alignment: .leading) {
61
+ Swipe(rightActions: [deleteAction], height: 80) { swipeContent("Taller row (80dp)") }
62
+ }
63
+ }
64
+ }
65
+
66
+ // MARK: - Playground
67
+
68
+ @available(iOS 16.0, *)
69
+ private struct SwipePlayground: View {
70
+ @State private var showLeftActions = true
71
+ @State private var showRightActions = true
72
+ @State private var heightValue: Double = 56
73
+ @State private var radiusValue: Double = 0
74
+ @State private var lastAction = "No action yet"
75
+
76
+ private var editAction: SwipeAction {
77
+ SwipeAction(label: "Edit", icon: "24_basic_copy", backgroundColor: Colors.blue03, onPress: { lastAction = "Edit pressed" })
78
+ }
79
+ private var deleteAction: SwipeAction {
80
+ SwipeAction(label: "Delete", icon: "24_basic_delete", backgroundColor: Colors.red03, onPress: { lastAction = "Delete pressed" })
81
+ }
82
+ private var archiveAction: SwipeAction {
83
+ SwipeAction(label: "Archive", icon: "24_basic_flag", backgroundColor: Colors.orange03, onPress: { lastAction = "Archive pressed" })
84
+ }
85
+
86
+ var body: some View {
87
+ PlaygroundTab(
88
+ component: {
89
+ VStack(alignment: .leading, spacing: Spacing.S) {
90
+ Swipe(
91
+ leftActions: showLeftActions ? [editAction, archiveAction] : [],
92
+ rightActions: showRightActions ? [deleteAction] : [],
93
+ height: CGFloat(heightValue),
94
+ itemRadius: CGFloat(radiusValue)
95
+ ) { swipeContent("Swipe me!") }
96
+ MomoText(lastAction, typography: .descriptionDefaultRegular, color: Colors.textSecondary)
97
+ }
98
+ },
99
+ params: [
100
+ .checkbox("ShowLeftActions", $showLeftActions),
101
+ .checkbox("ShowRightActions", $showRightActions),
102
+ .slider("Height", $heightValue, min: 40, max: 100, step: 1),
103
+ .slider("ItemRadius", $radiusValue, min: 0, max: 24, step: 1),
104
+ ]
105
+ )
106
+ }
107
+ }
@@ -0,0 +1,58 @@
1
+ //
2
+ // SwitchDemo.swift
3
+ // Example
4
+ //
5
+ // Preview + Playground demo for Switch.
6
+ //
7
+
8
+ import MoMoUIKits
9
+ import SwiftUI
10
+
11
+ struct SwitchDemo: View {
12
+ var body: some View {
13
+ if #available(iOS 16.0, *) {
14
+ DemoScreen(preview: { SwitchPreview() }, playground: { SwitchPlayground() })
15
+ } else {
16
+ Text("Requires iOS 16+").padding()
17
+ }
18
+ }
19
+ }
20
+
21
+ // MARK: - Preview
22
+
23
+ private struct SwitchPreview: View {
24
+ @State private var checked = false
25
+
26
+ var body: some View {
27
+ BasicColumnBox("Value", alignment: .leading) {
28
+ Switch($checked, onChange: { checked = $0 })
29
+ }
30
+ BasicColumnBox("Disabled (on)", alignment: .leading) {
31
+ Switch(.constant(true), disabled: true)
32
+ }
33
+ BasicColumnBox("Disabled (off)", alignment: .leading) {
34
+ Switch(.constant(false), disabled: true)
35
+ }
36
+ }
37
+ }
38
+
39
+ // MARK: - Playground
40
+
41
+ @available(iOS 16.0, *)
42
+ private struct SwitchPlayground: View {
43
+ @State private var value = false
44
+ @State private var title = ""
45
+ @State private var disabled = false
46
+
47
+ var body: some View {
48
+ PlaygroundTab(
49
+ component: {
50
+ Switch($value, disabled: disabled, onChange: { value = $0 }, title: title)
51
+ },
52
+ params: [
53
+ .string("Title", $title),
54
+ .checkbox("Disabled", $disabled),
55
+ ]
56
+ )
57
+ }
58
+ }