@momo-kits/native-kits 0.163.1-beta.3 → 0.163.1-beta.5-debug
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +1 -1
- package/build.gradle.kts +11 -0
- package/compose/build.gradle.kts +190 -0
- package/compose/build.gradle.kts.backup +190 -0
- package/compose/compose.podspec +47 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +6 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +123 -0
- 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 +52 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +106 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +183 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +207 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +39 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +294 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +33 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +826 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +110 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +378 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +56 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +69 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +157 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +82 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +338 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +175 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +356 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +113 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +89 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +128 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +209 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +543 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +23 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +125 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +231 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +112 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +477 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +114 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +214 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +240 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +216 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +259 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +182 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +343 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +108 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +41 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +84 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +40 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +328 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +97 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +310 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +59 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +87 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +21 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +90 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +323 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +217 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +473 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +122 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +199 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +91 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +470 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +88 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +131 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +203 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +498 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +175 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +182 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +193 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +234 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +188 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +306 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +22 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +16 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +188 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +276 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +35 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +52 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +66 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +104 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +48 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +253 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +129 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +98 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +172 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +360 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +8 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +562 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +154 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +225 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +169 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +320 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +81 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +309 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +34 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +360 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +132 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +128 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +70 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +9 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +58 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +55 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +15 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +105 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +32 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +66 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +184 -0
- package/gradle/libs.versions.toml +69 -0
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +8 -0
- package/gradle.properties +26 -0
- package/gradlew +252 -0
- package/gradlew.bat +94 -0
- package/ios/Application/ApplicationEnvironment.swift +11 -1
- package/ios/Application/Components.swift +34 -44
- package/ios/Application/FloatingButton.swift +10 -9
- package/ios/Application/HeaderRight.swift +79 -45
- package/ios/Application/Navigation/BottomTab/BottomTab.swift +103 -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 +176 -0
- package/ios/Application/Navigation/NavigationOptions.swift +109 -0
- package/ios/Application/Navigation/Navigator.swift +364 -0
- package/ios/Application/Navigation/Overplay/BottomSheet.swift +188 -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/Screen.swift +2 -1
- package/ios/Application/StackScreen.swift +453 -0
- package/ios/Avatar/Avatar.swift +193 -0
- package/ios/Badge/Badge.swift +11 -14
- package/ios/Badge/BadgeRibbon.swift +12 -21
- package/ios/BaselineView/BaselineView.swift +163 -0
- package/ios/Button/Button.swift +61 -22
- package/ios/Carousel/Carousel.swift +181 -0
- package/ios/Checkbox/Checkbox.swift +14 -13
- package/ios/Chip/Chip.swift +23 -9
- package/ios/Collapse/Collapse.swift +182 -0
- package/ios/Colors+Radius+Spacing/Colors.swift +12 -12
- 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/Extensions/Color++.swift +32 -0
- package/ios/Icon/Icon.swift +6 -1
- package/ios/IconButton/IconButton.swift +112 -0
- package/ios/Input/Input.swift +41 -25
- package/ios/Input/InputPhoneNumber.swift +20 -19
- package/ios/Input/InputSearch.swift +100 -47
- package/ios/Input/InputTextArea.swift +66 -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/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 +8 -16
- package/ios/Popup/PopupInput.swift +2 -8
- 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/Resources/MoMoUIKitsColors.xcassets/AccentColor.colorset/Contents.json +11 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Background.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Border.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Card.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Contents.json +6 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Error.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Primary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryDark.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/PrimaryLight.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Secondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Success.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Text.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/TextSecondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/Contents.json +9 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-default.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-disable.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-pressed.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-selected.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-surface.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/background-tonal.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-default.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/border-disable.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/gradient.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/primary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/secondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-container.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-primary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/success-secondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-default.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-disable.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-hint.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/ThemeColors/text-secondary.colorset/Contents.json +38 -0
- package/ios/Resources/MoMoUIKitsColors.xcassets/Warning.colorset/Contents.json +38 -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/Title/Title.swift +269 -0
- package/ios/Tooltip/Tooltip.swift +482 -0
- package/ios/Typography/FontScaleStore.swift +19 -0
- package/ios/Typography/Text.swift +86 -17
- package/ios/Typography/Typography.swift +12 -14
- package/ios/Uploader/Uploader.swift +183 -0
- package/ios/native-kits.podspec +61 -8
- package/ios-demo/MoMoUIKitsDemo.podspec +20 -0
- package/ios-demo/README.md +120 -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 +24 -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 +278 -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 +51 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoModels.swift +15 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/UIKitsDemoRegistry.swift +73 -0
- package/local.properties +8 -0
- package/package.json +1 -1
- package/publish.sh +50 -0
- package/scripts/gen-ios-color.mjs +136 -0
- package/settings.gradle.kts +64 -0
- package/example/ios/Example.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/example/ios/Example.xcworkspace/xcuserdata/huynhdung.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Example.xcworkspace/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +0 -5
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/Pods-Example.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SDWebImage.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/SkeletonUI.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/huynhdung.xcuserdatad/xcschemes/xcschememanagement.plist +0 -46
- package/ios/Application/FontScaleStore.swift +0 -59
|
@@ -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
|
+
}
|
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
|
|
@@ -160,7 +165,7 @@ public struct Input: View {
|
|
|
160
165
|
.ignoreBoldTextSetting()
|
|
161
166
|
.foregroundColor(getTextColor())
|
|
162
167
|
.disabled(disabled || readOnly)
|
|
163
|
-
.
|
|
168
|
+
.applyCursorColor(theme.colors.primary)
|
|
164
169
|
.onChange(of: text) { newValue in
|
|
165
170
|
let limited = limitText(newValue)
|
|
166
171
|
if limited != newValue {
|
|
@@ -176,7 +181,7 @@ public struct Input: View {
|
|
|
176
181
|
text = ""
|
|
177
182
|
onChangeText?("")
|
|
178
183
|
}) {
|
|
179
|
-
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)
|
|
180
185
|
.padding(.leading, Spacing.S).accessibility(identifier: "ic_clear")
|
|
181
186
|
}
|
|
182
187
|
}
|
|
@@ -195,14 +200,14 @@ public struct Input: View {
|
|
|
195
200
|
Icon(
|
|
196
201
|
source: isPasswordHidden ? "24_security_eye_off" : "24_security_eye_open",
|
|
197
202
|
size: 24,
|
|
198
|
-
color:
|
|
203
|
+
color: getRightIconColor()
|
|
199
204
|
)
|
|
200
205
|
.padding(.leading, Spacing.S).accessibility(identifier: "ic_show_hide")
|
|
201
206
|
}
|
|
202
207
|
}
|
|
203
208
|
} else if !rightIcon.isEmpty {
|
|
204
209
|
SwiftUI.Button(action: { onRightIconPressed?() }) {
|
|
205
|
-
Icon(source: rightIcon, size: 24, color:
|
|
210
|
+
Icon(source: rightIcon, size: 24, color: getRightIconColor())
|
|
206
211
|
.padding(.leading, Spacing.S)
|
|
207
212
|
}
|
|
208
213
|
}
|
|
@@ -211,7 +216,7 @@ public struct Input: View {
|
|
|
211
216
|
.frame(height: scaleSize(size == .small ? 48 : 56, 1.1))
|
|
212
217
|
.background(
|
|
213
218
|
RoundedRectangle(cornerRadius: Radius.S)
|
|
214
|
-
.fill(
|
|
219
|
+
.fill(theme.colors.background.surface)
|
|
215
220
|
)
|
|
216
221
|
.overlay(
|
|
217
222
|
RoundedRectangle(cornerRadius: Radius.S)
|
|
@@ -260,31 +265,39 @@ public struct Input: View {
|
|
|
260
265
|
|
|
261
266
|
private func borderColor() -> Color {
|
|
262
267
|
if disabled {
|
|
263
|
-
return
|
|
268
|
+
return theme.colors.border.disable
|
|
264
269
|
}
|
|
265
270
|
if !error.isEmpty {
|
|
266
|
-
return
|
|
271
|
+
return theme.colors.error.primary
|
|
267
272
|
}
|
|
268
273
|
if isFocused {
|
|
269
|
-
return
|
|
274
|
+
return theme.colors.primary
|
|
270
275
|
}
|
|
271
|
-
return
|
|
276
|
+
return theme.colors.border.default
|
|
272
277
|
}
|
|
273
278
|
|
|
274
279
|
private func getTextColor() -> Color {
|
|
275
|
-
return disabled ?
|
|
280
|
+
return disabled ? theme.colors.text.disable : theme.colors.text.default
|
|
276
281
|
}
|
|
277
282
|
|
|
278
283
|
private func getPlaceholderColor() -> Color {
|
|
279
|
-
return disabled ?
|
|
284
|
+
return disabled ? theme.colors.text.disable : theme.colors.text.hint
|
|
280
285
|
}
|
|
281
286
|
|
|
282
287
|
private func getFloatingColor() -> Color {
|
|
283
|
-
return disabled ?
|
|
288
|
+
return disabled ? theme.colors.text.disable : (floatingValueColor ?? theme.colors.text.hint)
|
|
284
289
|
}
|
|
285
290
|
|
|
286
291
|
private func getFloatingIconColor() -> Color {
|
|
287
|
-
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)
|
|
288
301
|
}
|
|
289
302
|
}
|
|
290
303
|
|
|
@@ -296,6 +309,7 @@ private struct SecureInputField: UIViewRepresentable {
|
|
|
296
309
|
var fontSize: CGFloat
|
|
297
310
|
var fontWeight: UIFont.Weight
|
|
298
311
|
var textColor: UIColor
|
|
312
|
+
var cursorColor: UIColor
|
|
299
313
|
var isDisabled: Bool
|
|
300
314
|
var maxLength: Int?
|
|
301
315
|
var onFocusChange: (Bool) -> Void
|
|
@@ -316,7 +330,7 @@ private struct SecureInputField: UIViewRepresentable {
|
|
|
316
330
|
textField.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
|
317
331
|
textField.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
|
318
332
|
textField.text = text
|
|
319
|
-
textField.tintColor =
|
|
333
|
+
textField.tintColor = cursorColor
|
|
320
334
|
textField.addTarget(
|
|
321
335
|
context.coordinator,
|
|
322
336
|
action: #selector(Coordinator.textFieldDidChange(_:)),
|
|
@@ -331,6 +345,8 @@ private struct SecureInputField: UIViewRepresentable {
|
|
|
331
345
|
textField.text = text
|
|
332
346
|
}
|
|
333
347
|
textField.isEnabled = !isDisabled
|
|
348
|
+
textField.textColor = textColor
|
|
349
|
+
textField.tintColor = cursorColor
|
|
334
350
|
if textField.keyboardType != keyboardType {
|
|
335
351
|
textField.keyboardType = keyboardType
|
|
336
352
|
textField.reloadInputViews()
|
|
@@ -401,9 +417,9 @@ private struct SecureInputField: UIViewRepresentable {
|
|
|
401
417
|
|
|
402
418
|
// MARK: - Helper Extension
|
|
403
419
|
private extension View {
|
|
404
|
-
func
|
|
420
|
+
func applyCursorColor(_ color: Color) -> some View {
|
|
405
421
|
if #available(iOS 15.0, *) {
|
|
406
|
-
return self.tint(
|
|
422
|
+
return self.tint(color)
|
|
407
423
|
} else {
|
|
408
424
|
return self
|
|
409
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
|
|
@@ -95,8 +99,8 @@ public struct InputPhoneNumber: View {
|
|
|
95
99
|
.keyboardType(.numberPad)
|
|
96
100
|
.font(size == .small ? .header_s_semibold : .header_m_bold)
|
|
97
101
|
.ignoreBoldTextSetting()
|
|
98
|
-
.foregroundColor(
|
|
99
|
-
.
|
|
102
|
+
.foregroundColor(theme.colors.text.default)
|
|
103
|
+
.applyCursorColor(theme.colors.primary)
|
|
100
104
|
.lineLimit(1)
|
|
101
105
|
.accessibility(identifier: accessibilityLabel ?? "")
|
|
102
106
|
.accessibilityValue(textBinding.wrappedValue.isEmpty ? placeholder : textBinding.wrappedValue)
|
|
@@ -108,7 +112,7 @@ public struct InputPhoneNumber: View {
|
|
|
108
112
|
text = ""
|
|
109
113
|
onChangeText?("")
|
|
110
114
|
}) {
|
|
111
|
-
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)
|
|
112
116
|
.padding(.leading, Spacing.S).accessibility(identifier: "ic_clear")
|
|
113
117
|
}
|
|
114
118
|
}
|
|
@@ -122,7 +126,7 @@ public struct InputPhoneNumber: View {
|
|
|
122
126
|
// ✅ Right icon
|
|
123
127
|
if !rightIcon.isEmpty {
|
|
124
128
|
SwiftUI.Button(action: { onRightIconPressed?() }) {
|
|
125
|
-
Icon(source: rightIcon, size: 24, color: rightIconColor)
|
|
129
|
+
Icon(source: rightIcon, size: 24, color: rightIconColor ?? theme.colors.text.default)
|
|
126
130
|
.padding(.leading, Spacing.S)
|
|
127
131
|
}
|
|
128
132
|
}
|
|
@@ -131,7 +135,7 @@ public struct InputPhoneNumber: View {
|
|
|
131
135
|
.frame(height: scaleSize(size == .small ? 48 : 56, 1.1))
|
|
132
136
|
.background(
|
|
133
137
|
RoundedRectangle(cornerRadius: Radius.S)
|
|
134
|
-
.fill(
|
|
138
|
+
.fill(theme.colors.background.surface)
|
|
135
139
|
)
|
|
136
140
|
.overlay(
|
|
137
141
|
RoundedRectangle(cornerRadius: Radius.S)
|
|
@@ -141,7 +145,7 @@ public struct InputPhoneNumber: View {
|
|
|
141
145
|
// Error or hint
|
|
142
146
|
ErrorView(
|
|
143
147
|
errorMessage: error,
|
|
144
|
-
errorSpacing:
|
|
148
|
+
errorSpacing: errorSpacing,
|
|
145
149
|
hintText: hintText
|
|
146
150
|
)
|
|
147
151
|
}
|
|
@@ -159,21 +163,18 @@ public struct InputPhoneNumber: View {
|
|
|
159
163
|
}
|
|
160
164
|
|
|
161
165
|
private func borderColor() -> Color {
|
|
162
|
-
if !error.isEmpty { return
|
|
163
|
-
if isFocused { return
|
|
164
|
-
return
|
|
166
|
+
if !error.isEmpty { return theme.colors.error.primary }
|
|
167
|
+
if isFocused { return theme.colors.primary }
|
|
168
|
+
return theme.colors.border.default
|
|
165
169
|
}
|
|
166
170
|
}
|
|
167
171
|
|
|
168
172
|
private extension View {
|
|
169
|
-
func
|
|
173
|
+
func applyCursorColor(_ color: Color) -> some View {
|
|
170
174
|
if #available(iOS 15.0, *) {
|
|
171
|
-
|
|
172
|
-
return self.tint(Colors.primary)
|
|
175
|
+
return self.tint(color)
|
|
173
176
|
} else {
|
|
174
|
-
// iOS 13–14: return unchanged (no tint support)
|
|
175
177
|
return self
|
|
176
178
|
}
|
|
177
179
|
}
|
|
178
180
|
}
|
|
179
|
-
|