@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,175 @@
1
+ //
2
+ // PopupDisplayDemo.swift
3
+ // Example
4
+ //
5
+ // Usage demo for PopupDisplay component.
6
+ // Mirrors Compose's PopupNotifyUsage: a configurable form whose action
7
+ // button presents the popup through `navigator.showModal`.
8
+ //
9
+
10
+ import MoMoUIKits
11
+ import SwiftUI
12
+
13
+ // MARK: - PopupDisplayDemo
14
+
15
+ struct PopupDisplayDemo: View {
16
+ var body: some View {
17
+ if #available(iOS 16.0, *) {
18
+ PopupDisplayDemoContent()
19
+ } else {
20
+ Text("PopupDisplay demo requires iOS 16+")
21
+ .padding()
22
+ }
23
+ }
24
+ }
25
+
26
+ // MARK: - PopupDisplayDemoContent
27
+
28
+ @available(iOS 16.0, *)
29
+ private struct PopupDisplayDemoContent: View {
30
+ @EnvironmentObject private var navigator: Navigator
31
+
32
+ @State private var image = "https://static.momocdn.net/app/img/popup_permission/img_permission_popup_camera.png"
33
+ @State private var title = "Title"
34
+ @State private var description = "Check lại một nhịp auto chuyển sang dạng CTA."
35
+ @State private var errorCode = "9004"
36
+ @State private var buttonDirection: PopupButtonDirection = .auto
37
+ @State private var primaryTitle = "Primary"
38
+ @State private var secondaryTitle = "Secondary"
39
+ @State private var showCloseIcon = false
40
+
41
+ var body: some View {
42
+ ScrollView {
43
+ VStack(alignment: .leading, spacing: 12) {
44
+ // MARK: - Image URL
45
+
46
+ HStack(alignment: .center, spacing: 8) {
47
+ Input(
48
+ text: $image,
49
+ placeholder: "Image URL",
50
+ floatingValue: "Image URL"
51
+ )
52
+ Checkbox(
53
+ Binding(
54
+ get: { image.isEmpty },
55
+ set: { checked in
56
+ image = checked ? "" : "https://static.momocdn.net/app/img/popup_permission/img_permission_popup_camera.png"
57
+ }
58
+ ),
59
+ title: "undefined"
60
+ )
61
+ }
62
+
63
+ // MARK: - Title
64
+
65
+ Input(
66
+ text: $title,
67
+ placeholder: "Title",
68
+ floatingValue: "Title"
69
+ )
70
+
71
+ // MARK: - Description
72
+
73
+ Input(
74
+ text: $description,
75
+ placeholder: "Description",
76
+ floatingValue: "Description"
77
+ )
78
+
79
+ // MARK: - Error code
80
+
81
+ HStack(alignment: .center, spacing: 8) {
82
+ Input(
83
+ text: $errorCode,
84
+ placeholder: "Error",
85
+ floatingValue: "Error"
86
+ )
87
+ Checkbox(
88
+ Binding(
89
+ get: { errorCode.isEmpty },
90
+ set: { checked in
91
+ errorCode = checked ? "" : "9004"
92
+ }
93
+ ),
94
+ title: "undefined"
95
+ )
96
+ }
97
+
98
+ // MARK: - Button direction
99
+
100
+ VStack(alignment: .leading, spacing: 6) {
101
+ Text("Button Direction")
102
+ .font(.caption)
103
+ .foregroundColor(.secondary)
104
+ Picker("Button Direction", selection: $buttonDirection) {
105
+ Text("Auto").tag(PopupButtonDirection.auto)
106
+ Text("Row").tag(PopupButtonDirection.row)
107
+ Text("Column").tag(PopupButtonDirection.column)
108
+ }
109
+ .pickerStyle(.segmented)
110
+ }
111
+
112
+ // MARK: - Button titles
113
+
114
+ Input(
115
+ text: $primaryTitle,
116
+ placeholder: "Primary Button Title",
117
+ floatingValue: "Primary Button Title"
118
+ )
119
+ Input(
120
+ text: $secondaryTitle,
121
+ placeholder: "Secondary Button Title",
122
+ floatingValue: "Secondary Button Title"
123
+ )
124
+
125
+ // MARK: - Show close icon
126
+
127
+ Checkbox($showCloseIcon, title: "Show Close Button")
128
+ .padding(.vertical, 4)
129
+
130
+ // MARK: - Action
131
+
132
+ Button(
133
+ title: "Show popup",
134
+ action: showPopup,
135
+ type: .primary,
136
+ size: .large
137
+ )
138
+ .padding(.top, 8)
139
+ }
140
+ .padding(16)
141
+ }
142
+ }
143
+
144
+ // MARK: - Helpers
145
+
146
+ private func showPopup() {
147
+ navigator.showModal {
148
+ PopupDisplay(
149
+ isPresented: .constant(true),
150
+ title: title,
151
+ description: description,
152
+ url: image,
153
+ buttonDirection: buttonDirection,
154
+ buttonType: .button,
155
+ actionButtonTitle: primaryTitle,
156
+ closeButtonTitle: secondaryTitle,
157
+ onPressAction: { navigator.hideOverplay() },
158
+ onPressCloseButton: { navigator.hideOverplay() },
159
+ onClose: { navigator.hideOverplay() },
160
+ errorCode: errorCode,
161
+ isShowCloseIcon: showCloseIcon
162
+ )
163
+ }
164
+ }
165
+ }
166
+
167
+ // MARK: - Preview
168
+
169
+ #if DEBUG
170
+ struct PopupDisplayDemo_Previews: PreviewProvider {
171
+ static var previews: some View {
172
+ PopupDisplayDemo()
173
+ }
174
+ }
175
+ #endif
@@ -0,0 +1,95 @@
1
+ import MoMoUIKits
2
+ import SwiftUI
3
+
4
+ struct PopupNotifyDemo: View {
5
+ var body: some View {
6
+ if #available(iOS 16.0, *) {
7
+ DemoScreen(preview: { PopupNotifyPreview() }, playground: { PopupNotifyPlayground() })
8
+ } else {
9
+ Text("Requires iOS 16+").padding()
10
+ }
11
+ }
12
+ }
13
+
14
+ // MARK: - Preview
15
+
16
+ @available(iOS 16.0, *)
17
+ private struct PopupNotifyPreview: View {
18
+ @EnvironmentObject private var navigator: Navigator
19
+
20
+ var body: some View {
21
+ BasicColumnBox("PopupNotify", alignment: .leading) {
22
+ MoMoUIKits.Button(title: "Show popup", action: { show() }, size: .large)
23
+ }
24
+ }
25
+
26
+ private func show() {
27
+ navigator.showModal {
28
+ PopupNotify(props: PopupNotifyProps(
29
+ image: "https://i.imgur.com/s70S9s9.png",
30
+ title: "Title",
31
+ description: "Check lại một nhịp auto chuyển sang dạng CTA.",
32
+ error: "9004",
33
+ primary: PopupAction(title: "Primary", onPress: { navigator.hideOverplay() }),
34
+ secondary: PopupAction(title: "Secondary", onPress: { navigator.hideOverplay() }),
35
+ onIconClose: { navigator.hideOverplay() },
36
+ isShowCloseIcon: true
37
+ ))
38
+ }
39
+ }
40
+ }
41
+
42
+ // MARK: - Playground
43
+
44
+ private let popupDirectionList: [PlaygroundOption] = [
45
+ .init("auto", PopupActionDirection.auto),
46
+ .init("row", PopupActionDirection.row),
47
+ .init("column", PopupActionDirection.column),
48
+ ]
49
+
50
+ @available(iOS 16.0, *)
51
+ private struct PopupNotifyPlayground: View {
52
+ @EnvironmentObject private var navigator: Navigator
53
+ @State private var image = "https://i.imgur.com/s70S9s9.png"
54
+ @State private var title = "Title"
55
+ @State private var description = "Check lại một nhịp auto chuyển sang dạng CTA."
56
+ @State private var error = "9004"
57
+ @State private var primaryTitle = "Primary"
58
+ @State private var secondaryTitle = "Secondary"
59
+ @State private var showClose = false
60
+ @State private var direction: PlaygroundOption? = popupDirectionList.first { $0.key == "auto" }
61
+
62
+ var body: some View {
63
+ PlaygroundTab(
64
+ component: {
65
+ MoMoUIKits.Button(title: "Show popup", action: { show() }, size: .large)
66
+ },
67
+ params: [
68
+ .string("Image", $image),
69
+ .string("Title", $title),
70
+ .string("Description", $description),
71
+ .string("Error", $error),
72
+ .string("PrimaryTitle", $primaryTitle),
73
+ .string("SecondaryTitle", $secondaryTitle),
74
+ .radio("ButtonDirection", popupDirectionList, $direction),
75
+ .checkbox("ShowCloseButton", $showClose),
76
+ ]
77
+ )
78
+ }
79
+
80
+ private func show() {
81
+ navigator.showModal {
82
+ PopupNotify(props: PopupNotifyProps(
83
+ image: image,
84
+ title: title,
85
+ description: description,
86
+ error: error,
87
+ primary: PopupAction(title: primaryTitle, onPress: { navigator.hideOverplay() }),
88
+ secondary: PopupAction(title: secondaryTitle, onPress: { navigator.hideOverplay() }),
89
+ buttonDirection: (direction?.value as? PopupActionDirection) ?? .auto,
90
+ onIconClose: { navigator.hideOverplay() },
91
+ isShowCloseIcon: showClose
92
+ ))
93
+ }
94
+ }
95
+ }
@@ -0,0 +1,67 @@
1
+ //
2
+ // PopupPromotionDemo.swift
3
+ // Example
4
+ //
5
+ // Preview + Playground demo. PopupPromotion is presented via `navigator.showModal`.
6
+ //
7
+
8
+ import MoMoUIKits
9
+ import SwiftUI
10
+
11
+ struct PopupPromotionDemo: View {
12
+ var body: some View {
13
+ if #available(iOS 16.0, *) {
14
+ DemoScreen(preview: { PopupPromotionPreview() }, playground: { PopupPromotionPlayground() })
15
+ } else {
16
+ Text("Requires iOS 16+").padding()
17
+ }
18
+ }
19
+ }
20
+
21
+ // MARK: - Preview
22
+
23
+ @available(iOS 16.0, *)
24
+ private struct PopupPromotionPreview: View {
25
+ @EnvironmentObject private var navigator: Navigator
26
+
27
+ var body: some View {
28
+ BasicColumnBox("PopupPromotion", alignment: .leading) {
29
+ MoMoUIKits.Button(
30
+ title: "Show Popup",
31
+ action: { show("https://static.momocdn.net/app/app/appx/ABC.png?size=M") },
32
+ size: .large
33
+ )
34
+ }
35
+ }
36
+
37
+ private func show(_ url: String) {
38
+ navigator.showModal {
39
+ PopupPromotion(imageUrl: url, onIconClose: { navigator.hideOverplay() }, onAction: { navigator.hideOverplay() })
40
+ }
41
+ }
42
+ }
43
+
44
+ // MARK: - Playground
45
+
46
+ @available(iOS 16.0, *)
47
+ private struct PopupPromotionPlayground: View {
48
+ @EnvironmentObject private var navigator: Navigator
49
+ @State private var imageUrl = "https://static.momocdn.net/app/app/appx/ABC.png?size=M"
50
+
51
+ var body: some View {
52
+ PlaygroundTab(
53
+ component: {
54
+ MoMoUIKits.Button(title: "Show Popup", action: { show() }, size: .large)
55
+ },
56
+ params: [
57
+ .string("ImageURL", $imageUrl),
58
+ ]
59
+ )
60
+ }
61
+
62
+ private func show() {
63
+ navigator.showModal {
64
+ PopupPromotion(imageUrl: imageUrl, onIconClose: { navigator.hideOverplay() }, onAction: { navigator.hideOverplay() })
65
+ }
66
+ }
67
+ }
@@ -0,0 +1,101 @@
1
+ //
2
+ // ProgressInfoDemo.swift
3
+ // Example
4
+ //
5
+ // Preview + Playground demo, mirroring Compose's ProgressInfoUsage.kt.
6
+ //
7
+
8
+ import MoMoUIKits
9
+ import SwiftUI
10
+
11
+ private let piSteps = [
12
+ ProgressInfoItem(title: "Bước 1", description: "Mô tả bước đầu tiên"),
13
+ ProgressInfoItem(title: "Bước 2", description: "Mô tả bước thứ hai"),
14
+ ProgressInfoItem(title: "Bước 3", description: "Mô tả bước thứ ba"),
15
+ ]
16
+
17
+ private let piStepsNoDesc = [
18
+ ProgressInfoItem(title: "Đăng ký"),
19
+ ProgressInfoItem(title: "Xác minh"),
20
+ ProgressInfoItem(title: "Hoàn tất"),
21
+ ]
22
+
23
+ private let progressInfoSizeList: [PlaygroundOption] = [
24
+ .init("large", ProgressInfoSize.large),
25
+ .init("small", ProgressInfoSize.small),
26
+ ]
27
+
28
+ private let progressInfoAlignList: [PlaygroundOption] = [
29
+ .init("center", ProgressInfoAlign.center),
30
+ .init("left", ProgressInfoAlign.left),
31
+ .init("right", ProgressInfoAlign.right),
32
+ .init("stretch", ProgressInfoAlign.stretch),
33
+ ]
34
+
35
+ struct ProgressInfoDemo: View {
36
+ var body: some View {
37
+ if #available(iOS 16.0, *) {
38
+ DemoScreen(preview: { ProgressInfoPreview() }, playground: { ProgressInfoPlayground() })
39
+ } else {
40
+ Text("Requires iOS 16+").padding()
41
+ }
42
+ }
43
+ }
44
+
45
+ // MARK: - Preview
46
+
47
+ private struct ProgressInfoPreview: View {
48
+ var body: some View {
49
+ BasicColumnBox("Vertical (default)", alignment: .leading) {
50
+ ProgressInfo(steps: piSteps)
51
+ }
52
+ BasicColumnBox("Vertical – no description", alignment: .leading) {
53
+ ProgressInfo(steps: piStepsNoDesc, showDescription: false)
54
+ }
55
+ BasicColumnBox("Vertical – useNumber", alignment: .leading) {
56
+ ProgressInfo(steps: piSteps, useNumber: true)
57
+ }
58
+ BasicColumnBox("Horizontal – Center", alignment: .leading) {
59
+ ProgressInfo(steps: piSteps, horizontal: true)
60
+ }
61
+ BasicColumnBox("Horizontal – useNumber", alignment: .leading) {
62
+ ProgressInfo(steps: piSteps, horizontal: true, useNumber: true)
63
+ }
64
+ }
65
+ }
66
+
67
+ // MARK: - Playground
68
+
69
+ @available(iOS 16.0, *)
70
+ private struct ProgressInfoPlayground: View {
71
+ @State private var size: PlaygroundOption? = progressInfoSizeList.first { $0.key == "large" }
72
+ @State private var align: PlaygroundOption? = progressInfoAlignList.first { $0.key == "center" }
73
+ @State private var horizontal = false
74
+ @State private var useNumber = false
75
+ @State private var showTitle = true
76
+ @State private var showDescription = true
77
+
78
+ var body: some View {
79
+ PlaygroundTab(
80
+ component: {
81
+ ProgressInfo(
82
+ steps: piSteps,
83
+ horizontal: horizontal,
84
+ size: (size?.value as? ProgressInfoSize) ?? .large,
85
+ useNumber: useNumber,
86
+ align: (align?.value as? ProgressInfoAlign) ?? .center,
87
+ showTitle: showTitle,
88
+ showDescription: showDescription
89
+ )
90
+ },
91
+ params: [
92
+ .radio("Size", progressInfoSizeList, $size),
93
+ .radio("Align", progressInfoAlignList, $align),
94
+ .checkbox("Horizontal", $horizontal),
95
+ .checkbox("UseNumber", $useNumber),
96
+ .checkbox("ShowTitle", $showTitle),
97
+ .checkbox("ShowDescription", $showDescription),
98
+ ]
99
+ )
100
+ }
101
+ }
@@ -0,0 +1,64 @@
1
+ //
2
+ // RadioDemo.swift
3
+ // Example
4
+ //
5
+ // Preview + Playground demo for Radio.
6
+ //
7
+
8
+ import MoMoUIKits
9
+ import SwiftUI
10
+
11
+ struct RadioDemo: View {
12
+ var body: some View {
13
+ if #available(iOS 16.0, *) {
14
+ DemoScreen(preview: { RadioPreview() }, playground: { RadioPlayground() })
15
+ } else {
16
+ Text("Requires iOS 16+").padding()
17
+ }
18
+ }
19
+ }
20
+
21
+ // MARK: - Preview
22
+
23
+ private struct RadioPreview: View {
24
+ @State private var group: AnyHashable = 1
25
+
26
+ var body: some View {
27
+ BasicColumnBox("Value", alignment: .leading) {
28
+ Radio(value: 1, groupValue: $group)
29
+ Radio(value: 2, groupValue: $group)
30
+ }
31
+ BasicColumnBox("Disabled", alignment: .leading) {
32
+ Radio(value: 1, groupValue: .constant(1), disabled: true)
33
+ Radio(value: 2, groupValue: .constant(1), disabled: false)
34
+ }
35
+ BasicColumnBox("Label", alignment: .leading) {
36
+ Radio(value: 1, groupValue: .constant(1), label: "Label")
37
+ Radio(value: 2, groupValue: .constant(1), label: "Label")
38
+ }
39
+ }
40
+ }
41
+
42
+ // MARK: - Playground
43
+
44
+ @available(iOS 16.0, *)
45
+ private struct RadioPlayground: View {
46
+ @State private var group: AnyHashable = 1
47
+ @State private var label = "Label"
48
+ @State private var disabled = false
49
+
50
+ var body: some View {
51
+ PlaygroundTab(
52
+ component: {
53
+ VStack(alignment: .leading, spacing: Spacing.S) {
54
+ Radio(value: 1, groupValue: $group, disabled: disabled, label: label)
55
+ Radio(value: 2, groupValue: $group, disabled: disabled, label: label)
56
+ }
57
+ },
58
+ params: [
59
+ .string("Label", $label),
60
+ .checkbox("Disabled", $disabled),
61
+ ]
62
+ )
63
+ }
64
+ }
@@ -0,0 +1,68 @@
1
+ //
2
+ // RatingDemo.swift
3
+ // Example
4
+ //
5
+ // Preview + Playground demo for Rating.
6
+ //
7
+
8
+ import MoMoUIKits
9
+ import SwiftUI
10
+
11
+ private let ratingSizeList: [PlaygroundOption] = [
12
+ .init("small", RatingSize.small),
13
+ .init("medium", RatingSize.medium),
14
+ .init("large", RatingSize.large),
15
+ ]
16
+
17
+ struct RatingDemo: View {
18
+ var body: some View {
19
+ if #available(iOS 16.0, *) {
20
+ DemoScreen(preview: { RatingPreview() }, playground: { RatingPlayground() })
21
+ } else {
22
+ Text("Requires iOS 16+").padding()
23
+ }
24
+ }
25
+ }
26
+
27
+ // MARK: - Preview
28
+
29
+ private struct RatingPreview: View {
30
+ var body: some View {
31
+ BasicColumnBox("Size", alignment: .leading) {
32
+ Rating(numOfStars: 5, rating: 3, size: .small)
33
+ Rating(numOfStars: 5, rating: 3, size: .medium)
34
+ Rating(numOfStars: 5, rating: 3, size: .large)
35
+ }
36
+ BasicColumnBox("Values", alignment: .leading) {
37
+ Rating(numOfStars: 5, rating: 3.5)
38
+ Rating(numOfStars: 5, rating: 5)
39
+ Rating(numOfStars: 5, rating: 0)
40
+ }
41
+ }
42
+ }
43
+
44
+ // MARK: - Playground
45
+
46
+ @available(iOS 16.0, *)
47
+ private struct RatingPlayground: View {
48
+ @State private var stars: Double = 5
49
+ @State private var rating: Double = 3
50
+ @State private var size: PlaygroundOption? = ratingSizeList.first { $0.key == "large" }
51
+
52
+ var body: some View {
53
+ PlaygroundTab(
54
+ component: {
55
+ Rating(
56
+ numOfStars: Int(stars),
57
+ rating: Float(rating),
58
+ size: (size?.value as? RatingSize) ?? .large
59
+ )
60
+ },
61
+ params: [
62
+ .slider("NumOfStars", $stars, min: 1, max: 10, step: 1),
63
+ .slider("Rating", $rating, min: 0, max: 10, step: 0.5),
64
+ .radio("Size", ratingSizeList, $size),
65
+ ]
66
+ )
67
+ }
68
+ }
@@ -0,0 +1,83 @@
1
+ //
2
+ // SectionDemo.swift
3
+ // Example
4
+ //
5
+ // Preview + Playground demo for SectionView / ItemView (12-column grid).
6
+ //
7
+
8
+ import MoMoUIKits
9
+ import SwiftUI
10
+
11
+ struct SectionDemo: View {
12
+ var body: some View {
13
+ if #available(iOS 16.0, *) {
14
+ DemoScreen(preview: { SectionPreview() }, playground: { SectionPlayground() })
15
+ } else {
16
+ Text("Requires iOS 16+").padding()
17
+ }
18
+ }
19
+ }
20
+
21
+ // MARK: - Preview
22
+
23
+ private struct SectionPreview: View {
24
+ var body: some View {
25
+ BasicColumnBox("Full width — span 12", alignment: .leading) {
26
+ SectionView { SectionTile("12") }
27
+ }
28
+ BasicColumnBox("Even splits", alignment: .leading) {
29
+ SectionView {
30
+ ItemView(widthSpan: 6) { SectionTile("6") }
31
+ ItemView(widthSpan: 6) { SectionTile("6") }
32
+ ItemView(widthSpan: 4) { SectionTile("4") }
33
+ ItemView(widthSpan: 4) { SectionTile("4") }
34
+ ItemView(widthSpan: 4) { SectionTile("4") }
35
+ }
36
+ }
37
+ BasicColumnBox("heightSpan — square tiles", alignment: .leading) {
38
+ SectionView {
39
+ ItemView(widthSpan: 3, heightSpan: 3) { SectionTile("3×3") }
40
+ ItemView(widthSpan: 3, heightSpan: 3) { SectionTile("3×3") }
41
+ ItemView(widthSpan: 6, heightSpan: 3) { SectionTile("6×3") }
42
+ }
43
+ }
44
+ }
45
+ }
46
+
47
+ // MARK: - Playground
48
+
49
+ @available(iOS 16.0, *)
50
+ private struct SectionPlayground: View {
51
+ @State private var span: Double = 6
52
+ @State private var useMargin = true
53
+
54
+ var body: some View {
55
+ PlaygroundTab(
56
+ component: {
57
+ SectionView(useMargin: useMargin) {
58
+ ItemView(widthSpan: Int(span)) { SectionTile("\(Int(span))") }
59
+ ItemView(widthSpan: 12 - Int(span)) { SectionTile("\(12 - Int(span))") }
60
+ }
61
+ },
62
+ params: [
63
+ .slider("Left widthSpan", $span, min: 1, max: 11, step: 1),
64
+ .checkbox("useMargin", $useMargin),
65
+ ]
66
+ )
67
+ }
68
+ }
69
+
70
+ /// Filled placeholder so span widths are visible.
71
+ private struct SectionTile: View {
72
+ let label: String
73
+ init(_ label: String) { self.label = label }
74
+
75
+ var body: some View {
76
+ Text(label)
77
+ .font(.footnote)
78
+ .foregroundColor(Colors.black17)
79
+ .frame(maxWidth: .infinity, minHeight: 44, maxHeight: .infinity)
80
+ .background(Colors.blue08)
81
+ .clipShape(RoundedRectangle(cornerRadius: Radius.S, style: .continuous))
82
+ }
83
+ }