@momo-kits/native-kits 0.157.1-beta.9 → 0.157.1-com.1-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/build.gradle.kts +11 -0
- package/compose/build.gradle.kts +180 -0
- package/compose/build.gradle.kts.backup +180 -0
- package/compose/compose.podspec +54 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +110 -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 +57 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +107 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +201 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +222 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +48 -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 +305 -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 +720 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +121 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +405 -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 +85 -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 +340 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +198 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +357 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +123 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +94 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +136 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +224 -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 +148 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +188 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +116 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +448 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +172 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +255 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +231 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +233 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +254 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +241 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +364 -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 +92 -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 +352 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +103 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +350 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +70 -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 +17 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +96 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +360 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +256 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +494 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +131 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +215 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +96 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +449 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +92 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +130 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +214 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +590 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +177 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +192 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +205 -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 +239 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +191 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +306 -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 +13 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +185 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +285 -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 +59 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +68 -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 +14 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +50 -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 +239 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +119 -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 +161 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +331 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +497 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +162 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +243 -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 +187 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +279 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +80 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +306 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +32 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +370 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +132 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +42 -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 +62 -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 +88 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +149 -0
- package/gradle/libs.versions.toml +57 -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/Input/Input.swift +4 -0
- package/local.properties +8 -0
- package/package.json +1 -1
- package/settings.gradle.kts +52 -0
- package/src/doctor/README.md +73 -0
- package/src/doctor/package-lock.json +885 -0
- package/src/doctor/package.json +44 -0
- package/src/doctor/publish.sh +27 -0
- package/src/doctor/src/Users.json +112 -0
- package/src/doctor/src/Whitelist.json +6 -0
- package/src/doctor/src/commands/check.ts +81 -0
- package/src/doctor/src/commands/doctor.ts +193 -0
- package/src/doctor/src/index.ts +35 -0
- package/src/doctor/src/logger.ts +84 -0
- package/src/doctor/src/task/native.ts +21 -0
- package/src/doctor/src/task/utils.ts +20 -0
- package/src/doctor/src/utils/checkCoreDependencies.ts +138 -0
- package/src/doctor/src/utils/checkDeletedPackage.ts +53 -0
- package/src/doctor/src/utils/checkDeprecatedPackages.ts +168 -0
- package/src/doctor/src/utils/checkDeprecatedVersion.ts +60 -0
- package/src/doctor/src/utils/checkShareDependencies.ts +251 -0
- package/src/doctor/src/utils/checkWrongVersionCommunityPackage.ts +64 -0
- package/src/doctor/src/utils/getErrorMessage.ts +84 -0
- package/src/doctor/src/utils/scanComponentUsage.ts +206 -0
- package/src/doctor/src/utils/scanFoundationImports.ts +169 -0
- package/src/doctor/src/utils/scanMaxApiUsage.ts +86 -0
- package/src/doctor/src/utils/scanNativeModulesUsage.ts +78 -0
- package/src/doctor/src/utils/sendMessage.ts +28 -0
- package/src/doctor/tsconfig.json +14 -0
- package/src/doctor/yarn.lock +492 -0
- package/src/foundations/Application/BottomSheet.tsx +358 -0
- package/src/foundations/Application/BottomTab/BottomTabBar.tsx +320 -0
- package/src/foundations/Application/BottomTab/CustomBottomTabItem.tsx +155 -0
- package/src/foundations/Application/BottomTab/TabBarIcon.tsx +113 -0
- package/src/foundations/Application/BottomTab/index.tsx +449 -0
- package/src/foundations/Application/Components/BackgroundImageView.tsx +126 -0
- package/src/foundations/Application/Components/HeaderAnimated.tsx +69 -0
- package/src/foundations/Application/Components/HeaderBackground.tsx +83 -0
- package/src/foundations/Application/Components/HeaderExtendHeader.tsx +225 -0
- package/src/foundations/Application/Components/HeaderLeft.tsx +93 -0
- package/src/foundations/Application/Components/HeaderRight.tsx +444 -0
- package/src/foundations/Application/Components/HeaderTitle.tsx +596 -0
- package/src/foundations/Application/Components/NavigationButton.tsx +76 -0
- package/src/foundations/Application/Components/SearchHeader.tsx +127 -0
- package/src/foundations/Application/Localize.ts +44 -0
- package/src/foundations/Application/ModalScreen.tsx +148 -0
- package/src/foundations/Application/Navigation.ts +63 -0
- package/src/foundations/Application/NavigationContainer.tsx +245 -0
- package/src/foundations/Application/Navigator.ts +171 -0
- package/src/foundations/Application/ScaleSizeProvider.tsx +16 -0
- package/src/foundations/Application/StackScreen.tsx +420 -0
- package/src/foundations/Application/TooltipPortal.tsx +127 -0
- package/src/foundations/Application/WidgetContainer.tsx +162 -0
- package/src/foundations/Application/index.ts +34 -0
- package/src/foundations/Application/types.ts +350 -0
- package/src/foundations/Application/utils.tsx +239 -0
- package/src/foundations/Assets/DotAnimation.json +256 -0
- package/src/foundations/Assets/SpinnerAnimation.json +1027 -0
- package/src/foundations/Assets/icon.json +4052 -0
- package/src/foundations/Assets/icon_bank.json +506 -0
- package/src/foundations/Assets/language.json +208 -0
- package/src/foundations/Assets/lottie_circle_loader.json +1 -0
- package/src/foundations/Assets/pinAnimation.json +1 -0
- package/src/foundations/Assets/unpinAnimation.json +1 -0
- package/src/foundations/Badge/Badge.tsx +104 -0
- package/src/foundations/Badge/BadgeDot.tsx +35 -0
- package/src/foundations/Badge/BadgeDotAnimation.tsx +95 -0
- package/src/foundations/Badge/BadgeRibbon.tsx +112 -0
- package/src/foundations/Badge/Shape.tsx +29 -0
- package/src/foundations/Badge/index.tsx +8 -0
- package/src/foundations/Badge/styles.ts +125 -0
- package/src/foundations/Badge/types.ts +68 -0
- package/src/foundations/Button/index.tsx +371 -0
- package/src/foundations/Button/styles.ts +65 -0
- package/src/foundations/CheckBox/index.tsx +104 -0
- package/src/foundations/CheckBox/styles.ts +17 -0
- package/src/foundations/CheckBox/types.ts +37 -0
- package/src/foundations/Consts/colors+spacing+radius.ts +232 -0
- package/src/foundations/Consts/index.ts +4 -0
- package/src/foundations/Consts/styles.ts +52 -0
- package/src/foundations/Consts/theme.ts +121 -0
- package/src/foundations/Context/index.ts +27 -0
- package/src/foundations/Divider/DashDivider.tsx +46 -0
- package/src/foundations/Divider/index.tsx +45 -0
- package/src/foundations/FoundationList/index.tsx +12 -0
- package/src/foundations/FoundationList/types.ts +7 -0
- package/src/foundations/Icon/index.tsx +57 -0
- package/src/foundations/Icon/types.ts +32 -0
- package/src/foundations/IconButton/index.tsx +144 -0
- package/src/foundations/IconButton/styles.ts +20 -0
- package/src/foundations/Image/index.tsx +115 -0
- package/src/foundations/Image/styles.ts +7 -0
- package/src/foundations/Image/types.ts +7 -0
- package/src/foundations/Input/Input.tsx +280 -0
- package/src/foundations/Input/InputDropDown.tsx +161 -0
- package/src/foundations/Input/InputMoney.tsx +325 -0
- package/src/foundations/Input/InputOTP.tsx +299 -0
- package/src/foundations/Input/InputPhoneNumber.tsx +287 -0
- package/src/foundations/Input/InputSearch.tsx +351 -0
- package/src/foundations/Input/InputTextArea.tsx +218 -0
- package/src/foundations/Input/SystemTextInput.tsx +44 -0
- package/src/foundations/Input/TextTyping.tsx +115 -0
- package/src/foundations/Input/common.tsx +243 -0
- package/src/foundations/Input/index.tsx +373 -0
- package/src/foundations/Input/styles.ts +226 -0
- package/src/foundations/Input/utils.ts +97 -0
- package/src/foundations/Layout/Card.tsx +108 -0
- package/src/foundations/Layout/FloatingButton.tsx +179 -0
- package/src/foundations/Layout/GridSystem.tsx +137 -0
- package/src/foundations/Layout/Item.tsx +59 -0
- package/src/foundations/Layout/ItemList.tsx +66 -0
- package/src/foundations/Layout/ItemSectionList.tsx +40 -0
- package/src/foundations/Layout/Screen.tsx +644 -0
- package/src/foundations/Layout/Section.tsx +103 -0
- package/src/foundations/Layout/TrackingScope.tsx +18 -0
- package/src/foundations/Layout/index.ts +34 -0
- package/src/foundations/Layout/styles.ts +95 -0
- package/src/foundations/Layout/types.ts +40 -0
- package/src/foundations/Layout/utils.ts +47 -0
- package/src/foundations/Loader/DotLoader.tsx +37 -0
- package/src/foundations/Loader/Loader.tsx +13 -0
- package/src/foundations/Loader/ProgressBar.tsx +45 -0
- package/src/foundations/Loader/Spinner.tsx +29 -0
- package/src/foundations/Loader/index.tsx +6 -0
- package/src/foundations/Loader/styles.ts +10 -0
- package/src/foundations/Loader/types.ts +35 -0
- package/src/foundations/Loader/utils.ts +25 -0
- package/src/foundations/Pagination/Dot.tsx +19 -0
- package/src/foundations/Pagination/PaginationDot.tsx +44 -0
- package/src/foundations/Pagination/PaginationNumber.tsx +31 -0
- package/src/foundations/Pagination/PaginationScroll.tsx +99 -0
- package/src/foundations/Pagination/PaginationWhiteDot.tsx +43 -0
- package/src/foundations/Pagination/index.tsx +25 -0
- package/src/foundations/Pagination/styles.ts +51 -0
- package/src/foundations/Pagination/types.ts +40 -0
- package/src/foundations/Popup/PopupNotify.tsx +276 -0
- package/src/foundations/Popup/PopupPromotion.tsx +118 -0
- package/src/foundations/Popup/index.tsx +4 -0
- package/src/foundations/Popup/types.ts +96 -0
- package/src/foundations/Radio/index.tsx +108 -0
- package/src/foundations/Radio/styles.ts +15 -0
- package/src/foundations/Radio/types.ts +31 -0
- package/src/foundations/Skeleton/index.tsx +118 -0
- package/src/foundations/Skeleton/styles.ts +5 -0
- package/src/foundations/Skeleton/types.ts +6 -0
- package/src/foundations/Switch/index.tsx +68 -0
- package/src/foundations/Switch/styles.ts +25 -0
- package/src/foundations/Switch/types.ts +19 -0
- package/src/foundations/Tag/index.tsx +128 -0
- package/src/foundations/Tag/types.ts +41 -0
- package/src/foundations/Text/index.tsx +241 -0
- package/src/foundations/Text/styles.ts +78 -0
- package/src/foundations/Text/types.ts +53 -0
- package/src/foundations/Text/utils.ts +63 -0
- package/src/foundations/Title/index.tsx +285 -0
- package/src/foundations/Title/styles.ts +55 -0
- package/src/foundations/Title/types.ts +21 -0
- package/src/foundations/index.ts +50 -0
- package/src/foundations/package.json +35 -0
- package/src/foundations/publish.sh +17 -0
- package/src/libs/AutoComplete/index.tsx +88 -0
- package/src/libs/AutoComplete/package.json +16 -0
- package/src/libs/AutoComplete/publish.sh +16 -0
- package/src/libs/AutoComplete/styles.ts +15 -0
- package/src/libs/AutoComplete/types.ts +60 -0
- package/src/libs/Avatar/index.tsx +146 -0
- package/src/libs/Avatar/package.json +16 -0
- package/src/libs/Avatar/publish.sh +20 -0
- package/src/libs/Avatar/styles.ts +18 -0
- package/src/libs/Avatar/types.ts +57 -0
- package/src/libs/Badge/Badge.tsx +70 -0
- package/src/libs/Badge/BadgeDot.tsx +11 -0
- package/src/libs/Badge/BadgeRibbon.tsx +122 -0
- package/src/libs/Badge/Shape.tsx +29 -0
- package/src/libs/Badge/index.tsx +7 -0
- package/src/libs/Badge/package.json +16 -0
- package/src/libs/Badge/publish.sh +18 -0
- package/src/libs/Badge/styles.ts +55 -0
- package/src/libs/Badge/types.ts +63 -0
- package/src/libs/Calendar/CalendarPro.tsx +307 -0
- package/src/libs/Calendar/Day.tsx +150 -0
- package/src/libs/Calendar/HeaderControl.tsx +55 -0
- package/src/libs/Calendar/LunarDateConverter.ts +228 -0
- package/src/libs/Calendar/LunarService.ts +206 -0
- package/src/libs/Calendar/Month.tsx +118 -0
- package/src/libs/Calendar/MonthList.tsx +226 -0
- package/src/libs/Calendar/TabHeader.tsx +91 -0
- package/src/libs/Calendar/Util.ts +288 -0
- package/src/libs/Calendar/holidayData.ts +118 -0
- package/src/libs/Calendar/index.tsx +383 -0
- package/src/libs/Calendar/package.json +18 -0
- package/src/libs/Calendar/publish.sh +18 -0
- package/src/libs/Calendar/styles.ts +122 -0
- package/src/libs/Calendar/types.ts +212 -0
- package/src/libs/Carousel/animation.ts +62 -0
- package/src/libs/Carousel/index.tsx +517 -0
- package/src/libs/Carousel/package.json +18 -0
- package/src/libs/Carousel/publish.sh +16 -0
- package/src/libs/Carousel/types.ts +71 -0
- package/src/libs/Chip/index.tsx +164 -0
- package/src/libs/Chip/package.json +16 -0
- package/src/libs/Chip/publish.sh +16 -0
- package/src/libs/Chip/styles.ts +20 -0
- package/src/libs/Chip/types.ts +72 -0
- package/src/libs/Collapse/index.tsx +305 -0
- package/src/libs/Collapse/package.json +16 -0
- package/src/libs/Collapse/publish.sh +18 -0
- package/src/libs/Collapse/styles.ts +37 -0
- package/src/libs/Collapse/types.ts +84 -0
- package/src/libs/DateTimePicker/WheelPicker.tsx +163 -0
- package/src/libs/DateTimePicker/WheelPickerItem.tsx +58 -0
- package/src/libs/DateTimePicker/index.tsx +188 -0
- package/src/libs/DateTimePicker/package.json +16 -0
- package/src/libs/DateTimePicker/publish.sh +17 -0
- package/src/libs/DateTimePicker/styles.ts +31 -0
- package/src/libs/DateTimePicker/types.ts +102 -0
- package/src/libs/DateTimePicker/utils.ts +114 -0
- package/src/libs/Information/index.tsx +129 -0
- package/src/libs/Information/package.json +16 -0
- package/src/libs/Information/publish.sh +18 -0
- package/src/libs/Information/styles.ts +34 -0
- package/src/libs/Information/types.ts +79 -0
- package/src/libs/Logo/index.tsx +39 -0
- package/src/libs/Logo/package.json +17 -0
- package/src/libs/Logo/publish.sh +16 -0
- package/src/libs/Logo/styles.ts +25 -0
- package/src/libs/Logo/types.ts +13 -0
- package/src/libs/ProgressInfo/ProgressInfoHorizontal.tsx +128 -0
- package/src/libs/ProgressInfo/ProgressInfoIcon.tsx +88 -0
- package/src/libs/ProgressInfo/ProgressInfoVertical.tsx +85 -0
- package/src/libs/ProgressInfo/index.tsx +22 -0
- package/src/libs/ProgressInfo/package.json +16 -0
- package/src/libs/ProgressInfo/publish.sh +16 -0
- package/src/libs/ProgressInfo/styles.ts +46 -0
- package/src/libs/ProgressInfo/types.ts +60 -0
- package/src/libs/ProgressInfo/yarn.lock +8 -0
- package/src/libs/Rating/index.tsx +74 -0
- package/src/libs/Rating/package.json +16 -0
- package/src/libs/Rating/publish.sh +18 -0
- package/src/libs/Rating/type.ts +25 -0
- package/src/libs/Slider/Label.tsx +33 -0
- package/src/libs/Slider/helpers.ts +35 -0
- package/src/libs/Slider/hooks.tsx +218 -0
- package/src/libs/Slider/index.tsx +453 -0
- package/src/libs/Slider/package.json +16 -0
- package/src/libs/Slider/publish.sh +18 -0
- package/src/libs/Slider/styles.ts +36 -0
- package/src/libs/Stepper/NumberView.tsx +64 -0
- package/src/libs/Stepper/StepperButton.tsx +37 -0
- package/src/libs/Stepper/index.tsx +139 -0
- package/src/libs/Stepper/package.json +16 -0
- package/src/libs/Stepper/publish.sh +17 -0
- package/src/libs/Stepper/styles.ts +44 -0
- package/src/libs/Stepper/types.ts +154 -0
- package/src/libs/Steps/StepIcon.tsx +86 -0
- package/src/libs/Steps/StepsHorizontal.tsx +189 -0
- package/src/libs/Steps/StepsVertical.tsx +133 -0
- package/src/libs/Steps/index.tsx +20 -0
- package/src/libs/Steps/package.json +16 -0
- package/src/libs/Steps/publish.sh +16 -0
- package/src/libs/Steps/styles.ts +46 -0
- package/src/libs/Steps/types.ts +159 -0
- package/src/libs/Steps/utils.ts +175 -0
- package/src/libs/SuggestAction/SuggestActionView.tsx +124 -0
- package/src/libs/SuggestAction/index.tsx +3 -0
- package/src/libs/SuggestAction/package.json +16 -0
- package/src/libs/SuggestAction/publish.sh +16 -0
- package/src/libs/SuggestAction/styles.ts +30 -0
- package/src/libs/SuggestAction/types.ts +36 -0
- package/src/libs/Swipe/SwipeView.tsx +151 -0
- package/src/libs/Swipe/index.tsx +5 -0
- package/src/libs/Swipe/package.json +16 -0
- package/src/libs/Swipe/publish.sh +16 -0
- package/src/libs/Swipe/styles.ts +16 -0
- package/src/libs/Swipe/types.ts +109 -0
- package/src/libs/TabView/assets/Path.tsx +29 -0
- package/src/libs/TabView/index.tsx +184 -0
- package/src/libs/TabView/package.json +16 -0
- package/src/libs/TabView/publish.sh +16 -0
- package/src/libs/TabView/styles.ts +96 -0
- package/src/libs/TabView/tabBar/CardTabBar.tsx +137 -0
- package/src/libs/TabView/tabBar/SrollableTabBar.tsx +218 -0
- package/src/libs/TabView/tabBar/TabBar.tsx +67 -0
- package/src/libs/TabView/tabItem/CardTabItem.tsx +118 -0
- package/src/libs/TabView/tabItem/TabItem.tsx +180 -0
- package/src/libs/TabView/types.ts +166 -0
- package/src/libs/Template/HeaderSliderBanner/index.tsx +86 -0
- package/src/libs/Template/HeaderSliderBanner/types.ts +16 -0
- package/src/libs/Template/TrustBanner/CustomAvatar.tsx +39 -0
- package/src/libs/Template/TrustBanner/index.tsx +161 -0
- package/src/libs/Template/TrustBanner/styles.ts +48 -0
- package/src/libs/Template/TrustBanner/types.ts +50 -0
- package/src/libs/Template/index.tsx +4 -0
- package/src/libs/Template/package.json +18 -0
- package/src/libs/Template/publish.sh +17 -0
- package/src/libs/Title/index.tsx +284 -0
- package/src/libs/Title/package.json +17 -0
- package/src/libs/Title/publish.sh +16 -0
- package/src/libs/Title/styles.ts +54 -0
- package/src/libs/Title/types.ts +21 -0
- package/src/libs/Tooltip/TooltipButtons.tsx +54 -0
- package/src/libs/Tooltip/index.tsx +608 -0
- package/src/libs/Tooltip/package.json +16 -0
- package/src/libs/Tooltip/publish.sh +18 -0
- package/src/libs/Tooltip/styles.ts +70 -0
- package/src/libs/Tooltip/types.ts +61 -0
- package/src/libs/Uploader/index.tsx +87 -0
- package/src/libs/Uploader/package.json +17 -0
- package/src/libs/Uploader/publish.sh +18 -0
- package/src/libs/Uploader/styles.ts +30 -0
- package/src/libs/Uploader/types.ts +69 -0
- package/src/native/MoMoNative.podspec +18 -0
- package/src/native/calculator/android/build.gradle +61 -0
- package/src/native/calculator/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/src/native/calculator/android/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/src/native/calculator/android/gradlew +172 -0
- package/src/native/calculator/android/gradlew.bat +84 -0
- package/src/native/calculator/android/src/main/AndroidManifest.xml +5 -0
- package/src/native/calculator/android/src/main/java/com/calculator/KeyboardViewModule.java +22 -0
- package/src/native/calculator/android/src/main/java/com/calculator/KeyboardViewPackage.java +35 -0
- package/src/native/calculator/android/src/main/java/com/calculator/modules/CalculatorKeyboardModule.java +157 -0
- package/src/native/calculator/android/src/main/java/com/calculator/views/calculatorkeyboard/CalculatorEditText.java +36 -0
- package/src/native/calculator/android/src/main/java/com/calculator/views/calculatorkeyboard/FixedRelativeLayout.java +45 -0
- package/src/native/calculator/android/src/main/java/com/calculator/views/calculatorkeyboard/MomoTextInputCalculatorManager.java +173 -0
- package/src/native/calculator/android/src/main/java/com/calculator/views/customkeyboard/RNCustomKeyboardModule.java +417 -0
- package/src/native/calculator/ios/Helper/MomoHelper.swift +16 -0
- package/src/native/calculator/ios/KeyboardView-Bridging-Header.h +60 -0
- package/src/native/calculator/ios/KeyboardView.h +19 -0
- package/src/native/calculator/ios/KeyboardView.m +56 -0
- package/src/native/calculator/ios/MomoTextInputCalculator.swift +144 -0
- package/src/native/calculator/ios/RNCustomKeyboard/RNCustomKeyboard.h +6 -0
- package/src/native/calculator/ios/RNCustomKeyboard/RNCustomKeyboard.m +143 -0
- package/src/native/package.json +14 -0
- package/src/native/publish.sh +29 -0
- package/src/native/resource/android/build.gradle +57 -0
- package/src/native/resource/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/src/native/resource/android/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/src/native/resource/android/src/main/AndroidManifest.xml +6 -0
- package/src/native/resource/android/src/main/java/com/resource/RNResourceModule.java +90 -0
- package/src/native/resource/android/src/main/java/com/resource/RNResourcePackage.java +22 -0
- package/src/native/resource/ios/RNResouce.m +71 -0
- package/src/native/resource/ios/RNResource.h +5 -0
- package/example/ios/Example.xcodeproj/xcuserdata/sophia.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/example/ios/Example.xcworkspace/xcuserdata/sophia.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sophia.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -6
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sophia.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sophia.xcuserdatad/xcschemes/Pods-Example.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sophia.xcuserdatad/xcschemes/SDWebImage.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sophia.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sophia.xcuserdatad/xcschemes/SkeletonUI.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sophia.xcuserdatad/xcschemes/lottie-ios-LottiePrivacyInfo.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sophia.xcuserdatad/xcschemes/lottie-ios.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sophia.xcuserdatad/xcschemes/xcschememanagement.plist +0 -46
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
package vn.momo.kits.components
|
|
2
|
+
|
|
3
|
+
import androidx.compose.animation.core.LinearEasing
|
|
4
|
+
import androidx.compose.animation.core.RepeatMode
|
|
5
|
+
import androidx.compose.animation.core.animateFloat
|
|
6
|
+
import androidx.compose.animation.core.infiniteRepeatable
|
|
7
|
+
import androidx.compose.animation.core.rememberInfiniteTransition
|
|
8
|
+
import androidx.compose.animation.core.tween
|
|
9
|
+
import androidx.compose.foundation.background
|
|
10
|
+
import androidx.compose.foundation.border
|
|
11
|
+
import androidx.compose.foundation.layout.Box
|
|
12
|
+
import androidx.compose.foundation.layout.BoxWithConstraints
|
|
13
|
+
import androidx.compose.foundation.layout.fillMaxSize
|
|
14
|
+
import androidx.compose.runtime.Composable
|
|
15
|
+
import androidx.compose.runtime.remember
|
|
16
|
+
import androidx.compose.ui.Modifier
|
|
17
|
+
import androidx.compose.ui.draw.drawBehind
|
|
18
|
+
import androidx.compose.ui.geometry.Offset
|
|
19
|
+
import androidx.compose.ui.graphics.Brush
|
|
20
|
+
import androidx.compose.ui.unit.dp
|
|
21
|
+
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
22
|
+
import vn.momo.kits.const.Colors
|
|
23
|
+
import vn.momo.kits.modifier.conditional
|
|
24
|
+
|
|
25
|
+
// Pre-computed shimmer colors to avoid repeated list creation
|
|
26
|
+
private val shimmerColors = listOf(
|
|
27
|
+
Colors.black_05,
|
|
28
|
+
Colors.black_03,
|
|
29
|
+
Colors.black_05,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
// Constants for better performance
|
|
33
|
+
private const val SHADOW_BRUSH_PERCENTAGE = 0.6f
|
|
34
|
+
private const val DEFAULT_DURATION_MILLIS = 1000
|
|
35
|
+
|
|
36
|
+
@Composable
|
|
37
|
+
fun Skeleton() {
|
|
38
|
+
BoxWithConstraints(modifier = Modifier.fillMaxSize()) {
|
|
39
|
+
// Memoize width calculation
|
|
40
|
+
val maxWidthValue = remember(maxWidth) { maxWidth.value.toInt() }
|
|
41
|
+
|
|
42
|
+
Box(
|
|
43
|
+
modifier = Modifier
|
|
44
|
+
.fillMaxSize()
|
|
45
|
+
.background(Colors.black_05)
|
|
46
|
+
.conditional(IsShowBaseLineDebug) {
|
|
47
|
+
border(1.dp, Colors.blue_03)
|
|
48
|
+
}
|
|
49
|
+
.shimmerLoadingAnimation(maxWidth = maxWidthValue)
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@Composable
|
|
55
|
+
fun Modifier.shimmerLoadingAnimation(
|
|
56
|
+
maxWidth: Int,
|
|
57
|
+
angleOfAxisY: Float = 0f,
|
|
58
|
+
durationMillis: Int = DEFAULT_DURATION_MILLIS,
|
|
59
|
+
): Modifier {
|
|
60
|
+
// Memoize calculations to avoid repeated computations
|
|
61
|
+
val widthOfShadowBrush = remember(maxWidth) {
|
|
62
|
+
(maxWidth * SHADOW_BRUSH_PERCENTAGE).toInt()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
val animationTarget = remember(durationMillis, widthOfShadowBrush) {
|
|
66
|
+
(durationMillis + widthOfShadowBrush).toFloat()
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
val transition = rememberInfiniteTransition(label = "shimmer")
|
|
70
|
+
val translateAnimation = transition.animateFloat(
|
|
71
|
+
initialValue = 0f,
|
|
72
|
+
targetValue = animationTarget,
|
|
73
|
+
animationSpec = infiniteRepeatable(
|
|
74
|
+
animation = tween(
|
|
75
|
+
durationMillis = durationMillis,
|
|
76
|
+
easing = LinearEasing,
|
|
77
|
+
),
|
|
78
|
+
repeatMode = RepeatMode.Restart,
|
|
79
|
+
),
|
|
80
|
+
label = "shimmerTranslate"
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
return drawBehind {
|
|
84
|
+
// Memoize brush creation by using remember in the calling composable
|
|
85
|
+
val startX = translateAnimation.value - widthOfShadowBrush
|
|
86
|
+
val endX = translateAnimation.value
|
|
87
|
+
|
|
88
|
+
drawRect(
|
|
89
|
+
brush = Brush.linearGradient(
|
|
90
|
+
colors = shimmerColors,
|
|
91
|
+
start = Offset(x = startX, y = 0f),
|
|
92
|
+
end = Offset(x = endX, y = angleOfAxisY)
|
|
93
|
+
)
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
package vn.momo.kits.components
|
|
2
|
+
|
|
3
|
+
import androidx.compose.animation.core.animateFloatAsState
|
|
4
|
+
import androidx.compose.animation.core.spring
|
|
5
|
+
import androidx.compose.foundation.background
|
|
6
|
+
import androidx.compose.foundation.border
|
|
7
|
+
import androidx.compose.foundation.layout.Box
|
|
8
|
+
import androidx.compose.foundation.layout.BoxWithConstraints
|
|
9
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
10
|
+
import androidx.compose.foundation.layout.height
|
|
11
|
+
import androidx.compose.foundation.layout.offset
|
|
12
|
+
import androidx.compose.foundation.layout.padding
|
|
13
|
+
import androidx.compose.foundation.layout.size
|
|
14
|
+
import androidx.compose.foundation.layout.width
|
|
15
|
+
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
16
|
+
import androidx.compose.runtime.Composable
|
|
17
|
+
import androidx.compose.runtime.getValue
|
|
18
|
+
import androidx.compose.runtime.mutableFloatStateOf
|
|
19
|
+
import androidx.compose.runtime.mutableStateOf
|
|
20
|
+
import androidx.compose.runtime.remember
|
|
21
|
+
import androidx.compose.runtime.setValue
|
|
22
|
+
import androidx.compose.ui.Alignment
|
|
23
|
+
import androidx.compose.ui.Modifier
|
|
24
|
+
import androidx.compose.ui.draw.clip
|
|
25
|
+
import androidx.compose.ui.graphics.Color
|
|
26
|
+
import androidx.compose.ui.input.pointer.pointerInput
|
|
27
|
+
import androidx.compose.ui.layout.onGloballyPositioned
|
|
28
|
+
import androidx.compose.ui.platform.LocalDensity
|
|
29
|
+
import androidx.compose.ui.text.style.TextAlign
|
|
30
|
+
import androidx.compose.ui.unit.IntOffset
|
|
31
|
+
import androidx.compose.ui.unit.dp
|
|
32
|
+
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
33
|
+
import vn.momo.kits.const.AppTheme
|
|
34
|
+
import vn.momo.kits.const.Colors
|
|
35
|
+
import vn.momo.kits.const.Radius
|
|
36
|
+
import vn.momo.kits.const.Spacing
|
|
37
|
+
import vn.momo.kits.const.Typography
|
|
38
|
+
import vn.momo.kits.modifier.conditional
|
|
39
|
+
import vn.momo.kits.modifier.shadow
|
|
40
|
+
import kotlin.math.abs
|
|
41
|
+
import kotlin.math.min
|
|
42
|
+
import kotlin.math.roundToInt
|
|
43
|
+
|
|
44
|
+
// ── Design constants ─────────────────────────────────────────────────────────
|
|
45
|
+
|
|
46
|
+
private val THUMB_SIZE = 20.dp
|
|
47
|
+
private val THUMB_BORDER = 3.dp
|
|
48
|
+
private val TRACK_HEIGHT = 4.dp
|
|
49
|
+
private val LABEL_PAD_H = Spacing.XS
|
|
50
|
+
private val LABEL_PAD_V = Spacing.XXS
|
|
51
|
+
private val LABEL_GAP = Spacing.XS // space between label and thumb top
|
|
52
|
+
|
|
53
|
+
// ── Pure helpers (mirrors RN helpers.ts) ─────────────────────────────────────
|
|
54
|
+
|
|
55
|
+
private fun clamp(value: Float, min: Float, max: Float): Float =
|
|
56
|
+
min(kotlin.math.max(value, min), max)
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Converts a raw touch position into a snapped slider value.
|
|
60
|
+
* Direct port of RN getValueForPosition().
|
|
61
|
+
*/
|
|
62
|
+
private fun getValueForPosition(
|
|
63
|
+
positionInView: Float,
|
|
64
|
+
containerWidth: Float,
|
|
65
|
+
thumbWidth: Float,
|
|
66
|
+
min: Float,
|
|
67
|
+
max: Float,
|
|
68
|
+
step: Float,
|
|
69
|
+
): Float {
|
|
70
|
+
val availableSpace = containerWidth - thumbWidth
|
|
71
|
+
if (availableSpace <= 0f) return min
|
|
72
|
+
val relStepUnit = step / (max - min)
|
|
73
|
+
var relPosition = (positionInView - thumbWidth / 2f) / availableSpace
|
|
74
|
+
val relOffset = relPosition % relStepUnit
|
|
75
|
+
relPosition -= relOffset
|
|
76
|
+
if (relOffset / relStepUnit >= 0.5f) relPosition += relStepUnit
|
|
77
|
+
return clamp(min + (relPosition / relStepUnit).roundToInt() * step, min, max)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Direct port of RN isLowCloser(). */
|
|
81
|
+
private fun isLowCloser(downX: Float, lowPosition: Float, highPosition: Float): Boolean {
|
|
82
|
+
if (lowPosition == highPosition) return downX < lowPosition
|
|
83
|
+
return abs(downX - lowPosition) < abs(downX - highPosition)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
private fun valueToFraction(value: Float, min: Float, max: Float): Float {
|
|
87
|
+
if (max == min) return 0f
|
|
88
|
+
return clamp((value - min) / (max - min), 0f, 1f)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private fun formatLabel(value: Float): String =
|
|
92
|
+
if (value == value.toLong().toFloat()) value.toLong().toString()
|
|
93
|
+
else ((value * 10).toLong() / 10.0).toString()
|
|
94
|
+
|
|
95
|
+
// ── Component ─────────────────────────────────────────────────────────────────
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Range slider (or single-thumb when [disableRange] = true), migrated from React Native.
|
|
99
|
+
*
|
|
100
|
+
* @param min Minimum selectable value.
|
|
101
|
+
* @param max Maximum selectable value.
|
|
102
|
+
* @param step Snap increment between values.
|
|
103
|
+
* @param modifier Modifier applied to the root container.
|
|
104
|
+
* @param low Initial lower-thumb value (defaults to [min]).
|
|
105
|
+
* @param high Initial upper-thumb value (defaults to [max]).
|
|
106
|
+
* @param minRange Minimum required gap between low and high (default 0).
|
|
107
|
+
* @param disableRange When true only the low thumb is shown (single-value mode).
|
|
108
|
+
* @param floatingLabel When true a value label floats above the active thumb during drag.
|
|
109
|
+
* @param disabled Non-interactive; rendered in the disabled colour.
|
|
110
|
+
* @param onValueChanged Invoked with (low, high, byUser) on every value change.
|
|
111
|
+
* @param onSliderTouchStart Invoked when a drag gesture begins.
|
|
112
|
+
* @param onSliderTouchEnd Invoked when a drag gesture ends.
|
|
113
|
+
*/
|
|
114
|
+
@Composable
|
|
115
|
+
fun Slider(
|
|
116
|
+
min: Float,
|
|
117
|
+
max: Float,
|
|
118
|
+
step: Float,
|
|
119
|
+
modifier: Modifier = Modifier,
|
|
120
|
+
low: Float? = null,
|
|
121
|
+
high: Float? = null,
|
|
122
|
+
minRange: Float = 0f,
|
|
123
|
+
disableRange: Boolean = false,
|
|
124
|
+
floatingLabel: Boolean = false,
|
|
125
|
+
disabled: Boolean = false,
|
|
126
|
+
onValueChanged: (low: Float, high: Float, byUser: Boolean) -> Unit = { _, _, _ -> },
|
|
127
|
+
onSliderTouchStart: (low: Float, high: Float) -> Unit = { _, _ -> },
|
|
128
|
+
onSliderTouchEnd: (low: Float, high: Float) -> Unit = { _, _ -> },
|
|
129
|
+
) {
|
|
130
|
+
val theme = AppTheme.current
|
|
131
|
+
val density = LocalDensity.current
|
|
132
|
+
|
|
133
|
+
// Validated, step-snapped initial values
|
|
134
|
+
val initLow = remember(low, min, max, step) {
|
|
135
|
+
clamp(low ?: min, min, max)
|
|
136
|
+
}
|
|
137
|
+
val initHigh = remember(high, min, max, step, disableRange) {
|
|
138
|
+
if (disableRange) max else clamp(high ?: max, min, max)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
var lowValue by remember { mutableFloatStateOf(initLow) }
|
|
142
|
+
var highValue by remember { mutableFloatStateOf(initHigh) }
|
|
143
|
+
|
|
144
|
+
// Smoothly animated display fractions
|
|
145
|
+
val lowFraction by animateFloatAsState(
|
|
146
|
+
targetValue = valueToFraction(lowValue, min, max),
|
|
147
|
+
animationSpec = spring(stiffness = 1200f),
|
|
148
|
+
label = "lowFraction"
|
|
149
|
+
)
|
|
150
|
+
val highFraction by animateFloatAsState(
|
|
151
|
+
targetValue = valueToFraction(highValue, min, max),
|
|
152
|
+
animationSpec = spring(stiffness = 1200f),
|
|
153
|
+
label = "highFraction"
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
var draggingLow by remember { mutableStateOf(true) }
|
|
157
|
+
var isDragging by remember { mutableStateOf(false) }
|
|
158
|
+
|
|
159
|
+
val thumbColor = if (disabled) theme.colors.text.disable else theme.colors.primary
|
|
160
|
+
val trackActiveColor = if (disabled) theme.colors.text.disable else theme.colors.primary
|
|
161
|
+
val trackInactiveColor = theme.colors.background.default
|
|
162
|
+
|
|
163
|
+
// trackWidthPx is the full pixel width of the BoxWithConstraints (incl. thumb padding)
|
|
164
|
+
var trackWidthPx by remember { mutableFloatStateOf(0f) }
|
|
165
|
+
val thumbSizePx = with(density) { THUMB_SIZE.toPx() }
|
|
166
|
+
|
|
167
|
+
Box(
|
|
168
|
+
modifier = modifier
|
|
169
|
+
.fillMaxWidth()
|
|
170
|
+
.conditional(IsShowBaseLineDebug) { border(1.dp, Colors.blue_03) }
|
|
171
|
+
) {
|
|
172
|
+
BoxWithConstraints(
|
|
173
|
+
modifier = Modifier
|
|
174
|
+
.fillMaxWidth()
|
|
175
|
+
.onGloballyPositioned { coords -> trackWidthPx = coords.size.width.toFloat() }
|
|
176
|
+
// ── Gesture handling ──────────────────────────────────────────
|
|
177
|
+
.pointerInput(disabled, min, max, step, minRange, disableRange) {
|
|
178
|
+
if (disabled) return@pointerInput
|
|
179
|
+
|
|
180
|
+
awaitPointerEventScope {
|
|
181
|
+
while (true) {
|
|
182
|
+
// Finger down
|
|
183
|
+
val downEvent = awaitPointerEvent()
|
|
184
|
+
val downChange = downEvent.changes.firstOrNull() ?: continue
|
|
185
|
+
val touchX = downChange.position.x
|
|
186
|
+
|
|
187
|
+
// Pick the closer thumb
|
|
188
|
+
val lowCenterX = thumbSizePx / 2f +
|
|
189
|
+
valueToFraction(lowValue, min, max) * (trackWidthPx - thumbSizePx)
|
|
190
|
+
val highCenterX = thumbSizePx / 2f +
|
|
191
|
+
valueToFraction(highValue, min, max) * (trackWidthPx - thumbSizePx)
|
|
192
|
+
|
|
193
|
+
draggingLow = disableRange || isLowCloser(touchX, lowCenterX, highCenterX)
|
|
194
|
+
isDragging = true
|
|
195
|
+
onSliderTouchStart(lowValue, highValue)
|
|
196
|
+
|
|
197
|
+
// Apply initial press
|
|
198
|
+
applyDrag(touchX, trackWidthPx, thumbSizePx,
|
|
199
|
+
min, max, step, minRange, draggingLow,
|
|
200
|
+
lowValue, highValue) { nl, nh ->
|
|
201
|
+
lowValue = nl
|
|
202
|
+
highValue = nh
|
|
203
|
+
onValueChanged(nl, nh, true)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Track move / release
|
|
207
|
+
while (true) {
|
|
208
|
+
val moveEvent = awaitPointerEvent()
|
|
209
|
+
val moveChange = moveEvent.changes.firstOrNull() ?: break
|
|
210
|
+
moveChange.consume()
|
|
211
|
+
|
|
212
|
+
if (!moveChange.pressed) {
|
|
213
|
+
isDragging = false
|
|
214
|
+
onSliderTouchEnd(lowValue, highValue)
|
|
215
|
+
break
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
applyDrag(moveChange.position.x, trackWidthPx, thumbSizePx,
|
|
219
|
+
min, max, step, minRange, draggingLow,
|
|
220
|
+
lowValue, highValue) { nl, nh ->
|
|
221
|
+
lowValue = nl
|
|
222
|
+
highValue = nh
|
|
223
|
+
onValueChanged(nl, nh, true)
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
) {
|
|
230
|
+
val trackWidth = maxWidth
|
|
231
|
+
val availableWidth = trackWidth - THUMB_SIZE
|
|
232
|
+
|
|
233
|
+
// ── Floating label ────────────────────────────────────────────────
|
|
234
|
+
if (floatingLabel && isDragging) {
|
|
235
|
+
val activeFraction = if (draggingLow) lowFraction else highFraction
|
|
236
|
+
val activeValue = if (draggingLow) lowValue else highValue
|
|
237
|
+
val labelOffsetDp = availableWidth * activeFraction
|
|
238
|
+
|
|
239
|
+
Box(
|
|
240
|
+
modifier = Modifier
|
|
241
|
+
.align(Alignment.TopStart)
|
|
242
|
+
.offset { IntOffset(x = with(density) { labelOffsetDp.toPx().roundToInt() }, y = 0) }
|
|
243
|
+
) {
|
|
244
|
+
Box(
|
|
245
|
+
modifier = Modifier
|
|
246
|
+
.background(
|
|
247
|
+
color = theme.colors.text.default,
|
|
248
|
+
shape = RoundedCornerShape(Radius.XS)
|
|
249
|
+
)
|
|
250
|
+
.padding(horizontal = LABEL_PAD_H, vertical = LABEL_PAD_V)
|
|
251
|
+
) {
|
|
252
|
+
Text(
|
|
253
|
+
text = formatLabel(activeValue),
|
|
254
|
+
style = Typography.descriptionXsRegular,
|
|
255
|
+
color = Colors.black_01,
|
|
256
|
+
textAlign = TextAlign.Center
|
|
257
|
+
)
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// Top padding pushes track + thumbs below the label when floatingLabel is on
|
|
263
|
+
val topPad = if (floatingLabel) THUMB_SIZE + LABEL_GAP else 0.dp
|
|
264
|
+
|
|
265
|
+
// ── Inactive track (full width) ───────────────────────────────────
|
|
266
|
+
Box(
|
|
267
|
+
modifier = Modifier
|
|
268
|
+
.align(Alignment.TopStart)
|
|
269
|
+
.padding(top = topPad + (THUMB_SIZE - TRACK_HEIGHT) / 2)
|
|
270
|
+
.padding(horizontal = THUMB_SIZE / 2)
|
|
271
|
+
.fillMaxWidth()
|
|
272
|
+
.height(TRACK_HEIGHT)
|
|
273
|
+
.clip(RoundedCornerShape(percent = 50))
|
|
274
|
+
.background(trackInactiveColor)
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
// ── Active track (selected range / single value) ──────────────────
|
|
278
|
+
val activeStartFraction = if (disableRange) 0f else lowFraction
|
|
279
|
+
val activeEndFraction = if (disableRange) lowFraction else highFraction
|
|
280
|
+
val activeStartDp = THUMB_SIZE / 2 + availableWidth * activeStartFraction
|
|
281
|
+
val activeWidthDp = availableWidth * (activeEndFraction - activeStartFraction)
|
|
282
|
+
|
|
283
|
+
if (activeWidthDp > 0.dp) {
|
|
284
|
+
Box(
|
|
285
|
+
modifier = Modifier
|
|
286
|
+
.align(Alignment.TopStart)
|
|
287
|
+
.padding(top = topPad + (THUMB_SIZE - TRACK_HEIGHT) / 2)
|
|
288
|
+
.offset(x = activeStartDp)
|
|
289
|
+
.width(activeWidthDp)
|
|
290
|
+
.height(TRACK_HEIGHT)
|
|
291
|
+
.clip(RoundedCornerShape(percent = 50))
|
|
292
|
+
.background(trackActiveColor)
|
|
293
|
+
)
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// ── Low thumb ─────────────────────────────────────────────────────
|
|
297
|
+
Box(
|
|
298
|
+
modifier = Modifier
|
|
299
|
+
.align(Alignment.TopStart)
|
|
300
|
+
.padding(top = topPad)
|
|
301
|
+
.offset(x = availableWidth * lowFraction)
|
|
302
|
+
.shadow(
|
|
303
|
+
color = Color(0x33000000),
|
|
304
|
+
borderRadius = 50.dp,
|
|
305
|
+
blurRadius = 6f,
|
|
306
|
+
offsetY = 2.dp
|
|
307
|
+
)
|
|
308
|
+
.size(THUMB_SIZE)
|
|
309
|
+
.clip(RoundedCornerShape(percent = 100))
|
|
310
|
+
.background(thumbColor)
|
|
311
|
+
.border(THUMB_BORDER, theme.colors.background.surface, RoundedCornerShape(percent = 100))
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
// ── High thumb (range mode only) ──────────────────────────────────
|
|
315
|
+
if (!disableRange) {
|
|
316
|
+
Box(
|
|
317
|
+
modifier = Modifier
|
|
318
|
+
.align(Alignment.TopStart)
|
|
319
|
+
.padding(top = topPad)
|
|
320
|
+
.offset(x = availableWidth * highFraction)
|
|
321
|
+
.shadow(
|
|
322
|
+
color = Color(0x33000000),
|
|
323
|
+
borderRadius = 50.dp,
|
|
324
|
+
blurRadius = 6f,
|
|
325
|
+
offsetY = 2.dp
|
|
326
|
+
)
|
|
327
|
+
.size(THUMB_SIZE)
|
|
328
|
+
.clip(RoundedCornerShape(percent = 100))
|
|
329
|
+
.background(thumbColor)
|
|
330
|
+
.border(THUMB_BORDER, theme.colors.background.surface, RoundedCornerShape(percent = 100))
|
|
331
|
+
)
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// ── Private drag helper ───────────────────────────────────────────────────────
|
|
338
|
+
|
|
339
|
+
private fun applyDrag(
|
|
340
|
+
positionX: Float,
|
|
341
|
+
trackWidthPx: Float,
|
|
342
|
+
thumbSizePx: Float,
|
|
343
|
+
min: Float,
|
|
344
|
+
max: Float,
|
|
345
|
+
step: Float,
|
|
346
|
+
minRange: Float,
|
|
347
|
+
isLow: Boolean,
|
|
348
|
+
currentLow: Float,
|
|
349
|
+
currentHigh: Float,
|
|
350
|
+
onUpdate: (Float, Float) -> Unit,
|
|
351
|
+
) {
|
|
352
|
+
val snapped = getValueForPosition(positionX, trackWidthPx, thumbSizePx, min, max, step)
|
|
353
|
+
if (isLow) {
|
|
354
|
+
val newLow = clamp(snapped, min, currentHigh - minRange)
|
|
355
|
+
if (newLow != currentLow) onUpdate(newLow, currentHigh)
|
|
356
|
+
} else {
|
|
357
|
+
val newHigh = clamp(snapped, currentLow + minRange, max)
|
|
358
|
+
if (newHigh != currentHigh) onUpdate(currentLow, newHigh)
|
|
359
|
+
}
|
|
360
|
+
}
|