@momo-kits/native-kits 0.167.1-duo.8-debug → 0.167.1-duo.9
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 +4 -1
- package/ios/Application/ApplicationEnvironment.swift +11 -0
- package/ios/Application/ComposeApi.swift +2 -1
- package/ios/Application/{Components.swift → LegacyHeader.swift} +6 -62
- package/ios/Application/Screen.swift +3 -2
- package/ios/Avatar/Avatar.swift +4 -3
- package/ios/Badge/Badge.swift +6 -4
- package/ios/Badge/BadgeDot.swift +1 -1
- package/ios/Badge/BadgeRibbon.swift +0 -1
- package/ios/Button/Button.swift +15 -12
- package/ios/CalculatorKeyboard/CalculatorKeyboard.swift +12 -20
- package/ios/Carousel/Carousel.swift +29 -12
- package/ios/Checkbox/Checkbox.swift +7 -3
- package/ios/Chip/Chip.swift +5 -4
- package/ios/Collapse/Collapse.swift +70 -19
- package/ios/Colors+Radius+Spacing/Colors.swift +9 -0
- package/ios/DateTimePicker/DateTimePicker.swift +54 -20
- package/ios/DateTimePicker/WheelPicker.swift +103 -105
- package/ios/Divider/Divider.swift +37 -4
- package/ios/Extensions/Color++.swift +18 -0
- package/ios/Icon/Icon.swift +7 -1
- package/ios/IconButton/IconButton.swift +15 -7
- package/ios/Image/Image.swift +7 -34
- package/ios/Information/Information.swift +27 -9
- package/ios/Input/ErrorView.swift +2 -2
- package/ios/Input/Input.swift +160 -147
- package/ios/Input/InputPhoneNumber.swift +12 -9
- package/ios/Input/InputSearch.swift +102 -75
- package/ios/Input/InputTextArea.swift +128 -145
- package/ios/InputDropDown/InputDropDown.swift +10 -7
- package/ios/InputMoney/InputMoney.swift +33 -11
- package/ios/InputOTP/InputOTP.swift +22 -12
- package/ios/Layout/Card.swift +50 -0
- package/ios/Layout/GridContext.swift +123 -3
- package/ios/Layout/Item.swift +5 -4
- package/ios/Layout/Section.swift +4 -100
- package/ios/Loader/Loader.swift +5 -9
- package/ios/Lottie/LottieView.swift +10 -0
- package/ios/{Application/Navigation/Overplay → Navigation}/BottomSheet.swift +61 -9
- package/ios/{Application/Navigation → Navigation}/BottomTab/BottomTab.swift +60 -34
- package/ios/{Application/Navigation → Navigation}/BottomTab/BottomTabBar.swift +11 -6
- package/ios/{Application → Navigation/Component}/FloatingButton.swift +14 -3
- package/ios/Navigation/Component/Header.swift +493 -0
- package/ios/Navigation/Component/HeaderBackground.swift +134 -0
- package/ios/Navigation/Component/HeaderJourney.swift +73 -0
- package/ios/Navigation/Component/HeaderLocation.swift +48 -0
- package/ios/Navigation/Component/HeaderRight.swift +386 -0
- package/ios/Navigation/Component/HeaderTitle.swift +36 -0
- package/ios/{Application/Navigation → Navigation/Component}/HeaderUser.swift +20 -23
- package/ios/{Application/Navigation/component → Navigation/Component}/SideBar.swift +49 -28
- package/ios/{Application/Navigation/Overplay → Navigation/Component}/SnackBar.swift +5 -5
- package/ios/Navigation/HostBackGestureBridge.swift +57 -0
- package/ios/Navigation/Navigation.swift +190 -0
- package/ios/{Application/Navigation → Navigation}/NavigationContainer.swift +46 -41
- package/ios/{Application/Navigation → Navigation}/Navigator.swift +65 -9
- package/ios/{Application → Navigation}/StackScreen.swift +236 -103
- package/ios/{Application/Navigation → Navigation}/Tracking/ScreenTracker.swift +12 -5
- package/ios/OTPKeyboard/OTPKeyboard.swift +8 -11
- package/ios/Pagination/PaginationScroll.swift +2 -2
- package/ios/Popup/PopupDisplay.swift +79 -159
- package/ios/Popup/PopupInput.swift +10 -13
- package/ios/Popup/PopupLayout.swift +97 -2
- package/ios/Popup/PopupNotify.swift +27 -55
- package/ios/Popup/PopupPromotion.swift +22 -50
- package/ios/PopupView/FullscreenPopup.swift +13 -19
- package/ios/PopupView/PopupView.swift +1 -1
- package/ios/PopupView/Utils++.swift +0 -8
- package/ios/ProgressInfo/ProgressInfo.swift +4 -2
- package/ios/Radio/Radio.swift +2 -1
- package/ios/Rating/Rating.swift +9 -1
- package/ios/ScrollIndicator/ScrollIndicator.swift +11 -10
- package/ios/Skeleton/Skeleton.swift +22 -27
- package/ios/Slider/Slider.swift +16 -18
- package/ios/Stepper/Stepper.swift +6 -1
- package/ios/Steps/Steps.swift +8 -6
- package/ios/SuggestAction/SuggestAction.swift +5 -0
- package/ios/Swipeable/SwipeCell.swift +10 -6
- package/ios/Switch/Switch.swift +22 -20
- package/ios/TabView/TabView.swift +102 -21
- package/ios/Tag/Tag.swift +15 -4
- package/ios/Template/Logo/Logo.swift +2 -1
- package/ios/Template/TrustBanner/TrustBanner.swift +41 -27
- package/ios/Title/Title.swift +6 -17
- package/ios/Tooltip/Tooltip.swift +29 -14
- package/ios/Typography/Text.swift +61 -19
- package/ios/Uploader/Uploader.swift +3 -1
- package/ios/native-kits.podspec +1 -0
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/ContentView.swift +1 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/NavigationDemo.swift +77 -1
- package/package.json +1 -1
- package/build.gradle.kts +0 -11
- package/compose/build.gradle.kts +0 -204
- package/compose/build.gradle.kts.backup +0 -204
- package/compose/compose.podspec +0 -47
- package/compose/src/androidMain/kotlin/vn/momo/kits/const/HostFont.android.kt +0 -19
- package/compose/src/androidMain/kotlin/vn/momo/kits/navigation/ScrollToTop.android.kt +0 -6
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/BackGesture.android.kt +0 -12
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +0 -7
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +0 -153
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/ReservedRegions.android.kt +0 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +0 -52
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +0 -124
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +0 -183
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +0 -207
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +0 -39
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +0 -86
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +0 -76
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +0 -76
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +0 -293
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +0 -33
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +0 -831
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +0 -269
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +0 -110
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +0 -378
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/WidgetContainer.kt +0 -56
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +0 -69
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Avatar.kt +0 -157
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +0 -82
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +0 -32
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +0 -338
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +0 -175
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +0 -356
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +0 -113
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -89
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +0 -128
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +0 -209
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +0 -542
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +0 -49
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +0 -76
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +0 -125
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +0 -231
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +0 -189
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +0 -475
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +0 -114
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +0 -266
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +0 -240
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +0 -223
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +0 -264
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +0 -185
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +0 -343
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Loader.kt +0 -108
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +0 -56
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +0 -41
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +0 -84
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +0 -40
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +0 -361
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +0 -108
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -310
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +0 -59
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Rating.kt +0 -87
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +0 -21
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +0 -90
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +0 -323
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +0 -220
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +0 -473
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +0 -122
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +0 -199
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +0 -91
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +0 -552
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +0 -88
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +0 -125
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +0 -207
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +0 -498
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +0 -176
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +0 -182
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +0 -193
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +0 -29
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +0 -234
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +0 -188
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +0 -325
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/HostFont.kt +0 -16
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitDesignSystem.kt +0 -18
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/KitFontScale.kt +0 -22
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +0 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +0 -16
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +0 -188
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +0 -297
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +0 -54
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +0 -50
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/ScreenLayout.kt +0 -232
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +0 -41
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -52
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -66
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +0 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +0 -104
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -48
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +0 -51
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +0 -338
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/HostBackGestureBridge.kt +0 -58
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +0 -137
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +0 -106
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +0 -205
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +0 -393
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ScrollToTop.kt +0 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +0 -708
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackTransition.kt +0 -148
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/SwipeBackHaptic.kt +0 -35
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +0 -203
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +0 -232
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +0 -86
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoBarCompression.kt +0 -98
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/DuoTabBar.kt +0 -312
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +0 -169
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +0 -408
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +0 -92
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderJourney.kt +0 -105
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderLocation.kt +0 -74
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +0 -366
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +0 -37
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +0 -363
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SideBar.kt +0 -185
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +0 -132
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +0 -127
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/BackGesture.kt +0 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -91
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/OsFontScale.kt +0 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -74
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ReservedRegions.kt +0 -13
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +0 -1329
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +0 -55
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +0 -15
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +0 -118
- package/compose/src/iosMain/kotlin/vn/momo/kits/const/HostFont.ios.kt +0 -40
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/HostBackGesture.ios.kt +0 -45
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +0 -32
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/BackGesture.ios.kt +0 -38
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/OsFontScale.ios.kt +0 -66
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -217
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/ReservedRegions.ios.kt +0 -86
- package/gradle/libs.versions.toml +0 -69
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +0 -8
- package/gradle.properties +0 -26
- package/gradlew +0 -252
- package/gradlew.bat +0 -94
- package/ios/Application/HeaderRight.swift +0 -324
- package/ios/Application/Navigation/HeaderBackProps.swift +0 -66
- package/ios/Application/Navigation/HeaderTitle.swift +0 -57
- package/ios/Application/Navigation/NavigationOptions.swift +0 -109
- package/ios/Application/Navigation/NavigatorManager.swift +0 -29
- package/ios/Application/Navigation/component/DuoScrollGradient.swift +0 -54
- package/ios/Application/Navigation/component/Header.swift +0 -183
- package/ios/Application/Navigation/component/HeaderBackground.swift +0 -84
- package/ios/Application/Navigation/component/HeaderColor.swift +0 -65
- package/ios/Application/Navigation/component/HeaderRightWidthKey.swift +0 -11
- package/ios/Application/Navigation/component/NavigationFooter.swift +0 -90
- package/ios/Application/Navigation/component/NavigationHeaderRight.swift +0 -280
- package/ios-demo/README.md +0 -120
- package/settings.gradle.kts +0 -64
- /package/ios/{Application/Layout → Layout}/ScreenLayout.swift +0 -0
- /package/ios/{Application/Navigation → Navigation}/BottomTab/CurvedContainer.swift +0 -0
- /package/ios/{Application/Navigation → Navigation}/BottomTab/DuoBarCompression.swift +0 -0
- /package/ios/{Application/Navigation → Navigation}/BottomTab/DuoTabBar.swift +0 -0
- /package/ios/{Application/Navigation/Overplay → Navigation}/ModalScreen.swift +0 -0
package/CLAUDE.md
CHANGED
|
@@ -56,7 +56,10 @@ Publishing is automated (`publish.sh` + GitLab CI on `[ci build]` / `main`). Do
|
|
|
56
56
|
|
|
57
57
|
## SwiftUI kit (`ios/`)
|
|
58
58
|
|
|
59
|
-
-
|
|
59
|
+
- **Layout mirrors Compose:** `ios/Navigation/` follows `navigation/` file for file (`NavigationContainer`, `Navigator`, `Navigation` (options + per-screen `Navigation`), `StackScreen` (incl. `NavigationFooter`), `BottomSheet`, `ModalScreen`, `HostBackGestureBridge`, `BottomTab/`, `Component/`, `Tracking/`); `ios/Layout/ScreenLayout.swift` mirrors `layout/`. `ios/Application/` keeps only context (`ApplicationEnvironment`), `Localize*`, `MaxApi` and the deprecated `Screen` / `LegacyHeader` (Compose `application/`). Change a navigation piece on both sides together.
|
|
60
|
+
- **File basenames must be unique across the pod** — Swift fails with "filename used twice" even in different folders (hence `LegacyHeader.swift` next to `Navigation/Component/Header.swift`). New folders under `ios/` must be added to `source_files` in `ios/native-kits.podspec`.
|
|
61
|
+
- Screens update their own chrome at runtime through `@EnvironmentObject var navigation: Navigation` → `setOptions { $0.title = … }` (Compose `LocalNavigation`); bottom tabs keep one `Navigation` per tab. The host back bridge is `HostBackGestureBridge.shared` (`NavigatorManager` is a deprecated alias); a bottom tab off its first tab routes back to the first tab (`Navigator.tabBackHandler`, keyed by the hosting screen).
|
|
62
|
+
- The pod's minimum is **iOS 15**, but the navigation shell (`NavigationContainer`, `Navigator`, `HostBackGestureBridge`, `BottomTab`, overplay views) is **iOS 16+** (`@available(iOS 16.0, *)`) because it is built on `NavigationStack`. Keep components outside that shell iOS 15-compatible.
|
|
60
63
|
- `present` opens one `fullScreenCover` that hosts its own `NavigationStack` (`Navigator.presentedPath`): pushes and pops act on the presented flow while it is up, and each overplay (modal / bottom sheet / snackbar) renders in the context it was shown over (`OverplayItem.presentedId`).
|
|
61
64
|
- Icons are compiled in: `ios/Icon/Icons.swift` is generated from Compose `utils/Icons.kt` by `node scripts/gen-ios-icons.mjs` — don't hand-edit it. A host `icon.json` in the main bundle only adds keys the kit lacks.
|
|
62
65
|
- Bundled assets (colors, Lottie JSON) live in `ios/Resources` and ship in the `MoMoUIKitsResources` bundle; load them through `MoMoUIKitsResources.bundle`, never `Bundle.main`.
|
|
@@ -65,6 +65,17 @@ public class ApplicationEnvironment: ObservableObject {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
extension ApplicationEnvironment {
|
|
69
|
+
/// Closes the mini app: through `composeApi` as before, else `maxApi` (Compose `maxApi.dismiss`).
|
|
70
|
+
func requestDismiss() {
|
|
71
|
+
if let composeApi {
|
|
72
|
+
composeApi.requestCallback(funcName: "dismiss", params: nil, onResponse: nil)
|
|
73
|
+
} else {
|
|
74
|
+
maxApi?.dismiss(completion: nil)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
68
79
|
private struct ApplicationEnvironmentKey: EnvironmentKey {
|
|
69
80
|
static let defaultValue = ApplicationEnvironment()
|
|
70
81
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
|
|
3
|
+
@available(*, deprecated, message: "Use KitComposeApi or MaxApi")
|
|
3
4
|
public protocol ComposeApi {
|
|
4
5
|
func request(funcName: String, params: Any, _ completion: ((String) -> Void)?)
|
|
5
6
|
func request(funcName: String, params: Any) -> String
|
|
6
7
|
}
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
@available(*, deprecated, message: "Use KitComposeApi or MaxApi")
|
|
9
10
|
public class ComposeApiImpl: ComposeApi {
|
|
10
11
|
public static let shared = ComposeApiImpl()
|
|
11
12
|
|
|
@@ -1,55 +1,13 @@
|
|
|
1
1
|
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
2
|
+
// LegacyHeader.swift
|
|
3
|
+
// MoMoUIKits
|
|
4
4
|
//
|
|
5
|
-
//
|
|
5
|
+
// Header pieces of the deprecated `Screen` (Compose `application/Header.kt`,
|
|
6
|
+
// `application/HeaderBackground.kt`). New screens get theirs from `StackScreen`.
|
|
6
7
|
//
|
|
7
8
|
|
|
8
9
|
import SwiftUI
|
|
9
10
|
|
|
10
|
-
// MARK: - Enums
|
|
11
|
-
|
|
12
|
-
public enum TitlePosition {
|
|
13
|
-
case left, center
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public enum HeaderType {
|
|
17
|
-
case `default`, extended, none
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public enum AnimatedHeaderRatio {
|
|
21
|
-
case ratio16_9
|
|
22
|
-
case ratio1_1
|
|
23
|
-
case ratio3_2
|
|
24
|
-
|
|
25
|
-
var value: CGFloat {
|
|
26
|
-
switch self {
|
|
27
|
-
case .ratio16_9: return 16.0 / 9.0
|
|
28
|
-
case .ratio1_1: return 1.0
|
|
29
|
-
case .ratio3_2: return 3.0 / 2.0
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// MARK: - Animated Header Config
|
|
36
|
-
|
|
37
|
-
public struct AnimatedHeader {
|
|
38
|
-
public var aspectRatio: AnimatedHeaderRatio = .ratio16_9
|
|
39
|
-
public var isSurface: Bool = true
|
|
40
|
-
public var composable: (_ scrollState: CGFloat) -> AnyView = { _ in AnyView(EmptyView()) }
|
|
41
|
-
|
|
42
|
-
public init(
|
|
43
|
-
aspectRatio: AnimatedHeaderRatio = .ratio16_9,
|
|
44
|
-
isSurface: Bool = true,
|
|
45
|
-
composable: @escaping (_ scrollState: CGFloat) -> AnyView = { _ in AnyView(EmptyView()) }
|
|
46
|
-
) {
|
|
47
|
-
self.aspectRatio = aspectRatio
|
|
48
|
-
self.isSurface = isSurface
|
|
49
|
-
self.composable = composable
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
11
|
// MARK: - Utils
|
|
54
12
|
|
|
55
13
|
func safeAreaTopInset() -> CGFloat {
|
|
@@ -66,6 +24,7 @@ func safeAreaTopInset() -> CGFloat {
|
|
|
66
24
|
|
|
67
25
|
// MARK: - Header Background
|
|
68
26
|
|
|
27
|
+
@available(*, deprecated, message: "Use NavigationContainer + StackScreen; the header background comes with it")
|
|
69
28
|
public struct HeaderBackground: View {
|
|
70
29
|
var headerType: HeaderType = .default
|
|
71
30
|
var scrollState: CGFloat
|
|
@@ -146,24 +105,9 @@ public struct HeaderBackground: View {
|
|
|
146
105
|
}
|
|
147
106
|
}
|
|
148
107
|
|
|
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
|
-
|
|
165
108
|
// MARK: - Header View
|
|
166
109
|
|
|
110
|
+
@available(*, deprecated, message: "Use NavigationContainer + StackScreen; the header comes with it")
|
|
167
111
|
public struct Header: View {
|
|
168
112
|
var headerType: HeaderType = .default
|
|
169
113
|
var titlePosition: TitlePosition
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
//
|
|
2
2
|
// Screen.swift
|
|
3
|
-
//
|
|
3
|
+
// MoMoUIKits
|
|
4
4
|
//
|
|
5
|
-
//
|
|
5
|
+
// Deprecated standalone screen (Compose `application/Screen.kt`).
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
import SwiftUI
|
|
9
9
|
|
|
10
|
+
@available(*, deprecated, message: "Use NavigationContainer + StackScreen")
|
|
10
11
|
public struct Screen<Content: View>: View {
|
|
11
12
|
// MARK: - Properties
|
|
12
13
|
|
package/ios/Avatar/Avatar.swift
CHANGED
|
@@ -74,12 +74,12 @@ public struct Avatar: View {
|
|
|
74
74
|
.clipShape(RoundedRectangle(cornerRadius: cornerRadius))
|
|
75
75
|
.overlay(
|
|
76
76
|
RoundedRectangle(cornerRadius: cornerRadius)
|
|
77
|
-
.
|
|
77
|
+
.strokeBorder(theme.colors.border.default, lineWidth: 1)
|
|
78
78
|
)
|
|
79
79
|
|
|
80
80
|
// Badge icons — outside clip so they are not cut by border
|
|
81
81
|
if shouldShowIconTop {
|
|
82
|
-
ImageView(LOGO_MOMO_URL)
|
|
82
|
+
ImageView(LOGO_MOMO_URL, contentMode: .fill)
|
|
83
83
|
.frame(width: badgeSizeDp, height: badgeSizeDp)
|
|
84
84
|
.clipShape(RoundedRectangle(cornerRadius: badgeCornerRadius))
|
|
85
85
|
.offset(x: 1, y: -1)
|
|
@@ -92,7 +92,7 @@ public struct Avatar: View {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
if shouldShowIconBottom {
|
|
95
|
-
ImageView(iconSupport)
|
|
95
|
+
ImageView(iconSupport, contentMode: .fill)
|
|
96
96
|
.frame(width: badgeSizeDp, height: badgeSizeDp)
|
|
97
97
|
.clipShape(RoundedRectangle(cornerRadius: badgeCornerRadius))
|
|
98
98
|
.offset(x: 1, y: 1)
|
|
@@ -107,6 +107,7 @@ public struct Avatar: View {
|
|
|
107
107
|
.frame(width: size.sizeDp, height: size.sizeDp)
|
|
108
108
|
.accessibilityElement(children: .ignore)
|
|
109
109
|
.accessibilityLabel(automationId)
|
|
110
|
+
.accessibilityIdentifier(automationId)
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
// MARK: Internal
|
package/ios/Badge/Badge.swift
CHANGED
|
@@ -33,7 +33,8 @@ public struct Badge: View {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
private func formatTitle(_ text: String) -> String {
|
|
36
|
-
|
|
36
|
+
// Digits too long for Int are well over 99.
|
|
37
|
+
if isNumber(text), (Int(text) ?? .max) > 99 {
|
|
37
38
|
return "99+"
|
|
38
39
|
}
|
|
39
40
|
return text
|
|
@@ -54,14 +55,15 @@ public struct Badge: View {
|
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
public var body: some View {
|
|
57
|
-
MomoText(formatTitle(label), typography: .actionXxsBold, color: Colors.black01)
|
|
58
|
+
MomoText(formatTitle(label), typography: .actionXxsBold, color: Colors.black01, maxLines: 1)
|
|
58
59
|
.padding(.horizontal, Spacing.XS)
|
|
59
|
-
.frame(minWidth: fontScale(16)
|
|
60
|
+
.frame(minWidth: fontScale(16))
|
|
61
|
+
.frame(height: fontScale(16))
|
|
60
62
|
.background(badgeColor)
|
|
61
63
|
.cornerRadius(Radius.M)
|
|
62
64
|
.overlay(
|
|
63
65
|
RoundedRectangle(cornerRadius: Radius.M)
|
|
64
|
-
.
|
|
66
|
+
.strokeBorder(Colors.black01, lineWidth: 1)
|
|
65
67
|
)
|
|
66
68
|
}
|
|
67
69
|
}
|
package/ios/Badge/BadgeDot.swift
CHANGED
|
@@ -160,7 +160,6 @@ public struct BadgeRibbon: View {
|
|
|
160
160
|
MomoText(label, typography: .labelXsMedium, color: Colors.black01, maxLines: 1)
|
|
161
161
|
.rotationEffect(rotation)
|
|
162
162
|
.frame(height: RibbonConstants.skewBodyHeight)
|
|
163
|
-
.padding(.horizontal, 8)
|
|
164
163
|
.background(backgroundColor)
|
|
165
164
|
|
|
166
165
|
rightTail
|
package/ios/Button/Button.swift
CHANGED
|
@@ -51,15 +51,17 @@ public extension ButtonType {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
func contentColor(loading: Bool, theme: Theme) -> Color {
|
|
54
|
+
let color: Color
|
|
54
55
|
switch self {
|
|
55
|
-
case .disabled:
|
|
56
|
-
case .primary:
|
|
57
|
-
case .secondary:
|
|
58
|
-
case .outline:
|
|
59
|
-
case .tonal:
|
|
60
|
-
case .danger:
|
|
61
|
-
case .text:
|
|
56
|
+
case .disabled: color = theme.colors.text.disable
|
|
57
|
+
case .primary: color = Colors.black01
|
|
58
|
+
case .secondary: color = theme.colors.text.default
|
|
59
|
+
case .outline: color = theme.colors.primary
|
|
60
|
+
case .tonal: color = theme.colors.primary
|
|
61
|
+
case .danger: color = Colors.black01
|
|
62
|
+
case .text: color = theme.colors.primary
|
|
62
63
|
}
|
|
64
|
+
return color.opacity(loading ? 0.75 : 1)
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
var borderColor: Color? {
|
|
@@ -219,9 +221,8 @@ public struct Button: View {
|
|
|
219
221
|
let color: Color? = useTintColor ? textColor : nil
|
|
220
222
|
|
|
221
223
|
if forceLoading {
|
|
222
|
-
LottieView(name: "lottie_circle_loader", loopMode: .loop)
|
|
224
|
+
LottieView(name: "lottie_circle_loader", loopMode: .loop, tintColor: color.map { UIColor($0) })
|
|
223
225
|
.frame(width: size.iconSize, height: size.iconSize)
|
|
224
|
-
.colorMultiply(color ?? Colors.black01)
|
|
225
226
|
} else if !icon.isEmpty {
|
|
226
227
|
Icon(source: icon, size: size.iconSize, color: color)
|
|
227
228
|
}
|
|
@@ -229,8 +230,8 @@ public struct Button: View {
|
|
|
229
230
|
}
|
|
230
231
|
|
|
231
232
|
/// Mirrors Compose's press feedback: the background shrinks via an animated
|
|
232
|
-
/// horizontal inset
|
|
233
|
-
///
|
|
233
|
+
/// horizontal inset and the whole button (background included) fades to 0.5,
|
|
234
|
+
/// matching `animatedPadding`/`alpha` in Button.kt.
|
|
234
235
|
private struct ButtonPressFeedbackStyle: ButtonStyle {
|
|
235
236
|
let isEnabled: Bool
|
|
236
237
|
let background: Color
|
|
@@ -245,7 +246,6 @@ private struct ButtonPressFeedbackStyle: ButtonStyle {
|
|
|
245
246
|
|
|
246
247
|
configuration.label
|
|
247
248
|
.modifier(HugContentOnLegacyOS(isFull: isFull))
|
|
248
|
-
.opacity(pressed ? 0.5 : 1)
|
|
249
249
|
.background(
|
|
250
250
|
RoundedRectangle(cornerRadius: radius)
|
|
251
251
|
.fill(background)
|
|
@@ -257,6 +257,9 @@ private struct ButtonPressFeedbackStyle: ButtonStyle {
|
|
|
257
257
|
)
|
|
258
258
|
.frame(height: height)
|
|
259
259
|
.clipShape(RoundedRectangle(cornerRadius: radius))
|
|
260
|
+
// `.text` has a clear background, which SwiftUI does not hit-test.
|
|
261
|
+
.contentShape(RoundedRectangle(cornerRadius: radius))
|
|
262
|
+
.opacity(pressed ? 0.5 : 1)
|
|
260
263
|
.animation(.easeInOut(duration: 0.1), value: pressed)
|
|
261
264
|
}
|
|
262
265
|
}
|
|
@@ -16,42 +16,40 @@ extension String {
|
|
|
16
16
|
public struct CalculatorKeyboard: View {
|
|
17
17
|
// MARK: Lifecycle
|
|
18
18
|
@Binding var value: String
|
|
19
|
-
@State var tempValue: String = ""
|
|
20
19
|
|
|
21
20
|
public init(_ value: Binding<String>) {
|
|
22
21
|
self._value = value
|
|
23
22
|
}
|
|
23
|
+
|
|
24
|
+
// Derived from `value` so a host write to the binding (prefill, reset after submit) is honoured.
|
|
25
|
+
private var expression: String {
|
|
26
|
+
value.replacingOccurrences(of: "x", with: "*").replacingOccurrences(of: "÷", with: "/")
|
|
27
|
+
}
|
|
24
28
|
|
|
25
29
|
func onPressBack(){
|
|
26
30
|
if (value.count > 0 ){
|
|
27
31
|
value.removeLast()
|
|
28
32
|
}
|
|
29
|
-
// Keys map 1:1 onto `tempValue` characters, so both trims stay aligned.
|
|
30
|
-
if (tempValue.count > 0 ){
|
|
31
|
-
tempValue.removeLast()
|
|
32
|
-
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
func onPressClear(key: String){
|
|
36
36
|
value = ""
|
|
37
|
-
tempValue = ""
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
func onPressEqual(key: String){
|
|
41
|
-
|
|
40
|
+
var expression = self.expression
|
|
41
|
+
if (expression == "") {
|
|
42
42
|
return
|
|
43
43
|
}
|
|
44
|
-
if (
|
|
45
|
-
|
|
44
|
+
if (expression.last?.isNumber == false){
|
|
45
|
+
expression.removeLast()
|
|
46
46
|
}
|
|
47
47
|
// Overflow and division by zero are treated like a negative result: cleared.
|
|
48
|
-
if let result = Self.evaluate(
|
|
48
|
+
if let result = Self.evaluate(expression), result >= 0 {
|
|
49
49
|
value = String(result)
|
|
50
50
|
} else {
|
|
51
51
|
value = ""
|
|
52
52
|
}
|
|
53
|
-
// The next keys continue from the shown result, not the old expression.
|
|
54
|
-
tempValue = value
|
|
55
53
|
}
|
|
56
54
|
|
|
57
55
|
/// Integer `+ - * /` with the usual precedence, as NSExpression did, but nil instead of a
|
|
@@ -104,21 +102,15 @@ public struct CalculatorKeyboard: View {
|
|
|
104
102
|
}
|
|
105
103
|
|
|
106
104
|
func onPressKey(key:String){
|
|
107
|
-
if (
|
|
105
|
+
if (value.last?.isNumber == false){
|
|
108
106
|
if (key.isNumber == false){
|
|
109
107
|
return
|
|
110
108
|
}
|
|
111
109
|
}
|
|
112
|
-
var convertedKey = key
|
|
113
|
-
if (key == "x") {convertedKey = "*"}
|
|
114
|
-
if (key == "÷") {convertedKey = "/"}
|
|
115
110
|
if (value == "" && (key == "0" || key == "000" || key.isNumber == false)) {
|
|
116
111
|
return
|
|
117
112
|
}
|
|
118
|
-
|
|
119
|
-
value.append(key)
|
|
120
|
-
tempValue.append(convertedKey)
|
|
121
|
-
}
|
|
113
|
+
value.append(key)
|
|
122
114
|
}
|
|
123
115
|
|
|
124
116
|
// MARK: Public
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import Combine
|
|
2
1
|
import SwiftUI
|
|
3
2
|
|
|
4
3
|
/// Native SwiftUI port of the Compose `Carousel` component.
|
|
@@ -10,9 +9,9 @@ import SwiftUI
|
|
|
10
9
|
/// snap behavior, and scroll enable/disable. Snap / scroll-index callbacks
|
|
11
10
|
/// report the real item index.
|
|
12
11
|
///
|
|
13
|
-
///
|
|
12
|
+
/// Uses a custom drag-driven pager (not a ScrollView) so behavior is identical
|
|
14
13
|
/// across versions and supports the loop virtualization + transform effects
|
|
15
|
-
/// that `TabView(.page)` cannot express
|
|
14
|
+
/// that `TabView(.page)` cannot express.
|
|
16
15
|
public struct Carousel<Content: View>: View {
|
|
17
16
|
// MARK: Lifecycle
|
|
18
17
|
|
|
@@ -82,7 +81,7 @@ public struct Carousel<Content: View>: View {
|
|
|
82
81
|
@State private var currentPage: Int
|
|
83
82
|
@State private var dragOffset: CGFloat = 0
|
|
84
83
|
@State private var isDragging: Bool = false
|
|
85
|
-
@
|
|
84
|
+
@GestureState private var dragActive = false
|
|
86
85
|
|
|
87
86
|
private func realIndex(_ page: Int) -> Int {
|
|
88
87
|
((page % itemCount) + itemCount) % itemCount
|
|
@@ -124,9 +123,20 @@ public struct Carousel<Content: View>: View {
|
|
|
124
123
|
}
|
|
125
124
|
.frame(width: viewportWidth)
|
|
126
125
|
.clipped()
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
// Restarts on drag like Compose's LaunchedEffect(autoplayInterval, isUserScrolling).
|
|
127
|
+
.task(id: AutoplayKey(enabled: autoplay && itemCount > 1 && !isDragging, interval: autoplayInterval)) { @MainActor in
|
|
128
|
+
guard autoplay, itemCount > 1, !isDragging, autoplayInterval > 0 else { return }
|
|
129
|
+
while !Task.isCancelled {
|
|
130
|
+
try? await Task.sleep(nanoseconds: UInt64(autoplayInterval * 1_000_000_000))
|
|
131
|
+
guard !Task.isCancelled else { return }
|
|
132
|
+
advance()
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// A drag stolen by a parent scroll view never reaches `onEnded`; settle on the current page.
|
|
136
|
+
.onChange(of: dragActive) { active in
|
|
137
|
+
guard !active, isDragging else { return }
|
|
138
|
+
isDragging = false
|
|
139
|
+
withAnimation(.easeInOut(duration: 0.25)) { dragOffset = 0 }
|
|
130
140
|
}
|
|
131
141
|
}
|
|
132
142
|
|
|
@@ -147,9 +157,14 @@ public struct Carousel<Content: View>: View {
|
|
|
147
157
|
|
|
148
158
|
private func dragGesture(step: CGFloat) -> some Gesture {
|
|
149
159
|
DragGesture(minimumDistance: 5)
|
|
160
|
+
.updating($dragActive) { _, active, _ in active = true }
|
|
150
161
|
.onChanged { value in
|
|
151
162
|
isDragging = true
|
|
152
|
-
|
|
163
|
+
var offset = value.translation.width
|
|
164
|
+
// No slide exists past either end, as with HorizontalPager bounds.
|
|
165
|
+
if currentPage == 0 { offset = min(offset, 0) }
|
|
166
|
+
if currentPage == virtualPageCount - 1 { offset = max(offset, 0) }
|
|
167
|
+
dragOffset = offset
|
|
153
168
|
}
|
|
154
169
|
.onEnded { value in
|
|
155
170
|
isDragging = false
|
|
@@ -167,7 +182,8 @@ public struct Carousel<Content: View>: View {
|
|
|
167
182
|
let moved = step > 0 ? Int((-dragOffset / step).rounded()) : 0
|
|
168
183
|
target = min(max(currentPage + moved, 0), virtualPageCount - 1)
|
|
169
184
|
}
|
|
170
|
-
|
|
185
|
+
// Animated so a drag that stays on the same page eases back too.
|
|
186
|
+
withAnimation(.easeInOut(duration: 0.25)) { dragOffset = 0 }
|
|
171
187
|
setPage(target)
|
|
172
188
|
}
|
|
173
189
|
}
|
|
@@ -189,8 +205,9 @@ public struct Carousel<Content: View>: View {
|
|
|
189
205
|
onScrollIndexChanged(real)
|
|
190
206
|
}
|
|
191
207
|
}
|
|
208
|
+
}
|
|
192
209
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
210
|
+
private struct AutoplayKey: Equatable {
|
|
211
|
+
let enabled: Bool
|
|
212
|
+
let interval: TimeInterval
|
|
196
213
|
}
|
|
@@ -21,8 +21,10 @@ public struct Checkbox: View{
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
func onCheck(){
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
// Not re-read from the binding: a `.constant` / one-way binding would report the stale value.
|
|
25
|
+
let newValue = !checked
|
|
26
|
+
checked = newValue
|
|
27
|
+
onChange?(newValue)
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
public var body: some View {
|
|
@@ -35,13 +37,15 @@ public struct Checkbox: View{
|
|
|
35
37
|
.frame(width: 20, height: 20)
|
|
36
38
|
.overlay(
|
|
37
39
|
RoundedRectangle(cornerRadius: Radius.XS)
|
|
38
|
-
.
|
|
40
|
+
.strokeBorder(borderColor, lineWidth: Spacing.XXS)
|
|
39
41
|
)
|
|
40
42
|
|
|
41
43
|
if checked {
|
|
42
44
|
Icon(source: indeterminate ? "navigation_minus" : "ic_checked", size: 20, color: Colors.black01)
|
|
43
45
|
}
|
|
44
46
|
}
|
|
47
|
+
// The unchecked fill is clear, which SwiftUI does not hit-test.
|
|
48
|
+
.contentShape(RoundedRectangle(cornerRadius: Radius.XS))
|
|
45
49
|
}
|
|
46
50
|
.buttonStyle(ActiveOpacityButtonStyle(activeOpacity: 0.8))
|
|
47
51
|
.disabled(disabled)
|
package/ios/Chip/Chip.swift
CHANGED
|
@@ -89,18 +89,19 @@ public struct Chip: View {
|
|
|
89
89
|
.padding(.horizontal, horizontal)
|
|
90
90
|
.frame(height: height)
|
|
91
91
|
.background(
|
|
92
|
-
RoundedRectangle(cornerRadius: radius
|
|
92
|
+
RoundedRectangle(cornerRadius: radius)
|
|
93
93
|
.fill(bg)
|
|
94
94
|
)
|
|
95
95
|
.overlay(
|
|
96
96
|
Group {
|
|
97
97
|
if selected {
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
// Inside the bounds, like Compose `border`.
|
|
99
|
+
RoundedRectangle(cornerRadius: radius)
|
|
100
|
+
.strokeBorder(theme.colors.secondary, lineWidth: 2)
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
)
|
|
103
|
-
.contentShape(RoundedRectangle(cornerRadius: radius
|
|
104
|
+
.contentShape(RoundedRectangle(cornerRadius: radius))
|
|
104
105
|
}
|
|
105
106
|
.buttonStyle(ActiveOpacityButtonStyle())
|
|
106
107
|
.modifier(ChipAccessibilityModifier(accessibilityLabel: accessibilityLabel))
|