@momo-kits/native-kits 0.162.2-debug → 0.162.2-sp.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.
- package/.claude/settings.local.json +55 -0
- package/ios/Application/Components.swift +34 -43
- package/ios/Application/FloatingButton.swift +10 -8
- package/ios/Application/Navigation/BottomTab/BottomTab.swift +102 -0
- package/ios/Application/Navigation/BottomTab/BottomTabBar.swift +215 -0
- package/ios/Application/Navigation/BottomTab/CurvedContainer.swift +65 -0
- package/ios/Application/Navigation/HeaderBackProps.swift +66 -0
- package/ios/Application/Navigation/HeaderTitle.swift +57 -0
- package/ios/Application/Navigation/HeaderUser.swift +209 -0
- package/ios/Application/Navigation/NavigationContainer.swift +151 -0
- package/ios/Application/Navigation/NavigationOptions.swift +109 -0
- package/ios/Application/Navigation/Navigator.swift +360 -0
- package/ios/Application/Navigation/Overplay/BottomSheet.swift +176 -0
- package/ios/Application/Navigation/Overplay/ModalScreen.swift +68 -0
- package/ios/Application/Navigation/Overplay/SnackBar.swift +144 -0
- package/ios/Application/Navigation/component/Header.swift +178 -0
- package/ios/Application/Navigation/component/HeaderBackground.swift +83 -0
- package/ios/Application/Navigation/component/HeaderColor.swift +65 -0
- package/ios/Application/StackScreen.swift +449 -0
- package/ios/Avatar/Avatar.swift +193 -0
- package/ios/Badge/Badge.swift +11 -13
- package/ios/Badge/BadgeRibbon.swift +12 -19
- package/ios/BaselineView/BaselineView.swift +163 -0
- package/ios/Button/Button.swift +62 -23
- package/ios/Carousel/Carousel.swift +181 -0
- package/ios/Checkbox/Checkbox.swift +14 -12
- package/ios/Chip/Chip.swift +23 -9
- package/ios/Collapse/Collapse.swift +182 -0
- package/ios/Colors+Radius+Spacing/Colors.swift +1 -1
- package/ios/Colors+Radius+Spacing/Theme.swift +295 -0
- package/ios/DateTimePicker/DateTimePicker.swift +210 -0
- package/ios/DateTimePicker/DateTimePickerTypes.swift +55 -0
- package/ios/DateTimePicker/DateTimePickerUtils.swift +167 -0
- package/ios/DateTimePicker/WheelPicker.swift +161 -0
- package/ios/Divider/Divider.swift +16 -0
- package/ios/Icon/Icon.swift +6 -1
- package/ios/IconButton/IconButton.swift +112 -0
- package/ios/Information/Information.swift +151 -0
- package/ios/Input/Input.swift +42 -25
- package/ios/Input/InputPhoneNumber.swift +21 -19
- package/ios/Input/InputSearch.swift +101 -45
- package/ios/Input/InputTextArea.swift +67 -40
- package/ios/InputDropDown/InputDropDown.swift +198 -0
- package/ios/InputMoney/InputMoney.swift +335 -0
- package/ios/InputOTP/InputOTP.swift +210 -0
- package/ios/Loader/Loader.swift +113 -0
- package/ios/MoMoUIKits.podspec +5 -0
- package/ios/OTPKeyboard/KeyboardButton.swift +1 -1
- package/ios/Pagination/PaginationDot.swift +61 -0
- package/ios/Pagination/PaginationNumber.swift +35 -0
- package/ios/Pagination/PaginationScroll.swift +101 -0
- package/ios/Pagination/PaginationWhiteDot.swift +37 -0
- package/ios/Popup/PopupDisplay.swift +10 -12
- package/ios/Popup/PopupInput.swift +2 -6
- package/ios/Popup/PopupNotify.swift +219 -0
- package/ios/ProgressInfo/ProgressInfo.swift +294 -0
- package/ios/Radio/Radio.swift +70 -0
- package/ios/Rating/Rating.swift +82 -0
- package/ios/Skeleton/Skeleton.swift +99 -0
- package/ios/Slider/Slider.swift +237 -0
- package/ios/Stepper/Stepper.swift +220 -0
- package/ios/Steps/Steps.swift +451 -0
- package/ios/SuggestAction/SuggestAction.swift +97 -0
- package/ios/Swipeable/SwipeCell.swift +185 -0
- package/ios/Swipeable/SwipeCellModel.swift +21 -0
- package/ios/TabView/TabView.swift +530 -0
- package/ios/Tag/Tag.swift +98 -0
- package/ios/Template/TrustBanner/TrustBanner.swift +2 -0
- package/ios/Title/Title.swift +269 -0
- package/ios/Tooltip/Tooltip.swift +482 -0
- package/ios/Typography/Text.swift +77 -5
- package/ios/Typography/Typography.swift +9 -0
- package/ios/Uploader/Uploader.swift +183 -0
- package/ios/native-kits.podspec +58 -8
- package/ios-demo/MoMoUIKitsDemo.podspec +18 -0
- package/ios-demo/Resources/dot_loading.json +558 -0
- package/ios-demo/Resources/icon.json +4052 -0
- package/ios-demo/Resources/lottie_circle_loader.json +1 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/DemoScaffold.swift +48 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsBadgeDemoView.swift +25 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsButtonDemoView.swift +26 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsCheckboxDemoView.swift +19 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsChipDemoView.swift +33 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsInputDemoView.swift +48 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsPopupDemoView.swift +21 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsRadioDemoView.swift +17 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/Demos/UIKitsTypographyDemoView.swift +28 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoContext.swift +31 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/MoMoUIKitsDemoFactory.swift +72 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AnimatedHeaderDemo.swift +110 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/AvatarDemo.swift +93 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BadgeDemo.swift +269 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BaselineView.swift +117 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/BottomTabDemo.swift +89 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ButtonDemo.swift +100 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CarouselDemo.swift +126 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CheckboxDemo.swift +63 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ChipDemo.swift +20 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/CollapseDemo.swift +93 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +107 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DateTimePickerDemo.swift +124 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/DividerDemo.swift +14 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/HeaderUserDemo.swift +49 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/Home.swift +261 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/IconButtonDemo.swift +58 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ImageDemo.swift +78 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InformationDemo.swift +138 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDemo.swift +111 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputDropDownDemo.swift +136 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputMoneyDemo.swift +107 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputOTPDemo.swift +73 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +100 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputSearchDemo.swift +32 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputTextAreaDemo.swift +57 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/LoaderDemo.swift +70 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +227 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PaginationDemo.swift +72 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupDisplayDemo.swift +175 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupNotifyDemo.swift +121 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/PopupPromotionDemo.swift +76 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ProgressInfoDemo.swift +89 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RadioDemo.swift +32 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/RatingDemo.swift +56 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SkeletonDemo.swift +32 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SliderDemo.swift +150 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SnackBarDemo.swift +138 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepperDemo.swift +103 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/StepsDemo.swift +94 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SuggestActionDemo.swift +79 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwipeDemo.swift +152 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/SwitchDemo.swift +33 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TabViewDemo.swift +190 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TagDemo.swift +34 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ThemeDemo.swift +182 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TitleDemo.swift +109 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TooltipDemo.swift +187 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/TypographyDemo.swift +87 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/UploaderDemo.swift +131 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SwiftUIDemoBrowserView.swift +50 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoModels.swift +15 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoRegistry.swift +73 -0
- package/package.json +1 -1
- package/publish.sh +50 -0
- package/scripts/gen-ios-color.mjs +136 -0
- package/build.gradle.kts +0 -11
- package/compose/build.gradle.kts +0 -186
- package/compose/build.gradle.kts.backup +0 -186
- package/compose/compose.podspec +0 -47
- package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -123
- package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
- package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -57
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -109
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -201
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -222
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -48
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -305
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -921
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -121
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -403
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -85
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -340
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -198
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -357
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -123
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -94
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -136
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -224
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -543
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -23
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -76
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -148
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -188
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -116
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -452
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -172
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -255
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -235
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -233
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -259
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -241
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -364
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -92
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -352
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -103
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -338
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -70
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -17
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -96
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -348
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -256
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -494
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -131
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -215
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -96
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -531
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -92
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -135
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -214
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -590
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -177
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -192
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -205
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -239
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -191
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -306
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -188
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -285
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -35
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -57
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -68
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -14
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -50
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -253
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -133
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -104
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -145
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -345
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -556
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -161
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -243
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -187
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -315
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -80
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -306
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -34
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -370
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -131
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -167
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -72
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -66
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -70
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -105
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -33
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -186
- package/gradle/libs.versions.toml +0 -67
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +0 -8
- package/gradle.properties +0 -26
- package/gradlew +0 -252
- package/gradlew.bat +0 -94
- package/settings.gradle.kts +0 -64
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import SwiftUI
|
|
3
|
+
|
|
4
|
+
// MARK: - IconSize
|
|
5
|
+
|
|
6
|
+
public enum IconSize {
|
|
7
|
+
case large
|
|
8
|
+
case small
|
|
9
|
+
|
|
10
|
+
/// Container width/height of the button.
|
|
11
|
+
var containerSize: CGFloat {
|
|
12
|
+
switch self {
|
|
13
|
+
case .large: return 48
|
|
14
|
+
case .small: return 40
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/// Glyph size of the icon inside the button.
|
|
19
|
+
var iconSize: CGFloat {
|
|
20
|
+
switch self {
|
|
21
|
+
case .large: return 24
|
|
22
|
+
case .small: return 16
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var radius: CGFloat {
|
|
27
|
+
Radius.XL
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// MARK: - IconButton
|
|
32
|
+
|
|
33
|
+
public struct IconButton: View {
|
|
34
|
+
@Environment(\.appTheme) private var theme
|
|
35
|
+
|
|
36
|
+
var icon: String
|
|
37
|
+
var onClick: () -> Void
|
|
38
|
+
var type: ButtonType
|
|
39
|
+
var size: IconSize
|
|
40
|
+
var color: Color?
|
|
41
|
+
|
|
42
|
+
public init(
|
|
43
|
+
icon: String = "",
|
|
44
|
+
onClick: @escaping () -> Void,
|
|
45
|
+
type: ButtonType = .primary,
|
|
46
|
+
size: IconSize = .small,
|
|
47
|
+
color: Color? = nil
|
|
48
|
+
) {
|
|
49
|
+
self.icon = icon
|
|
50
|
+
self.onClick = onClick
|
|
51
|
+
self.type = type
|
|
52
|
+
self.size = size
|
|
53
|
+
self.color = color
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private var isEnabled: Bool {
|
|
57
|
+
type != .disabled
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public var body: some View {
|
|
61
|
+
let bg = backgroundColor
|
|
62
|
+
let fg = contentColor
|
|
63
|
+
// OUTLINE allows an override color for its border, mirroring Compose `color ?? theme.colors.primary`.
|
|
64
|
+
let border: Color? = type == .outline ? (color ?? theme.colors.primary) : borderColor
|
|
65
|
+
let borderWidth = type.borderWidth
|
|
66
|
+
|
|
67
|
+
SwiftUI.Button(action: {
|
|
68
|
+
if isEnabled {
|
|
69
|
+
onClick()
|
|
70
|
+
}
|
|
71
|
+
}) {
|
|
72
|
+
Icon(source: icon, size: size.iconSize, color: fg)
|
|
73
|
+
.frame(width: size.containerSize, height: size.containerSize)
|
|
74
|
+
.background(bg)
|
|
75
|
+
.clipShape(RoundedRectangle(cornerRadius: size.radius))
|
|
76
|
+
.overlay(
|
|
77
|
+
RoundedRectangle(cornerRadius: size.radius)
|
|
78
|
+
.stroke(border ?? .clear, lineWidth: border != nil ? borderWidth : 0)
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
.buttonStyle(.plain)
|
|
82
|
+
.disabled(!isEnabled)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private var backgroundColor: Color {
|
|
86
|
+
switch type {
|
|
87
|
+
case .disabled: return theme.colors.background.disable
|
|
88
|
+
case .primary: return theme.colors.primary
|
|
89
|
+
case .secondary, .outline: return theme.colors.background.surface
|
|
90
|
+
case .tonal: return theme.colors.background.tonal
|
|
91
|
+
case .danger: return theme.colors.error.primary
|
|
92
|
+
case .text: return .clear
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private var contentColor: Color {
|
|
97
|
+
switch type {
|
|
98
|
+
case .disabled: return theme.colors.text.disable
|
|
99
|
+
case .primary, .danger: return Colors.black01
|
|
100
|
+
case .secondary: return theme.colors.text.default
|
|
101
|
+
case .outline, .tonal, .text: return theme.colors.primary
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
private var borderColor: Color? {
|
|
106
|
+
switch type {
|
|
107
|
+
case .secondary: return theme.colors.border.default
|
|
108
|
+
case .outline: return color ?? theme.colors.primary
|
|
109
|
+
default: return nil
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import SwiftUI
|
|
2
|
+
|
|
3
|
+
public enum InformationState {
|
|
4
|
+
case `default`
|
|
5
|
+
case warning
|
|
6
|
+
case error
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
public struct Information: View {
|
|
10
|
+
private let title: String?
|
|
11
|
+
private let description: String
|
|
12
|
+
private let state: InformationState
|
|
13
|
+
private let image: String?
|
|
14
|
+
private let onPressAction: (() -> Void)?
|
|
15
|
+
private let showIcon: Bool
|
|
16
|
+
private let action: String?
|
|
17
|
+
private let showIconClose: Bool
|
|
18
|
+
private let onPressClose: (() -> Void)?
|
|
19
|
+
|
|
20
|
+
public init(
|
|
21
|
+
title: String? = nil,
|
|
22
|
+
description: String = "Description",
|
|
23
|
+
state: InformationState = .default,
|
|
24
|
+
image: String? = nil,
|
|
25
|
+
onPressAction: (() -> Void)? = nil,
|
|
26
|
+
showIcon: Bool = true,
|
|
27
|
+
action: String? = nil,
|
|
28
|
+
showIconClose: Bool = true,
|
|
29
|
+
onPressClose: (() -> Void)? = nil
|
|
30
|
+
) {
|
|
31
|
+
self.title = title
|
|
32
|
+
self.description = description
|
|
33
|
+
self.state = state
|
|
34
|
+
self.image = image
|
|
35
|
+
self.onPressAction = onPressAction
|
|
36
|
+
self.showIcon = showIcon
|
|
37
|
+
self.action = action
|
|
38
|
+
self.showIconClose = showIconClose
|
|
39
|
+
self.onPressClose = onPressClose
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private var borderColor: Color {
|
|
43
|
+
switch state {
|
|
44
|
+
case .default: return Colors.blue07
|
|
45
|
+
case .warning: return Colors.yellow06
|
|
46
|
+
case .error: return Colors.red07
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private var backgroundColor: Color {
|
|
51
|
+
switch state {
|
|
52
|
+
case .default: return Colors.blue10
|
|
53
|
+
case .warning: return Colors.yellow09
|
|
54
|
+
case .error: return Colors.red10
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private var accentColor: Color {
|
|
59
|
+
switch state {
|
|
60
|
+
case .default: return Colors.blue03
|
|
61
|
+
case .warning: return Colors.orange03
|
|
62
|
+
case .error: return Colors.red03
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private var iconSource: String {
|
|
67
|
+
switch state {
|
|
68
|
+
case .default: return "notifications_info"
|
|
69
|
+
case .warning: return "24_notifications_alert_triangle"
|
|
70
|
+
case .error: return "24_notifications_alert_octagon"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public var body: some View {
|
|
75
|
+
VStack(alignment: .leading, spacing: 0) {
|
|
76
|
+
HStack(alignment: .top, spacing: 0) {
|
|
77
|
+
if let image {
|
|
78
|
+
ImageView(image)
|
|
79
|
+
.frame(width: 40, height: 40)
|
|
80
|
+
.clipShape(RoundedRectangle(cornerRadius: Radius.S))
|
|
81
|
+
.padding(.trailing, Spacing.S)
|
|
82
|
+
} else if showIcon {
|
|
83
|
+
Icon(source: iconSource, size: 16, color: accentColor)
|
|
84
|
+
.padding(.trailing, Spacing.S)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
VStack(alignment: .leading, spacing: 0) {
|
|
88
|
+
if let title {
|
|
89
|
+
MomoText(title, typography: .labelDefaultMedium)
|
|
90
|
+
}
|
|
91
|
+
MomoText(description, typography: .descriptionDefaultRegular)
|
|
92
|
+
}
|
|
93
|
+
.frame(maxWidth: .infinity, alignment: .leading)
|
|
94
|
+
|
|
95
|
+
if let onPressClose, showIconClose {
|
|
96
|
+
Icon(source: "navigation_close", size: 16, color: Colors.black17)
|
|
97
|
+
.contentShape(Rectangle())
|
|
98
|
+
.onTapGesture(perform: onPressClose)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if let action, let onPressAction {
|
|
103
|
+
MomoText(action, typography: .actionXsBold, color: accentColor)
|
|
104
|
+
.frame(maxWidth: .infinity, alignment: .trailing)
|
|
105
|
+
.contentShape(Rectangle())
|
|
106
|
+
.onTapGesture(perform: onPressAction)
|
|
107
|
+
.padding(.top, Spacing.S)
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
.padding(Spacing.M)
|
|
111
|
+
.background(
|
|
112
|
+
RoundedRectangle(cornerRadius: Radius.S)
|
|
113
|
+
.fill(backgroundColor)
|
|
114
|
+
)
|
|
115
|
+
.overlay(
|
|
116
|
+
RoundedRectangle(cornerRadius: Radius.S)
|
|
117
|
+
.stroke(borderColor, lineWidth: 0.5)
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// MARK: - Preview
|
|
123
|
+
#if DEBUG
|
|
124
|
+
struct Information_Previews: PreviewProvider {
|
|
125
|
+
static var previews: some View {
|
|
126
|
+
VStack(spacing: 16) {
|
|
127
|
+
Information(
|
|
128
|
+
title: "Information",
|
|
129
|
+
description: "This is a default information message."
|
|
130
|
+
)
|
|
131
|
+
Information(
|
|
132
|
+
title: "Warning",
|
|
133
|
+
description: "This is a warning message.",
|
|
134
|
+
state: .warning
|
|
135
|
+
)
|
|
136
|
+
Information(
|
|
137
|
+
title: "Error",
|
|
138
|
+
description: "This is an error message.",
|
|
139
|
+
state: .error,
|
|
140
|
+
onPressAction: {}, action: "Retry"
|
|
141
|
+
)
|
|
142
|
+
Information(
|
|
143
|
+
description: "Dismissible information.",
|
|
144
|
+
onPressClose: {}
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
.padding()
|
|
148
|
+
.previewLayout(.sizeThatFits)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
#endif
|
package/ios/Input/Input.swift
CHANGED
|
@@ -3,12 +3,14 @@ import SwiftUI
|
|
|
3
3
|
import Combine
|
|
4
4
|
|
|
5
5
|
public struct Input: View {
|
|
6
|
+
@Environment(\.appTheme) private var theme
|
|
6
7
|
@Binding public var text: String
|
|
7
8
|
|
|
8
9
|
public var placeholder: String
|
|
9
10
|
public var floatingValue: String
|
|
11
|
+
public var floatingValueColor: Color?
|
|
10
12
|
public var floatingIcon: String
|
|
11
|
-
public var floatingIconColor: Color
|
|
13
|
+
public var floatingIconColor: Color?
|
|
12
14
|
public var size: InputSize
|
|
13
15
|
public var hintText: String
|
|
14
16
|
public var error: String
|
|
@@ -17,9 +19,9 @@ public struct Input: View {
|
|
|
17
19
|
public var readOnly: Bool
|
|
18
20
|
public var secureTextEntry: Bool
|
|
19
21
|
public var rightIcon: String
|
|
20
|
-
public var rightIconColor: Color
|
|
22
|
+
public var rightIconColor: Color?
|
|
21
23
|
public var leadingIcon: String
|
|
22
|
-
public var leadingIconColor: Color
|
|
24
|
+
public var leadingIconColor: Color?
|
|
23
25
|
public var loading: Bool
|
|
24
26
|
public var required: Bool
|
|
25
27
|
public var maxLength: Int?
|
|
@@ -38,8 +40,9 @@ public struct Input: View {
|
|
|
38
40
|
text: Binding<String>,
|
|
39
41
|
placeholder: String = "",
|
|
40
42
|
floatingValue: String = "",
|
|
43
|
+
floatingValueColor: Color? = nil,
|
|
41
44
|
floatingIcon: String = "",
|
|
42
|
-
floatingIconColor: Color =
|
|
45
|
+
floatingIconColor: Color? = nil,
|
|
43
46
|
size: InputSize = .small,
|
|
44
47
|
hintText: String = "",
|
|
45
48
|
error: String = "",
|
|
@@ -48,9 +51,9 @@ public struct Input: View {
|
|
|
48
51
|
readOnly: Bool = false,
|
|
49
52
|
secureTextEntry: Bool = false,
|
|
50
53
|
rightIcon: String = "",
|
|
51
|
-
rightIconColor: Color =
|
|
54
|
+
rightIconColor: Color? = nil,
|
|
52
55
|
leadingIcon: String = "",
|
|
53
|
-
leadingIconColor: Color =
|
|
56
|
+
leadingIconColor: Color? = nil,
|
|
54
57
|
loading: Bool = false,
|
|
55
58
|
required: Bool = false,
|
|
56
59
|
maxLength: Int? = nil,
|
|
@@ -65,6 +68,7 @@ public struct Input: View {
|
|
|
65
68
|
self._text = text
|
|
66
69
|
self.placeholder = placeholder
|
|
67
70
|
self.floatingValue = floatingValue
|
|
71
|
+
self.floatingValueColor = floatingValueColor
|
|
68
72
|
self.floatingIcon = floatingIcon
|
|
69
73
|
self.floatingIconColor = floatingIconColor
|
|
70
74
|
self.size = size
|
|
@@ -107,14 +111,14 @@ public struct Input: View {
|
|
|
107
111
|
HStack(spacing: Spacing.XS) {
|
|
108
112
|
MomoText(floatingValue, typography: .labelSMedium, color: getFloatingColor())
|
|
109
113
|
if required {
|
|
110
|
-
MomoText("*", typography: .labelSMedium, color:
|
|
114
|
+
MomoText("*", typography: .labelSMedium, color: theme.colors.error.primary)
|
|
111
115
|
}
|
|
112
116
|
if !floatingIcon.isEmpty {
|
|
113
117
|
Icon(source: floatingIcon, size: 16, color: getFloatingIconColor())
|
|
114
118
|
}
|
|
115
119
|
}
|
|
116
120
|
.padding(.horizontal, Spacing.S)
|
|
117
|
-
.background(
|
|
121
|
+
.background(theme.colors.background.surface)
|
|
118
122
|
.offset(x: Spacing.S, y: -8)
|
|
119
123
|
.zIndex(10)
|
|
120
124
|
}
|
|
@@ -123,7 +127,7 @@ public struct Input: View {
|
|
|
123
127
|
HStack(alignment: .center, spacing: 0) {
|
|
124
128
|
// Leading icon
|
|
125
129
|
if !leadingIcon.isEmpty {
|
|
126
|
-
Icon(source: leadingIcon, size: size == .small ? 24 : 32, color:
|
|
130
|
+
Icon(source: leadingIcon, size: size == .small ? 24 : 32, color: getLeadingIconColor())
|
|
127
131
|
.padding(.trailing, Spacing.M)
|
|
128
132
|
}
|
|
129
133
|
|
|
@@ -144,6 +148,7 @@ public struct Input: View {
|
|
|
144
148
|
fontSize: scaleSize(14),
|
|
145
149
|
fontWeight: fontWeight == .bold ? .bold : .regular,
|
|
146
150
|
textColor: UIColor(getTextColor()),
|
|
151
|
+
cursorColor: UIColor(theme.colors.primary),
|
|
147
152
|
isDisabled: disabled || readOnly,
|
|
148
153
|
maxLength: maxLength,
|
|
149
154
|
onFocusChange: { focused in
|
|
@@ -157,9 +162,10 @@ public struct Input: View {
|
|
|
157
162
|
})
|
|
158
163
|
.keyboardType(keyboardType)
|
|
159
164
|
.font(fontWeight == .bold ? .action_s_bold : .body_default_regular)
|
|
165
|
+
.ignoreBoldTextSetting()
|
|
160
166
|
.foregroundColor(getTextColor())
|
|
161
167
|
.disabled(disabled || readOnly)
|
|
162
|
-
.
|
|
168
|
+
.applyCursorColor(theme.colors.primary)
|
|
163
169
|
.onChange(of: text) { newValue in
|
|
164
170
|
let limited = limitText(newValue)
|
|
165
171
|
if limited != newValue {
|
|
@@ -175,7 +181,7 @@ public struct Input: View {
|
|
|
175
181
|
text = ""
|
|
176
182
|
onChangeText?("")
|
|
177
183
|
}) {
|
|
178
|
-
Icon(source: "24_navigation_close_circle_full", size: 16, color:
|
|
184
|
+
Icon(source: "24_navigation_close_circle_full", size: 16, color: theme.colors.text.hint)
|
|
179
185
|
.padding(.leading, Spacing.S).accessibility(identifier: "ic_clear")
|
|
180
186
|
}
|
|
181
187
|
}
|
|
@@ -194,14 +200,14 @@ public struct Input: View {
|
|
|
194
200
|
Icon(
|
|
195
201
|
source: isPasswordHidden ? "24_security_eye_off" : "24_security_eye_open",
|
|
196
202
|
size: 24,
|
|
197
|
-
color:
|
|
203
|
+
color: getRightIconColor()
|
|
198
204
|
)
|
|
199
205
|
.padding(.leading, Spacing.S).accessibility(identifier: "ic_show_hide")
|
|
200
206
|
}
|
|
201
207
|
}
|
|
202
208
|
} else if !rightIcon.isEmpty {
|
|
203
209
|
SwiftUI.Button(action: { onRightIconPressed?() }) {
|
|
204
|
-
Icon(source: rightIcon, size: 24, color:
|
|
210
|
+
Icon(source: rightIcon, size: 24, color: getRightIconColor())
|
|
205
211
|
.padding(.leading, Spacing.S)
|
|
206
212
|
}
|
|
207
213
|
}
|
|
@@ -210,7 +216,7 @@ public struct Input: View {
|
|
|
210
216
|
.frame(height: scaleSize(size == .small ? 48 : 56, 1.1))
|
|
211
217
|
.background(
|
|
212
218
|
RoundedRectangle(cornerRadius: Radius.S)
|
|
213
|
-
.fill(
|
|
219
|
+
.fill(theme.colors.background.surface)
|
|
214
220
|
)
|
|
215
221
|
.overlay(
|
|
216
222
|
RoundedRectangle(cornerRadius: Radius.S)
|
|
@@ -259,31 +265,39 @@ public struct Input: View {
|
|
|
259
265
|
|
|
260
266
|
private func borderColor() -> Color {
|
|
261
267
|
if disabled {
|
|
262
|
-
return
|
|
268
|
+
return theme.colors.border.disable
|
|
263
269
|
}
|
|
264
270
|
if !error.isEmpty {
|
|
265
|
-
return
|
|
271
|
+
return theme.colors.error.primary
|
|
266
272
|
}
|
|
267
273
|
if isFocused {
|
|
268
|
-
return
|
|
274
|
+
return theme.colors.primary
|
|
269
275
|
}
|
|
270
|
-
return
|
|
276
|
+
return theme.colors.border.default
|
|
271
277
|
}
|
|
272
278
|
|
|
273
279
|
private func getTextColor() -> Color {
|
|
274
|
-
return disabled ?
|
|
280
|
+
return disabled ? theme.colors.text.disable : theme.colors.text.default
|
|
275
281
|
}
|
|
276
282
|
|
|
277
283
|
private func getPlaceholderColor() -> Color {
|
|
278
|
-
return disabled ?
|
|
284
|
+
return disabled ? theme.colors.text.disable : theme.colors.text.hint
|
|
279
285
|
}
|
|
280
286
|
|
|
281
287
|
private func getFloatingColor() -> Color {
|
|
282
|
-
return disabled ?
|
|
288
|
+
return disabled ? theme.colors.text.disable : (floatingValueColor ?? theme.colors.text.hint)
|
|
283
289
|
}
|
|
284
290
|
|
|
285
291
|
private func getFloatingIconColor() -> Color {
|
|
286
|
-
return disabled ?
|
|
292
|
+
return disabled ? theme.colors.text.disable : (floatingIconColor ?? theme.colors.text.default)
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
private func getLeadingIconColor() -> Color {
|
|
296
|
+
return disabled ? theme.colors.text.disable : (leadingIconColor ?? theme.colors.text.hint)
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
private func getRightIconColor() -> Color {
|
|
300
|
+
return disabled ? theme.colors.text.disable : (rightIconColor ?? theme.colors.text.default)
|
|
287
301
|
}
|
|
288
302
|
}
|
|
289
303
|
|
|
@@ -295,6 +309,7 @@ private struct SecureInputField: UIViewRepresentable {
|
|
|
295
309
|
var fontSize: CGFloat
|
|
296
310
|
var fontWeight: UIFont.Weight
|
|
297
311
|
var textColor: UIColor
|
|
312
|
+
var cursorColor: UIColor
|
|
298
313
|
var isDisabled: Bool
|
|
299
314
|
var maxLength: Int?
|
|
300
315
|
var onFocusChange: (Bool) -> Void
|
|
@@ -315,7 +330,7 @@ private struct SecureInputField: UIViewRepresentable {
|
|
|
315
330
|
textField.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
|
316
331
|
textField.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
|
317
332
|
textField.text = text
|
|
318
|
-
textField.tintColor =
|
|
333
|
+
textField.tintColor = cursorColor
|
|
319
334
|
textField.addTarget(
|
|
320
335
|
context.coordinator,
|
|
321
336
|
action: #selector(Coordinator.textFieldDidChange(_:)),
|
|
@@ -330,6 +345,8 @@ private struct SecureInputField: UIViewRepresentable {
|
|
|
330
345
|
textField.text = text
|
|
331
346
|
}
|
|
332
347
|
textField.isEnabled = !isDisabled
|
|
348
|
+
textField.textColor = textColor
|
|
349
|
+
textField.tintColor = cursorColor
|
|
333
350
|
if textField.keyboardType != keyboardType {
|
|
334
351
|
textField.keyboardType = keyboardType
|
|
335
352
|
textField.reloadInputViews()
|
|
@@ -400,9 +417,9 @@ private struct SecureInputField: UIViewRepresentable {
|
|
|
400
417
|
|
|
401
418
|
// MARK: - Helper Extension
|
|
402
419
|
private extension View {
|
|
403
|
-
func
|
|
420
|
+
func applyCursorColor(_ color: Color) -> some View {
|
|
404
421
|
if #available(iOS 15.0, *) {
|
|
405
|
-
return self.tint(
|
|
422
|
+
return self.tint(color)
|
|
406
423
|
} else {
|
|
407
424
|
return self
|
|
408
425
|
}
|
|
@@ -7,15 +7,17 @@
|
|
|
7
7
|
|
|
8
8
|
import SwiftUI
|
|
9
9
|
public struct InputPhoneNumber: View {
|
|
10
|
+
@Environment(\.appTheme) private var theme
|
|
10
11
|
@Binding public var text: String
|
|
11
12
|
|
|
12
13
|
public var placeholder: String
|
|
13
14
|
public var size: InputSize
|
|
14
15
|
public var hintText: String
|
|
15
16
|
public var error: String
|
|
17
|
+
public var errorSpacing: Bool
|
|
16
18
|
public var loading: Bool
|
|
17
19
|
public var rightIcon: String
|
|
18
|
-
public var rightIconColor: Color
|
|
20
|
+
public var rightIconColor: Color?
|
|
19
21
|
public var autofocus: Bool
|
|
20
22
|
public var onChangeText: ((String) -> Void)?
|
|
21
23
|
public var onFocus: (() -> Void)?
|
|
@@ -31,10 +33,11 @@ public struct InputPhoneNumber: View {
|
|
|
31
33
|
size: InputSize = .small,
|
|
32
34
|
hintText: String = "",
|
|
33
35
|
error: String = "",
|
|
36
|
+
errorSpacing: Bool = false,
|
|
34
37
|
loading: Bool = false,
|
|
35
38
|
required: Bool = false,
|
|
36
39
|
rightIcon: String = "",
|
|
37
|
-
rightIconColor: Color =
|
|
40
|
+
rightIconColor: Color? = nil,
|
|
38
41
|
autofocus: Bool = false,
|
|
39
42
|
onChangeText: ((String) -> Void)? = nil,
|
|
40
43
|
onFocus: (() -> Void)? = nil,
|
|
@@ -47,6 +50,7 @@ public struct InputPhoneNumber: View {
|
|
|
47
50
|
self.size = size
|
|
48
51
|
self.hintText = hintText
|
|
49
52
|
self.error = error
|
|
53
|
+
self.errorSpacing = errorSpacing
|
|
50
54
|
self.loading = loading
|
|
51
55
|
self.rightIcon = rightIcon
|
|
52
56
|
self.rightIconColor = rightIconColor
|
|
@@ -76,17 +80,17 @@ public struct InputPhoneNumber: View {
|
|
|
76
80
|
.padding(.trailing, Spacing.XS)
|
|
77
81
|
|
|
78
82
|
MomoText("+84", typography: size == .small ? .headerSSemibold : .headerMBold)
|
|
79
|
-
.foregroundColor(
|
|
83
|
+
.foregroundColor(theme.colors.text.default)
|
|
80
84
|
|
|
81
85
|
Rectangle()
|
|
82
|
-
.fill(
|
|
86
|
+
.fill(theme.colors.border.default)
|
|
83
87
|
.frame(width: 1, height: size == .small ? 24 : 32)
|
|
84
88
|
.padding(.horizontal, Spacing.M)
|
|
85
89
|
|
|
86
90
|
// Text input
|
|
87
91
|
ZStack(alignment: .leading) {
|
|
88
92
|
if text.isEmpty {
|
|
89
|
-
MomoText(placeholder, typography: size == .small ? .headerSSemibold : .headerMBold, color:
|
|
93
|
+
MomoText(placeholder, typography: size == .small ? .headerSSemibold : .headerMBold, color: theme.colors.text.hint)
|
|
90
94
|
}
|
|
91
95
|
|
|
92
96
|
TextField("", text: textBinding, onEditingChanged: { focused in
|
|
@@ -94,8 +98,9 @@ public struct InputPhoneNumber: View {
|
|
|
94
98
|
})
|
|
95
99
|
.keyboardType(.numberPad)
|
|
96
100
|
.font(size == .small ? .header_s_semibold : .header_m_bold)
|
|
97
|
-
.
|
|
98
|
-
.
|
|
101
|
+
.ignoreBoldTextSetting()
|
|
102
|
+
.foregroundColor(theme.colors.text.default)
|
|
103
|
+
.applyCursorColor(theme.colors.primary)
|
|
99
104
|
.lineLimit(1)
|
|
100
105
|
.accessibility(identifier: accessibilityLabel ?? "")
|
|
101
106
|
.accessibilityValue(textBinding.wrappedValue.isEmpty ? placeholder : textBinding.wrappedValue)
|
|
@@ -107,7 +112,7 @@ public struct InputPhoneNumber: View {
|
|
|
107
112
|
text = ""
|
|
108
113
|
onChangeText?("")
|
|
109
114
|
}) {
|
|
110
|
-
Icon(source: "24_navigation_close_circle_full", size: 16, color:
|
|
115
|
+
Icon(source: "24_navigation_close_circle_full", size: 16, color: theme.colors.text.hint)
|
|
111
116
|
.padding(.leading, Spacing.S).accessibility(identifier: "ic_clear")
|
|
112
117
|
}
|
|
113
118
|
}
|
|
@@ -121,7 +126,7 @@ public struct InputPhoneNumber: View {
|
|
|
121
126
|
// ✅ Right icon
|
|
122
127
|
if !rightIcon.isEmpty {
|
|
123
128
|
SwiftUI.Button(action: { onRightIconPressed?() }) {
|
|
124
|
-
Icon(source: rightIcon, size: 24, color: rightIconColor)
|
|
129
|
+
Icon(source: rightIcon, size: 24, color: rightIconColor ?? theme.colors.text.default)
|
|
125
130
|
.padding(.leading, Spacing.S)
|
|
126
131
|
}
|
|
127
132
|
}
|
|
@@ -130,7 +135,7 @@ public struct InputPhoneNumber: View {
|
|
|
130
135
|
.frame(height: scaleSize(size == .small ? 48 : 56, 1.1))
|
|
131
136
|
.background(
|
|
132
137
|
RoundedRectangle(cornerRadius: Radius.S)
|
|
133
|
-
.fill(
|
|
138
|
+
.fill(theme.colors.background.surface)
|
|
134
139
|
)
|
|
135
140
|
.overlay(
|
|
136
141
|
RoundedRectangle(cornerRadius: Radius.S)
|
|
@@ -140,7 +145,7 @@ public struct InputPhoneNumber: View {
|
|
|
140
145
|
// Error or hint
|
|
141
146
|
ErrorView(
|
|
142
147
|
errorMessage: error,
|
|
143
|
-
errorSpacing:
|
|
148
|
+
errorSpacing: errorSpacing,
|
|
144
149
|
hintText: hintText
|
|
145
150
|
)
|
|
146
151
|
}
|
|
@@ -158,21 +163,18 @@ public struct InputPhoneNumber: View {
|
|
|
158
163
|
}
|
|
159
164
|
|
|
160
165
|
private func borderColor() -> Color {
|
|
161
|
-
if !error.isEmpty { return
|
|
162
|
-
if isFocused { return
|
|
163
|
-
return
|
|
166
|
+
if !error.isEmpty { return theme.colors.error.primary }
|
|
167
|
+
if isFocused { return theme.colors.primary }
|
|
168
|
+
return theme.colors.border.default
|
|
164
169
|
}
|
|
165
170
|
}
|
|
166
171
|
|
|
167
172
|
private extension View {
|
|
168
|
-
func
|
|
173
|
+
func applyCursorColor(_ color: Color) -> some View {
|
|
169
174
|
if #available(iOS 15.0, *) {
|
|
170
|
-
|
|
171
|
-
return self.tint(Colors.primary)
|
|
175
|
+
return self.tint(color)
|
|
172
176
|
} else {
|
|
173
|
-
// iOS 13–14: return unchanged (no tint support)
|
|
174
177
|
return self
|
|
175
178
|
}
|
|
176
179
|
}
|
|
177
180
|
}
|
|
178
|
-
|