@momo-kits/native-kits 0.163.1-beta.2-debug → 0.163.1-beta.20-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/settings.local.json +112 -0
- package/CLAUDE.md +1 -1
- package/compose/build.gradle.kts +2 -1
- package/compose/build.gradle.kts.backup +1 -0
- package/compose/compose.podspec +1 -1
- 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 +30 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +8 -10
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +2 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +3 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +56 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +11 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +40 -55
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +69 -26
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +5 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +3 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +21 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +3 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +19 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +22 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +28 -21
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +50 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +25 -22
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +37 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +68 -22
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +7 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +112 -115
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +15 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +33 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +6 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +3 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +2 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +23 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +9 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +11 -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 +26 -3
- package/gradle/libs.versions.toml +2 -0
- package/gradle.properties +1 -1
- package/ios/Application/ApplicationEnvironment.swift +15 -3
- package/ios/Application/Components.swift +36 -30
- package/ios/Application/FloatingButton.swift +10 -9
- package/ios/Application/Localize.swift +309 -0
- package/ios/Application/MaxApi.swift +18 -0
- package/ios/Application/Navigation/BottomTab/BottomTab.swift +104 -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 +203 -0
- package/ios/Application/Navigation/NavigationOptions.swift +109 -0
- package/ios/Application/Navigation/Navigator.swift +385 -0
- package/ios/Application/Navigation/Overplay/BottomSheet.swift +256 -0
- package/ios/Application/Navigation/Overplay/ModalScreen.swift +74 -0
- package/ios/Application/Navigation/Overplay/SnackBar.swift +144 -0
- package/ios/Application/Navigation/Tracking/ScreenTracker.swift +117 -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/Navigation/component/HeaderRightWidthKey.swift +11 -0
- package/ios/Application/Navigation/component/NavigationHeaderRight.swift +196 -0
- package/ios/Application/Screen.swift +2 -1
- package/ios/Application/StackScreen.swift +501 -0
- package/ios/Avatar/Avatar.swift +193 -0
- package/ios/Badge/Badge.swift +11 -14
- package/ios/Badge/BadgeRibbon.swift +91 -17
- package/ios/BaselineView/BaselineView.swift +163 -0
- package/ios/Button/Button.swift +137 -28
- package/ios/Carousel/Carousel.swift +196 -0
- package/ios/Checkbox/Checkbox.swift +23 -28
- package/ios/Chip/Chip.swift +56 -33
- package/ios/Collapse/Collapse.swift +192 -0
- package/ios/Colors+Radius+Spacing/Colors.swift +20 -17
- package/ios/Colors+Radius+Spacing/Spacing.swift +3 -1
- package/ios/Colors+Radius+Spacing/Theme.swift +295 -0
- package/ios/DateTimePicker/DateTimePicker.swift +212 -0
- package/ios/DateTimePicker/DateTimePickerTypes.swift +55 -0
- package/ios/DateTimePicker/DateTimePickerUtils.swift +167 -0
- package/ios/DateTimePicker/WheelPicker.swift +165 -0
- package/ios/Divider/Divider.swift +16 -0
- package/ios/Extensions/ActiveOpacityButtonStyle.swift +14 -0
- package/ios/Extensions/Color++.swift +32 -0
- package/ios/Icon/Icon.swift +10 -1
- package/ios/IconButton/IconButton.swift +140 -0
- package/ios/Image/Image.swift +16 -3
- package/ios/Information/Information.swift +3 -1
- package/ios/Input/ErrorView.swift +3 -1
- package/ios/Input/Input.swift +72 -33
- package/ios/Input/InputPhoneNumber.swift +33 -21
- package/ios/Input/InputSearch.swift +107 -48
- package/ios/Input/InputTextArea.swift +134 -64
- package/ios/InputDropDown/InputDropDown.swift +201 -0
- package/ios/InputMoney/InputMoney.swift +347 -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 +11 -20
- package/ios/Popup/PopupInput.swift +2 -8
- package/ios/Popup/PopupNotify.swift +218 -0
- package/ios/Popup/PopupPromotion.swift +5 -3
- package/ios/ProgressInfo/ProgressInfo.swift +296 -0
- package/ios/Radio/Radio.swift +69 -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 +467 -0
- package/ios/SuggestAction/SuggestAction.swift +99 -0
- package/ios/Swipeable/SwipeCell.swift +187 -0
- package/ios/Swipeable/SwipeCellModel.swift +21 -0
- package/ios/Switch/Switch.swift +53 -28
- package/ios/TabView/TabView.swift +534 -0
- package/ios/Tag/Tag.swift +98 -0
- package/ios/Template/TrustBanner/TrustBanner.swift +7 -8
- package/ios/Title/Title.swift +269 -0
- package/ios/Tooltip/Tooltip.swift +485 -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 +174 -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 +64 -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 +279 -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/LocalizeDemo.swift +188 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +229 -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 +2 -2
- package/package.json +1 -1
- package/publish.sh +53 -0
- package/scripts/gen-ios-color.mjs +136 -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
|
@@ -23,12 +23,14 @@ import androidx.navigation.compose.currentBackStackEntryAsState
|
|
|
23
23
|
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
24
24
|
import vn.momo.kits.components.*
|
|
25
25
|
import vn.momo.kits.const.*
|
|
26
|
+
import vn.momo.kits.modifier.InternalApi
|
|
26
27
|
import vn.momo.kits.modifier.conditional
|
|
27
28
|
import vn.momo.kits.modifier.noFeedbackClickable
|
|
28
29
|
import vn.momo.kits.platform.getScreenDimensions
|
|
29
30
|
|
|
30
31
|
internal val floatingButtonWidth = 75.dp
|
|
31
|
-
|
|
32
|
+
@InternalApi
|
|
33
|
+
const val BOTTOM_TAB_BAR_HEIGHT = 64
|
|
32
34
|
|
|
33
35
|
@Composable
|
|
34
36
|
internal fun BottomTabBar(
|
|
@@ -44,7 +44,8 @@ import vn.momo.kits.navigation.LocalOptions
|
|
|
44
44
|
import vn.momo.kits.navigation.LocalScrollState
|
|
45
45
|
import vn.momo.kits.navigation.getInputSearchType
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
@InternalApi
|
|
48
|
+
const val HEADER_HEIGHT = 52
|
|
48
49
|
internal enum class InputSearchType { None, Header, Animated }
|
|
49
50
|
enum class TitlePosition { LEFT, CENTER }
|
|
50
51
|
|
|
@@ -31,7 +31,6 @@ object ScreenTracker {
|
|
|
31
31
|
val previousScreen = lastScreenName
|
|
32
32
|
lastScreenName = screenName
|
|
33
33
|
|
|
34
|
-
println("Tracking screen navigated native kit: $screenName")
|
|
35
34
|
maxApi?.track(
|
|
36
35
|
eventName = "auto_screen_navigated",
|
|
37
36
|
params = buildBaseParams(context, screenName).apply {
|
|
@@ -5,10 +5,12 @@ import androidx.compose.foundation.background
|
|
|
5
5
|
import androidx.compose.foundation.layout.Box
|
|
6
6
|
import androidx.compose.foundation.layout.fillMaxSize
|
|
7
7
|
import androidx.compose.runtime.Composable
|
|
8
|
+
import androidx.compose.runtime.LaunchedEffect
|
|
8
9
|
import androidx.compose.runtime.getValue
|
|
10
|
+
import androidx.compose.runtime.rememberUpdatedState
|
|
11
|
+
import androidx.compose.runtime.snapshotFlow
|
|
9
12
|
import androidx.compose.ui.Modifier
|
|
10
13
|
import androidx.compose.ui.graphics.Color
|
|
11
|
-
import io.github.alexzhirkevich.compottie.Compottie
|
|
12
14
|
import io.github.alexzhirkevich.compottie.ExperimentalCompottieApi
|
|
13
15
|
import io.github.alexzhirkevich.compottie.LottieCompositionSpec
|
|
14
16
|
import io.github.alexzhirkevich.compottie.animateLottieCompositionAsState
|
|
@@ -23,6 +25,9 @@ internal fun ComposeLottieAnimation(
|
|
|
23
25
|
path: String,
|
|
24
26
|
tintColor: Color?,
|
|
25
27
|
bgColor: Color?,
|
|
28
|
+
iterations: Int,
|
|
29
|
+
isPlaying: Boolean,
|
|
30
|
+
onEvent: ((String) -> Unit)?,
|
|
26
31
|
modifier: Modifier,
|
|
27
32
|
) {
|
|
28
33
|
val json = readJson(path)
|
|
@@ -49,9 +54,25 @@ internal fun ComposeLottieAnimation(
|
|
|
49
54
|
|
|
50
55
|
val lottieState = animateLottieCompositionAsState(
|
|
51
56
|
composition = composition,
|
|
52
|
-
iterations =
|
|
57
|
+
iterations = iterations,
|
|
58
|
+
isPlaying = isPlaying,
|
|
59
|
+
restartOnPlay = false,
|
|
53
60
|
)
|
|
54
61
|
|
|
62
|
+
val currentOnEvent by rememberUpdatedState(onEvent)
|
|
63
|
+
|
|
64
|
+
LaunchedEffect(isPlaying) {
|
|
65
|
+
currentOnEvent?.invoke(if (isPlaying) LottieEvent.Start else LottieEvent.Pause)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
LaunchedEffect(lottieState) {
|
|
69
|
+
var armed = false
|
|
70
|
+
snapshotFlow { lottieState.isAtEnd }.collect { atEnd ->
|
|
71
|
+
if (!atEnd) armed = true
|
|
72
|
+
else if (armed) { armed = false; currentOnEvent?.invoke(LottieEvent.Finish) }
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
55
76
|
Box(modifier.background(bgColor ?: Color.Transparent)) {
|
|
56
77
|
Image(
|
|
57
78
|
painter = rememberLottiePainter(
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
package vn.momo.kits.platform
|
|
2
|
+
|
|
3
|
+
import androidx.compose.runtime.Composable
|
|
4
|
+
|
|
5
|
+
// Overrides LocalDensity.fontScale with the live OS Dynamic Type scale so text re-scales while a
|
|
6
|
+
// screen is visible. Wrapped inside the containers so every screen is covered, not just callers of
|
|
7
|
+
// the app-level wrappers.
|
|
8
|
+
@Composable
|
|
9
|
+
expect fun ProvideOsFontScale(content: @Composable () -> Unit)
|
|
@@ -43,12 +43,23 @@ fun supportsImePadding(): Boolean = when (val v = getOSVersion()) {
|
|
|
43
43
|
is OSVersion.Android -> v.sdk > 29
|
|
44
44
|
is OSVersion.IOS -> true
|
|
45
45
|
}
|
|
46
|
+
const val LottieIterateForever: Int = Int.MAX_VALUE
|
|
47
|
+
|
|
48
|
+
object LottieEvent {
|
|
49
|
+
const val Start = "start"
|
|
50
|
+
const val Pause = "pause"
|
|
51
|
+
const val Finish = "finish"
|
|
52
|
+
}
|
|
53
|
+
|
|
46
54
|
@Composable
|
|
47
55
|
expect fun LottieAnimation(
|
|
48
56
|
path: String,
|
|
49
57
|
tintColor: Color? = null,
|
|
50
58
|
bgColor: Color? = null,
|
|
51
59
|
placedAsOverlay: Boolean = false,
|
|
60
|
+
iterations: Int = LottieIterateForever,
|
|
61
|
+
isPlaying: Boolean = true,
|
|
62
|
+
onEvent: ((String) -> Unit)? = null,
|
|
52
63
|
modifier: Modifier = Modifier,
|
|
53
64
|
useCompose: Boolean = false
|
|
54
65
|
)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
package vn.momo.kits.platform
|
|
2
|
+
|
|
3
|
+
import androidx.compose.runtime.Composable
|
|
4
|
+
import androidx.compose.runtime.CompositionLocalProvider
|
|
5
|
+
import androidx.compose.runtime.DisposableEffect
|
|
6
|
+
import androidx.compose.runtime.mutableStateOf
|
|
7
|
+
import androidx.compose.runtime.remember
|
|
8
|
+
import androidx.compose.ui.platform.LocalDensity
|
|
9
|
+
import androidx.compose.ui.unit.Density
|
|
10
|
+
import kotlinx.cinterop.ExperimentalForeignApi
|
|
11
|
+
import kotlinx.cinterop.ObjCAction
|
|
12
|
+
import platform.Foundation.NSNotification
|
|
13
|
+
import platform.Foundation.NSNotificationCenter
|
|
14
|
+
import platform.Foundation.NSSelectorFromString
|
|
15
|
+
import platform.UIKit.UIContentSizeCategoryDidChangeNotification
|
|
16
|
+
import platform.UIKit.UIFont
|
|
17
|
+
import platform.UIKit.UIFontTextStyleBody
|
|
18
|
+
import platform.darwin.NSObject
|
|
19
|
+
|
|
20
|
+
// Compose MP iOS reads LocalDensity.fontScale once at ComposeUIViewController creation and does not
|
|
21
|
+
// recompose it when UIContentSizeCategory changes (Android tracks Configuration.fontScale live). We
|
|
22
|
+
// observe the notification and override LocalDensity.fontScale so scaleSize() recomposes live. The
|
|
23
|
+
// formula matches the SwiftUI kit (UIFont body point size / 17) so both iOS surfaces scale alike.
|
|
24
|
+
private const val DEFAULT_BODY_POINT_SIZE = 17.0
|
|
25
|
+
|
|
26
|
+
private fun currentOsFontScale(): Float =
|
|
27
|
+
(UIFont.preferredFontForTextStyle(UIFontTextStyleBody).pointSize / DEFAULT_BODY_POINT_SIZE).toFloat()
|
|
28
|
+
|
|
29
|
+
@OptIn(ExperimentalForeignApi::class)
|
|
30
|
+
@Composable
|
|
31
|
+
actual fun ProvideOsFontScale(content: @Composable () -> Unit) {
|
|
32
|
+
val osFontScale = remember { mutableStateOf(currentOsFontScale()) }
|
|
33
|
+
|
|
34
|
+
val listener = remember {
|
|
35
|
+
object : NSObject() {
|
|
36
|
+
@Suppress("unused")
|
|
37
|
+
@ObjCAction
|
|
38
|
+
fun contentSizeChanged(arg: NSNotification) {
|
|
39
|
+
osFontScale.value = currentOsFontScale()
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
DisposableEffect(Unit) {
|
|
45
|
+
NSNotificationCenter.defaultCenter.addObserver(
|
|
46
|
+
observer = listener,
|
|
47
|
+
selector = NSSelectorFromString(listener::contentSizeChanged.name + ":"),
|
|
48
|
+
name = UIContentSizeCategoryDidChangeNotification,
|
|
49
|
+
`object` = null,
|
|
50
|
+
)
|
|
51
|
+
onDispose {
|
|
52
|
+
NSNotificationCenter.defaultCenter.removeObserver(
|
|
53
|
+
observer = listener,
|
|
54
|
+
name = UIContentSizeCategoryDidChangeNotification,
|
|
55
|
+
`object` = null,
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
val density = LocalDensity.current
|
|
61
|
+
CompositionLocalProvider(
|
|
62
|
+
LocalDensity provides Density(density.density, osFontScale.value),
|
|
63
|
+
) {
|
|
64
|
+
content()
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -11,6 +11,7 @@ import androidx.compose.runtime.LaunchedEffect
|
|
|
11
11
|
import androidx.compose.runtime.getValue
|
|
12
12
|
import androidx.compose.runtime.mutableStateOf
|
|
13
13
|
import androidx.compose.runtime.remember
|
|
14
|
+
import androidx.compose.runtime.rememberUpdatedState
|
|
14
15
|
import androidx.compose.runtime.setValue
|
|
15
16
|
import androidx.compose.ui.ExperimentalComposeUiApi
|
|
16
17
|
import androidx.compose.ui.InternalComposeUiApi
|
|
@@ -96,20 +97,41 @@ actual fun LottieAnimation(
|
|
|
96
97
|
tintColor: Color?,
|
|
97
98
|
bgColor: Color?,
|
|
98
99
|
placedAsOverlay: Boolean,
|
|
100
|
+
iterations: Int,
|
|
101
|
+
isPlaying: Boolean,
|
|
102
|
+
onEvent: ((String) -> Unit)?,
|
|
99
103
|
modifier: Modifier,
|
|
100
104
|
useCompose: Boolean
|
|
101
105
|
) {
|
|
102
106
|
if (useCompose) {
|
|
103
|
-
ComposeLottieAnimation(path, tintColor, bgColor, modifier)
|
|
107
|
+
ComposeLottieAnimation(path, tintColor, bgColor, iterations, isPlaying, onEvent, modifier)
|
|
104
108
|
return
|
|
105
109
|
}
|
|
106
110
|
|
|
111
|
+
val loopCount = if (iterations == LottieIterateForever) -1.0 else iterations.toDouble()
|
|
112
|
+
|
|
107
113
|
var animation by remember { mutableStateOf<CompatibleAnimation?>(null) }
|
|
114
|
+
val animationView = remember { mutableStateOf<CompatibleAnimationView?>(null) }
|
|
108
115
|
|
|
109
116
|
LaunchedEffect(Unit) {
|
|
110
117
|
animation = CompatibleAnimation(name = "compose-resources/composeResources/vn.momo.compose.resources/".plus(path), subdirectory = null, NSBundle.mainBundle)
|
|
111
118
|
}
|
|
112
119
|
|
|
120
|
+
val currentOnEvent by rememberUpdatedState(onEvent)
|
|
121
|
+
|
|
122
|
+
LaunchedEffect(isPlaying) {
|
|
123
|
+
currentOnEvent?.invoke(if (isPlaying) LottieEvent.Start else LottieEvent.Pause)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
LaunchedEffect(animationView.value, isPlaying) {
|
|
127
|
+
val view = animationView.value ?: return@LaunchedEffect
|
|
128
|
+
if (isPlaying) {
|
|
129
|
+
view.playWithCompletion(completion = { finished -> if (finished) currentOnEvent?.invoke(LottieEvent.Finish) })
|
|
130
|
+
} else {
|
|
131
|
+
view.pause()
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
113
135
|
when (val value = animation) {
|
|
114
136
|
null -> {
|
|
115
137
|
Box(modifier)
|
|
@@ -126,7 +148,7 @@ actual fun LottieAnimation(
|
|
|
126
148
|
|
|
127
149
|
setBackgroundColor(bgColor?.toUIColor() ?: UIColor.clearColor)
|
|
128
150
|
|
|
129
|
-
setLoopAnimationCount(
|
|
151
|
+
setLoopAnimationCount(loopCount)
|
|
130
152
|
setAnimationSpeed(1.0)
|
|
131
153
|
|
|
132
154
|
if (tintColor != null) {
|
|
@@ -140,12 +162,13 @@ actual fun LottieAnimation(
|
|
|
140
162
|
setColorValue(uiColor, CompatibleAnimationKeypath("**.Stroke.Color"))
|
|
141
163
|
}
|
|
142
164
|
|
|
143
|
-
|
|
165
|
+
animationView.value = this
|
|
144
166
|
}
|
|
145
167
|
},
|
|
146
168
|
|
|
147
169
|
update = { view ->
|
|
148
170
|
view.setBackgroundColor(bgColor?.toUIColor() ?: UIColor.clearColor)
|
|
171
|
+
view.setLoopAnimationCount(loopCount)
|
|
149
172
|
|
|
150
173
|
if (tintColor != null) {
|
|
151
174
|
val uiColor = tintColor.toUIColor()
|
|
@@ -21,6 +21,7 @@ maxapi = "0.1.1"
|
|
|
21
21
|
vanniktechMavenPublish = "0.34.0"
|
|
22
22
|
kits = "0.159.1-beta.7"
|
|
23
23
|
nativemaxapi = "0.0.6"
|
|
24
|
+
gif-image = "0.1.2"
|
|
24
25
|
|
|
25
26
|
[libraries]
|
|
26
27
|
ktor-client-core = { group = "io.ktor", name = "ktor-client-core", version.ref = "ktor-version" }
|
|
@@ -53,6 +54,7 @@ androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "a
|
|
|
53
54
|
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity" }
|
|
54
55
|
material = { module = "com.google.android.material:material", version.ref = "material" }
|
|
55
56
|
|
|
57
|
+
gif-image = { module = "vn.momo.kits:gif-image", version.ref = "gif-image" }
|
|
56
58
|
[plugins]
|
|
57
59
|
jetbrains-kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
|
58
60
|
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
package/gradle.properties
CHANGED
|
@@ -41,11 +41,23 @@ public class ApplicationEnvironment: ObservableObject {
|
|
|
41
41
|
let applicationContext: MiniAppContext?
|
|
42
42
|
let composeApi: KitComposeApi?
|
|
43
43
|
let config: KitConfig?
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
let maxApi: MaxApi?
|
|
45
|
+
|
|
46
|
+
public init(applicationContext: MiniAppContext? = nil, composeApi: KitComposeApi? = nil, config: KitConfig? = nil, maxApi: MaxApi? = nil) {
|
|
46
47
|
self.applicationContext = applicationContext
|
|
47
48
|
self.composeApi = composeApi
|
|
48
49
|
self.config = config
|
|
49
|
-
|
|
50
|
+
self.maxApi = maxApi
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private struct ApplicationEnvironmentKey: EnvironmentKey {
|
|
55
|
+
static let defaultValue = ApplicationEnvironment()
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public extension EnvironmentValues {
|
|
59
|
+
var applicationEnvironment: ApplicationEnvironment {
|
|
60
|
+
get { self[ApplicationEnvironmentKey.self] }
|
|
61
|
+
set { self[ApplicationEnvironmentKey.self] = newValue }
|
|
50
62
|
}
|
|
51
63
|
}
|
|
@@ -83,9 +83,8 @@ public struct HeaderBackground: View {
|
|
|
83
83
|
self.headerTransparent = headerTransparent
|
|
84
84
|
self.fullScreenContent = fullScreenContent
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
|
|
87
87
|
public var body: some View {
|
|
88
|
-
|
|
89
88
|
let statusBarHeight = safeAreaTopInset()
|
|
90
89
|
let opacity = max(0, 1 - scrollState / 200)
|
|
91
90
|
let height = fullScreenContent ? 0 : statusBarHeight + 52
|
|
@@ -115,7 +114,6 @@ public struct HeaderBackground: View {
|
|
|
115
114
|
.opacity(opacity)
|
|
116
115
|
.frame(height: height))
|
|
117
116
|
)
|
|
118
|
-
|
|
119
117
|
if !headerTransparent {
|
|
120
118
|
Rectangle()
|
|
121
119
|
.fill(Color.black.opacity(0.1))
|
|
@@ -148,12 +146,31 @@ public struct HeaderBackground: View {
|
|
|
148
146
|
}
|
|
149
147
|
}
|
|
150
148
|
|
|
149
|
+
// MARK: - Bottom-tab root preference
|
|
150
|
+
|
|
151
|
+
/// Set by `BottomTab` on appear so its enclosing `StackScreen` can detect that
|
|
152
|
+
/// it's hosting a self-contained bottom-tab surface and skip its own bottom
|
|
153
|
+
/// safe-area reservation — mirrors Compose's `Navigation.markAsBottomTabRoot()`
|
|
154
|
+
/// (`navigation.isBottomTabRoot`, read by `StackScreen.kt`'s `MainContent`).
|
|
155
|
+
/// Without this, `BottomTab`'s own internal safe-area handling gets an extra,
|
|
156
|
+
/// unwanted inset stacked on top of it by the outer `StackScreen`, pushing the
|
|
157
|
+
/// tab bar up higher than the true bottom inset.
|
|
158
|
+
public struct IsBottomTabRootKey: PreferenceKey {
|
|
159
|
+
public static var defaultValue: Bool = false
|
|
160
|
+
public static func reduce(value: inout Bool, nextValue: () -> Bool) {
|
|
161
|
+
value = value || nextValue()
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
151
165
|
// MARK: - Header View
|
|
152
166
|
|
|
153
167
|
public struct Header: View {
|
|
154
168
|
var headerType: HeaderType = .default
|
|
155
169
|
var titlePosition: TitlePosition
|
|
156
170
|
var title: String
|
|
171
|
+
/// Optional rich title (mirrors Compose's `HeaderTitle`); `.user` renders an
|
|
172
|
+
/// avatar group instead of `title`. Defaults to nil → plain `title` text.
|
|
173
|
+
var headerTitle: HeaderTitle?
|
|
157
174
|
var headerRight: (()->any View)? = {HeaderRight()}
|
|
158
175
|
var goBack: (() -> Void)?
|
|
159
176
|
var opacity: CGFloat = 1
|
|
@@ -161,22 +178,27 @@ public struct Header: View {
|
|
|
161
178
|
var scrollState: CGFloat = 0
|
|
162
179
|
var inputSearchProps: InputSearchProps?
|
|
163
180
|
var tintColor: Color?
|
|
181
|
+
/// Title opacity; used by the animated search header to fade the title out on scroll.
|
|
182
|
+
var titleOpacity: CGFloat = 1
|
|
164
183
|
|
|
165
184
|
public init(
|
|
166
185
|
headerType: HeaderType = .default,
|
|
167
186
|
titlePosition: TitlePosition,
|
|
168
187
|
title: String,
|
|
188
|
+
headerTitle: HeaderTitle? = nil,
|
|
169
189
|
headerRight: (()->any View)? = {HeaderRight()},
|
|
170
190
|
goBack: (() -> Void)? = nil,
|
|
171
191
|
opacity: CGFloat = 1,
|
|
172
192
|
animatedHeader: AnimatedHeader? = nil,
|
|
173
193
|
scrollState: CGFloat = 0,
|
|
174
194
|
inputSearchProps: InputSearchProps? = nil,
|
|
175
|
-
tintColor: Color? = nil
|
|
195
|
+
tintColor: Color? = nil,
|
|
196
|
+
titleOpacity: CGFloat = 1
|
|
176
197
|
) {
|
|
177
198
|
self.headerType = headerType
|
|
178
199
|
self.titlePosition = titlePosition
|
|
179
200
|
self.title = title
|
|
201
|
+
self.headerTitle = headerTitle
|
|
180
202
|
self.headerRight = headerRight
|
|
181
203
|
self.goBack = goBack
|
|
182
204
|
self.opacity = opacity
|
|
@@ -184,10 +206,11 @@ public struct Header: View {
|
|
|
184
206
|
self.scrollState = scrollState
|
|
185
207
|
self.inputSearchProps = inputSearchProps
|
|
186
208
|
self.tintColor = tintColor
|
|
209
|
+
self.titleOpacity = titleOpacity
|
|
187
210
|
}
|
|
188
|
-
|
|
211
|
+
|
|
189
212
|
public var body: some View {
|
|
190
|
-
|
|
213
|
+
|
|
191
214
|
let backgroundButtonColor: Color = tintColor == Colors.black01 ? Colors.black20.opacity(0.6) : Colors.black01.opacity(0.6)
|
|
192
215
|
let borderColor: Color = tintColor == Colors.black01 ? Colors.black01.opacity(0.2) : Colors.black20.opacity(0.2)
|
|
193
216
|
|
|
@@ -223,33 +246,16 @@ public struct Header: View {
|
|
|
223
246
|
}
|
|
224
247
|
|
|
225
248
|
if let inputProps = inputSearchProps {
|
|
226
|
-
InputSearch(
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
placeholder: inputProps.placeholder,
|
|
232
|
-
onChangeText: inputProps.onChangeText,
|
|
233
|
-
onPressButtonText: inputProps.onPressButtonText,
|
|
234
|
-
error: inputProps.error,
|
|
235
|
-
disabled: inputProps.disabled,
|
|
236
|
-
icon: inputProps.icon,
|
|
237
|
-
iconColor: inputProps.iconColor,
|
|
238
|
-
onRightIconPressed: inputProps.onRightIconPressed,
|
|
239
|
-
onFocus: inputProps.onFocus,
|
|
240
|
-
onBlur: inputProps.onBlur,
|
|
241
|
-
loading: inputProps.loading,
|
|
242
|
-
fontWeight: inputProps.fontWeight,
|
|
243
|
-
keyboardType: inputProps.keyboardType
|
|
244
|
-
)
|
|
249
|
+
InputSearch(props: inputProps)
|
|
250
|
+
} else if case let .user(userData)? = headerTitle {
|
|
251
|
+
if #available(iOS 16.0, *) {
|
|
252
|
+
HeaderUserView(userData)
|
|
253
|
+
}
|
|
245
254
|
} else {
|
|
246
|
-
|
|
247
|
-
.
|
|
248
|
-
.ignoreBoldTextSetting()
|
|
249
|
-
.foregroundColor(tintColor ?? Colors.black17)
|
|
255
|
+
MomoText(headerTitle?.defaultTitle ?? title, typography: .headerDefaultBold, color: tintColor ?? Colors.black17, maxLines: 1)
|
|
256
|
+
.opacity(titleOpacity)
|
|
250
257
|
.frame(maxWidth: titlePosition == .center ? UIScreen.main.bounds.width - 252 : nil)
|
|
251
258
|
.frame(maxWidth: titlePosition == .center ? .infinity : UIScreen.main.bounds.width - 172, alignment: titlePosition == .center ? .center : .leading)
|
|
252
|
-
.lineLimit(1)
|
|
253
259
|
}
|
|
254
260
|
|
|
255
261
|
Spacer()
|
|
@@ -3,11 +3,16 @@ import Combine
|
|
|
3
3
|
|
|
4
4
|
public enum FABSize {
|
|
5
5
|
case small
|
|
6
|
+
case `default`
|
|
7
|
+
/// Backward-compatible alias for older iOS call sites. Compose names this
|
|
8
|
+
/// size `DEFAULT`.
|
|
6
9
|
case large
|
|
7
|
-
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
public enum FABPosition {
|
|
13
|
+
case end
|
|
14
|
+
/// Backward-compatible alias for older iOS call sites. Compose names this
|
|
15
|
+
/// position `END`.
|
|
11
16
|
case right
|
|
12
17
|
case center
|
|
13
18
|
}
|
|
@@ -31,10 +36,10 @@ public struct FabProps {
|
|
|
31
36
|
label: String? = nil,
|
|
32
37
|
onClick: (() -> Void)? = nil,
|
|
33
38
|
containerColor: Color? = Colors.primary,
|
|
34
|
-
size: FABSize? = .
|
|
39
|
+
size: FABSize? = .default,
|
|
35
40
|
iconSize: CGFloat? = nil,
|
|
36
41
|
scrollOffset: CGFloat? = nil,
|
|
37
|
-
position: FABPosition? = .
|
|
42
|
+
position: FABPosition? = .end,
|
|
38
43
|
bottomPadding: CGFloat? = nil,
|
|
39
44
|
renderComponent: (() -> AnyView)? = nil
|
|
40
45
|
) {
|
|
@@ -65,7 +70,7 @@ public struct FloatingButton: View {
|
|
|
65
70
|
private var keyboardOffset: CGFloat
|
|
66
71
|
private var scrollOffset: CGFloat
|
|
67
72
|
private var bottomPadding: CGFloat { props.bottomPadding ?? 12 + keyboardOffset}
|
|
68
|
-
private var position: FABPosition? { props.position ?? .
|
|
73
|
+
private var position: FABPosition? { props.position ?? .end }
|
|
69
74
|
private var containerColor: Color? { props.containerColor ?? Colors.primary }
|
|
70
75
|
private var iconColor: Color? { props.iconColor ?? .white }
|
|
71
76
|
private var label: String? { props.label }
|
|
@@ -152,11 +157,7 @@ public struct FloatingButton: View {
|
|
|
152
157
|
if let label = label {
|
|
153
158
|
if showText {
|
|
154
159
|
Spacer().frame(width: 8)
|
|
155
|
-
|
|
156
|
-
.foregroundColor(.white)
|
|
157
|
-
.font(.system(size: scaleSize(16), weight: .bold))
|
|
158
|
-
.ignoreBoldTextSetting()
|
|
159
|
-
.lineLimit(1)
|
|
160
|
+
MomoText(label, typography: .actionDefaultBold, color: .white, maxLines: 1)
|
|
160
161
|
.background(
|
|
161
162
|
GeometryReader { geo in
|
|
162
163
|
Color.clear.onAppear {
|