@momo-kits/native-kits 0.162.2-test.2-debug → 0.162.2-test.21-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 +14 -0
- package/CLAUDE.md +78 -0
- package/compose/build.gradle.kts +12 -8
- package/compose/build.gradle.kts.backup +15 -11
- package/compose/compose.podspec +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +2 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +6 -10
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +6 -24
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +4 -19
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +1 -10
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +6 -17
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +6 -101
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Localize.kt +269 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +5 -19
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +8 -33
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +22 -25
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +27 -29
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BaselineView.kt +3 -26
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +30 -31
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Carousel.kt +3 -13
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +0 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +3 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Collapse.kt +3 -18
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +11 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +3 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +69 -26
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +1 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +84 -59
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +13 -71
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +10 -51
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +6 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +4 -21
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +16 -75
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +5 -26
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +3 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +16 -40
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +3 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ProgressInfo.kt +0 -28
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +2 -13
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +17 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +4 -10
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Slider.kt +3 -28
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Stepper.kt +8 -47
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Steps.kt +4 -25
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/SuggestAction.kt +2 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Swipe.kt +1 -17
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +1 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TabView.kt +50 -111
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +1 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +1 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +1 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tooltip.kt +4 -96
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +5 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Uploader.kt +2 -12
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +9 -21
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +9 -14
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +8 -11
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +7 -27
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +0 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +0 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +94 -4
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +0 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +2 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +3 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +12 -16
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +33 -27
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +48 -33
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +91 -63
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +9 -14
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +13 -31
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +6 -24
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +11 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +2 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +9 -6
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +3 -13
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +3 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +1 -40
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/ComposeLottieAnimation.kt +0 -2
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +0 -8
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +2 -17
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Tracking.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +3 -3
- package/compose/src/iosMain/kotlin/vn/momo/kits/navigation/ScrollToTop.ios.kt +2 -3
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +0 -2
- package/gradle/libs.versions.toml +2 -0
- package/gradle.properties +1 -1
- package/ios/Application/Components.swift +1 -0
- package/ios/Application/FloatingButton.swift +1 -0
- package/ios/Badge/Badge.swift +1 -0
- package/ios/Badge/BadgeRibbon.swift +2 -0
- package/ios/Button/Button.swift +1 -1
- package/ios/Checkbox/Checkbox.swift +1 -0
- package/ios/Information/Information.swift +151 -0
- package/ios/Input/Input.swift +1 -0
- package/ios/Input/InputPhoneNumber.swift +1 -0
- package/ios/Input/InputSearch.swift +3 -0
- package/ios/Input/InputTextArea.swift +1 -0
- package/ios/OTPKeyboard/KeyboardButton.swift +1 -1
- package/ios/Popup/PopupDisplay.swift +6 -0
- package/ios/Popup/PopupInput.swift +2 -0
- package/ios/Template/TrustBanner/TrustBanner.swift +2 -0
- package/ios/Typography/Text.swift +1 -0
- package/ios/Typography/Typography.swift +14 -5
- package/local.properties +2 -2
- package/package.json +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FontScaleStore.kt +0 -77
- package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Example.xcscheme +0 -32
- package/example/ios/Example.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/WorkspaceSettings.xcsettings +0 -16
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -6
- package/example/ios/Example.xcworkspace/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +0 -5
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/MoMoUIKits.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/Pods-Example.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImage.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SDWebImageSwiftUI.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/SkeletonUI.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios-LottiePrivacyInfo.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/lottie-ios.xcscheme +0 -58
- package/example/ios/Pods/Pods.xcodeproj/xcuserdata/sonnguyen.xcuserdatad/xcschemes/xcschememanagement.plist +0 -60
|
@@ -2,21 +2,12 @@ package vn.momo.kits.components
|
|
|
2
2
|
|
|
3
3
|
import androidx.compose.foundation.background
|
|
4
4
|
import androidx.compose.foundation.border
|
|
5
|
-
import androidx.compose.foundation.layout
|
|
6
|
-
import androidx.compose.foundation.layout.Row
|
|
7
|
-
import androidx.compose.foundation.layout.defaultMinSize
|
|
8
|
-
import androidx.compose.foundation.layout.height
|
|
9
|
-
import androidx.compose.foundation.layout.padding
|
|
10
|
-
import androidx.compose.foundation.layout.size
|
|
5
|
+
import androidx.compose.foundation.layout.*
|
|
11
6
|
import androidx.compose.foundation.shape.CircleShape
|
|
12
7
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
13
8
|
import androidx.compose.foundation.text.BasicTextField
|
|
14
9
|
import androidx.compose.foundation.text.KeyboardOptions
|
|
15
|
-
import androidx.compose.runtime
|
|
16
|
-
import androidx.compose.runtime.getValue
|
|
17
|
-
import androidx.compose.runtime.mutableStateOf
|
|
18
|
-
import androidx.compose.runtime.remember
|
|
19
|
-
import androidx.compose.runtime.setValue
|
|
10
|
+
import androidx.compose.runtime.*
|
|
20
11
|
import androidx.compose.ui.Alignment
|
|
21
12
|
import androidx.compose.ui.Modifier
|
|
22
13
|
import androidx.compose.ui.graphics.Color
|
|
@@ -27,18 +18,10 @@ import androidx.compose.ui.unit.Dp
|
|
|
27
18
|
import androidx.compose.ui.unit.dp
|
|
28
19
|
import androidx.compose.ui.unit.sp
|
|
29
20
|
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
30
|
-
import vn.momo.kits.const
|
|
31
|
-
import vn.momo.kits.const.Colors
|
|
32
|
-
import vn.momo.kits.const.Radius
|
|
33
|
-
import vn.momo.kits.const.Spacing
|
|
34
|
-
import vn.momo.kits.const.scaleSize
|
|
21
|
+
import vn.momo.kits.const.*
|
|
35
22
|
import vn.momo.kits.modifier.activeOpacityClickable
|
|
36
23
|
import vn.momo.kits.modifier.conditional
|
|
37
24
|
|
|
38
|
-
// ---------------------------------------------------------------------------
|
|
39
|
-
// Size variant
|
|
40
|
-
// ---------------------------------------------------------------------------
|
|
41
|
-
|
|
42
25
|
enum class StepperSize {
|
|
43
26
|
LARGE,
|
|
44
27
|
SMALL
|
|
@@ -66,10 +49,6 @@ private val stepperSizeSpecs: Map<StepperSize, StepperSizeSpec> = mapOf(
|
|
|
66
49
|
),
|
|
67
50
|
)
|
|
68
51
|
|
|
69
|
-
// ---------------------------------------------------------------------------
|
|
70
|
-
// Private sub-composables
|
|
71
|
-
// ---------------------------------------------------------------------------
|
|
72
|
-
|
|
73
52
|
@Composable
|
|
74
53
|
private fun StepperButton(
|
|
75
54
|
sign: String = "+",
|
|
@@ -157,26 +136,6 @@ private fun StepperNumberView(
|
|
|
157
136
|
}
|
|
158
137
|
}
|
|
159
138
|
|
|
160
|
-
// ---------------------------------------------------------------------------
|
|
161
|
-
// Public API
|
|
162
|
-
// ---------------------------------------------------------------------------
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Stepper — migrated from React Native Stepper.
|
|
166
|
-
*
|
|
167
|
-
* Layout: [− button] [value display] [+ button]
|
|
168
|
-
*
|
|
169
|
-
* @param defaultValue Initial value (default 0). Clamped to [min]..[max] on first composition.
|
|
170
|
-
* @param min Minimum allowed value (default 0). Minus button is auto-disabled at this bound.
|
|
171
|
-
* @param max Maximum allowed value (default 100). Plus button is auto-disabled at this bound.
|
|
172
|
-
* @param step Amount added/subtracted per button press (default 1).
|
|
173
|
-
* @param disabled Disable state. Pass `true` to disable everything, or a [BooleanArray] of
|
|
174
|
-
* size >= 2 where index 0 = minus button, index 1 = plus button.
|
|
175
|
-
* @param size Visual size variant: [StepperSize.LARGE] (default) or [StepperSize.SMALL].
|
|
176
|
-
* @param editable When `true` the number display becomes a direct keyboard input (default false).
|
|
177
|
-
* @param onValueChange Callback invoked with the new [Int] value on every change.
|
|
178
|
-
* @param modifier Modifier applied to the root [Row].
|
|
179
|
-
*/
|
|
180
139
|
@Composable
|
|
181
140
|
fun Stepper(
|
|
182
141
|
defaultValue: Int = 0,
|
|
@@ -203,17 +162,19 @@ fun Stepper(
|
|
|
203
162
|
val disabledPlus: Boolean
|
|
204
163
|
val disabledNumber: Boolean
|
|
205
164
|
|
|
206
|
-
when {
|
|
207
|
-
|
|
165
|
+
when (disabled) {
|
|
166
|
+
is BooleanArray if disabled.size >= 2 -> {
|
|
208
167
|
disabledMinus = disabled[0]
|
|
209
168
|
disabledPlus = disabled[1]
|
|
210
169
|
disabledNumber = disabled[0] && disabled[1]
|
|
211
170
|
}
|
|
212
|
-
|
|
171
|
+
|
|
172
|
+
is Boolean if disabled -> {
|
|
213
173
|
disabledMinus = true
|
|
214
174
|
disabledPlus = true
|
|
215
175
|
disabledNumber = true
|
|
216
176
|
}
|
|
177
|
+
|
|
217
178
|
else -> {
|
|
218
179
|
disabledMinus = false
|
|
219
180
|
disabledPlus = false
|
|
@@ -2,16 +2,7 @@ package vn.momo.kits.components
|
|
|
2
2
|
|
|
3
3
|
import androidx.compose.foundation.background
|
|
4
4
|
import androidx.compose.foundation.border
|
|
5
|
-
import androidx.compose.foundation.layout
|
|
6
|
-
import androidx.compose.foundation.layout.Box
|
|
7
|
-
import androidx.compose.foundation.layout.Column
|
|
8
|
-
import androidx.compose.foundation.layout.Row
|
|
9
|
-
import androidx.compose.foundation.layout.Spacer
|
|
10
|
-
import androidx.compose.foundation.layout.fillMaxWidth
|
|
11
|
-
import androidx.compose.foundation.layout.height
|
|
12
|
-
import androidx.compose.foundation.layout.padding
|
|
13
|
-
import androidx.compose.foundation.layout.size
|
|
14
|
-
import androidx.compose.foundation.layout.width
|
|
5
|
+
import androidx.compose.foundation.layout.*
|
|
15
6
|
import androidx.compose.foundation.shape.CircleShape
|
|
16
7
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
17
8
|
import androidx.compose.runtime.Composable
|
|
@@ -23,15 +14,10 @@ import androidx.compose.ui.text.style.TextAlign
|
|
|
23
14
|
import androidx.compose.ui.unit.Dp
|
|
24
15
|
import androidx.compose.ui.unit.dp
|
|
25
16
|
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
26
|
-
import vn.momo.kits.const
|
|
27
|
-
import vn.momo.kits.const.Colors
|
|
28
|
-
import vn.momo.kits.const.Radius
|
|
29
|
-
import vn.momo.kits.const.Spacing
|
|
30
|
-
import vn.momo.kits.const.Typography
|
|
17
|
+
import vn.momo.kits.const.*
|
|
31
18
|
import vn.momo.kits.modifier.activeOpacityClickable
|
|
32
19
|
import vn.momo.kits.modifier.conditional
|
|
33
20
|
|
|
34
|
-
// ─── Data model ────────────────────────────────────────────────────────────────
|
|
35
21
|
|
|
36
22
|
data class StepItem(
|
|
37
23
|
val title: String,
|
|
@@ -40,13 +26,11 @@ data class StepItem(
|
|
|
40
26
|
val time: String? = null,
|
|
41
27
|
)
|
|
42
28
|
|
|
43
|
-
// ─── Enumerations ──────────────────────────────────────────────────────────────
|
|
44
29
|
|
|
45
30
|
enum class StepsSize { SMALL, LARGE }
|
|
46
31
|
|
|
47
32
|
enum class StepsAlign { LEFT, RIGHT, CENTER, STRETCH }
|
|
48
33
|
|
|
49
|
-
// ─── Internal status ───────────────────────────────────────────────────────────
|
|
50
34
|
|
|
51
35
|
private enum class StepStatus { INCOMPLETE, CURRENT, COMPLETED, ERROR, DISABLED }
|
|
52
36
|
|
|
@@ -63,7 +47,6 @@ private fun resolveStatus(
|
|
|
63
47
|
else -> StepStatus.INCOMPLETE
|
|
64
48
|
}
|
|
65
49
|
|
|
66
|
-
// ─── Color helpers ─────────────────────────────────────────────────────────────
|
|
67
50
|
|
|
68
51
|
@Composable
|
|
69
52
|
private fun resolveIconBgAndBorder(status: StepStatus): Pair<Color, Color> {
|
|
@@ -91,8 +74,6 @@ private fun resolveTitleColor(status: StepStatus): Color {
|
|
|
91
74
|
}
|
|
92
75
|
}
|
|
93
76
|
|
|
94
|
-
// ─── Step bubble ───────────────────────────────────────────────────────────────
|
|
95
|
-
|
|
96
77
|
@Composable
|
|
97
78
|
private fun StepBubble(
|
|
98
79
|
index: Int,
|
|
@@ -153,7 +134,6 @@ private fun StepBubble(
|
|
|
153
134
|
}
|
|
154
135
|
}
|
|
155
136
|
|
|
156
|
-
// ─── Horizontal layout ─────────────────────────────────────────────────────────
|
|
157
137
|
|
|
158
138
|
@Composable
|
|
159
139
|
private fun StepsHorizontal(
|
|
@@ -228,7 +208,7 @@ private fun StepsHorizontal(
|
|
|
228
208
|
modifier = Modifier
|
|
229
209
|
.weight(1f)
|
|
230
210
|
.then(
|
|
231
|
-
if (clickable) Modifier.activeOpacityClickable { onPress
|
|
211
|
+
if (clickable) Modifier.activeOpacityClickable { onPress.invoke(item, index) }
|
|
232
212
|
else Modifier
|
|
233
213
|
),
|
|
234
214
|
horizontalAlignment = colAlign,
|
|
@@ -318,7 +298,6 @@ private fun StepsHorizontal(
|
|
|
318
298
|
}
|
|
319
299
|
}
|
|
320
300
|
|
|
321
|
-
// ─── Vertical layout ───────────────────────────────────────────────────────────
|
|
322
301
|
|
|
323
302
|
@Composable
|
|
324
303
|
private fun StepsVertical(
|
|
@@ -362,7 +341,7 @@ private fun StepsVertical(
|
|
|
362
341
|
modifier = Modifier
|
|
363
342
|
.fillMaxWidth()
|
|
364
343
|
.then(
|
|
365
|
-
if (clickable) Modifier.activeOpacityClickable { onPress
|
|
344
|
+
if (clickable) Modifier.activeOpacityClickable { onPress.invoke(item, index) }
|
|
366
345
|
else Modifier
|
|
367
346
|
),
|
|
368
347
|
) {
|
|
@@ -5,12 +5,7 @@ import androidx.compose.animation.fadeIn
|
|
|
5
5
|
import androidx.compose.animation.fadeOut
|
|
6
6
|
import androidx.compose.foundation.background
|
|
7
7
|
import androidx.compose.foundation.border
|
|
8
|
-
import androidx.compose.foundation.layout
|
|
9
|
-
import androidx.compose.foundation.layout.Spacer
|
|
10
|
-
import androidx.compose.foundation.layout.fillMaxWidth
|
|
11
|
-
import androidx.compose.foundation.layout.padding
|
|
12
|
-
import androidx.compose.foundation.layout.size
|
|
13
|
-
import androidx.compose.foundation.layout.width
|
|
8
|
+
import androidx.compose.foundation.layout.*
|
|
14
9
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
15
10
|
import androidx.compose.runtime.Composable
|
|
16
11
|
import androidx.compose.runtime.remember
|
|
@@ -23,11 +18,7 @@ import androidx.compose.ui.text.font.FontWeight
|
|
|
23
18
|
import androidx.compose.ui.text.withStyle
|
|
24
19
|
import androidx.compose.ui.unit.dp
|
|
25
20
|
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
26
|
-
import vn.momo.kits.const
|
|
27
|
-
import vn.momo.kits.const.Colors
|
|
28
|
-
import vn.momo.kits.const.Radius
|
|
29
|
-
import vn.momo.kits.const.Spacing
|
|
30
|
-
import vn.momo.kits.const.Typography
|
|
21
|
+
import vn.momo.kits.const.*
|
|
31
22
|
import vn.momo.kits.modifier.activeOpacityClickable
|
|
32
23
|
import vn.momo.kits.modifier.conditional
|
|
33
24
|
import vn.momo.kits.modifier.shadow
|
|
@@ -5,14 +5,7 @@ import androidx.compose.animation.core.tween
|
|
|
5
5
|
import androidx.compose.foundation.background
|
|
6
6
|
import androidx.compose.foundation.border
|
|
7
7
|
import androidx.compose.foundation.gestures.detectHorizontalDragGestures
|
|
8
|
-
import androidx.compose.foundation.layout
|
|
9
|
-
import androidx.compose.foundation.layout.Column
|
|
10
|
-
import androidx.compose.foundation.layout.Row
|
|
11
|
-
import androidx.compose.foundation.layout.fillMaxHeight
|
|
12
|
-
import androidx.compose.foundation.layout.fillMaxWidth
|
|
13
|
-
import androidx.compose.foundation.layout.height
|
|
14
|
-
import androidx.compose.foundation.layout.offset
|
|
15
|
-
import androidx.compose.foundation.layout.width
|
|
8
|
+
import androidx.compose.foundation.layout.*
|
|
16
9
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
17
10
|
import androidx.compose.runtime.Composable
|
|
18
11
|
import androidx.compose.runtime.remember
|
|
@@ -30,8 +23,6 @@ import kotlinx.coroutines.launch
|
|
|
30
23
|
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
31
24
|
import vn.momo.kits.const.AppTheme
|
|
32
25
|
import vn.momo.kits.const.Colors
|
|
33
|
-
import vn.momo.kits.const.Radius
|
|
34
|
-
import vn.momo.kits.const.Spacing
|
|
35
26
|
import vn.momo.kits.const.Typography
|
|
36
27
|
import vn.momo.kits.modifier.activeOpacityClickable
|
|
37
28
|
import vn.momo.kits.modifier.conditional
|
|
@@ -98,13 +89,6 @@ fun Swipe(
|
|
|
98
89
|
}
|
|
99
90
|
}
|
|
100
91
|
|
|
101
|
-
fun close() {
|
|
102
|
-
scope.launch {
|
|
103
|
-
offsetX.animateTo(0f, tween(200))
|
|
104
|
-
onSwipeableClose()
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
92
|
Box(
|
|
109
93
|
modifier = modifier
|
|
110
94
|
.fillMaxWidth()
|
|
@@ -3,11 +3,7 @@ package vn.momo.kits.components
|
|
|
3
3
|
import androidx.compose.foundation.background
|
|
4
4
|
import androidx.compose.foundation.border
|
|
5
5
|
import androidx.compose.foundation.clickable
|
|
6
|
-
import androidx.compose.foundation.layout
|
|
7
|
-
import androidx.compose.foundation.layout.height
|
|
8
|
-
import androidx.compose.foundation.layout.padding
|
|
9
|
-
import androidx.compose.foundation.layout.size
|
|
10
|
-
import androidx.compose.foundation.layout.width
|
|
6
|
+
import androidx.compose.foundation.layout.*
|
|
11
7
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
12
8
|
import androidx.compose.runtime.Composable
|
|
13
9
|
import androidx.compose.runtime.remember
|
|
@@ -22,7 +18,6 @@ import vn.momo.kits.const.Spacing
|
|
|
22
18
|
import vn.momo.kits.modifier.conditional
|
|
23
19
|
import vn.momo.kits.modifier.setAutomationId
|
|
24
20
|
|
|
25
|
-
// Pre-computed shapes to avoid repeated creation
|
|
26
21
|
private val switchShape = RoundedCornerShape(20.dp)
|
|
27
22
|
private val circleShape = RoundedCornerShape(percent = 100)
|
|
28
23
|
|
|
@@ -2,34 +2,12 @@ package vn.momo.kits.components
|
|
|
2
2
|
|
|
3
3
|
import androidx.compose.animation.core.animateDpAsState
|
|
4
4
|
import androidx.compose.animation.core.tween
|
|
5
|
-
import androidx.compose.foundation
|
|
6
|
-
import androidx.compose.foundation.
|
|
7
|
-
import androidx.compose.foundation.border
|
|
8
|
-
import androidx.compose.foundation.horizontalScroll
|
|
9
|
-
import androidx.compose.foundation.layout.Arrangement
|
|
10
|
-
import androidx.compose.foundation.layout.Box
|
|
11
|
-
import androidx.compose.foundation.layout.Column
|
|
12
|
-
import androidx.compose.foundation.layout.Row
|
|
13
|
-
import androidx.compose.foundation.layout.Spacer
|
|
14
|
-
import androidx.compose.foundation.layout.fillMaxWidth
|
|
15
|
-
import androidx.compose.foundation.layout.height
|
|
16
|
-
import androidx.compose.foundation.layout.offset
|
|
17
|
-
import androidx.compose.foundation.layout.padding
|
|
18
|
-
import androidx.compose.foundation.layout.width
|
|
19
|
-
import androidx.compose.foundation.layout.wrapContentWidth
|
|
5
|
+
import androidx.compose.foundation.*
|
|
6
|
+
import androidx.compose.foundation.layout.*
|
|
20
7
|
import androidx.compose.foundation.pager.HorizontalPager
|
|
21
8
|
import androidx.compose.foundation.pager.rememberPagerState
|
|
22
|
-
import androidx.compose.foundation.rememberScrollState
|
|
23
9
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
24
|
-
import androidx.compose.runtime
|
|
25
|
-
import androidx.compose.runtime.LaunchedEffect
|
|
26
|
-
import androidx.compose.runtime.getValue
|
|
27
|
-
import androidx.compose.runtime.mutableStateListOf
|
|
28
|
-
import androidx.compose.runtime.mutableStateOf
|
|
29
|
-
import androidx.compose.runtime.remember
|
|
30
|
-
import androidx.compose.runtime.rememberCoroutineScope
|
|
31
|
-
import androidx.compose.runtime.setValue
|
|
32
|
-
import androidx.compose.runtime.snapshotFlow
|
|
10
|
+
import androidx.compose.runtime.*
|
|
33
11
|
import androidx.compose.ui.Alignment
|
|
34
12
|
import androidx.compose.ui.Modifier
|
|
35
13
|
import androidx.compose.ui.graphics.Color
|
|
@@ -41,18 +19,10 @@ import androidx.compose.ui.unit.Dp
|
|
|
41
19
|
import androidx.compose.ui.unit.dp
|
|
42
20
|
import kotlinx.coroutines.launch
|
|
43
21
|
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
44
|
-
import vn.momo.kits.const
|
|
45
|
-
import vn.momo.kits.const.Colors
|
|
46
|
-
import vn.momo.kits.const.Radius
|
|
47
|
-
import vn.momo.kits.const.Spacing
|
|
48
|
-
import vn.momo.kits.const.Typography
|
|
22
|
+
import vn.momo.kits.const.*
|
|
49
23
|
import vn.momo.kits.modifier.activeOpacityClickable
|
|
50
24
|
import vn.momo.kits.modifier.conditional
|
|
51
25
|
|
|
52
|
-
// ---------------------------------------------------------------------------
|
|
53
|
-
// Data model
|
|
54
|
-
// ---------------------------------------------------------------------------
|
|
55
|
-
|
|
56
26
|
data class TabViewItem(
|
|
57
27
|
val title: String,
|
|
58
28
|
val icon: String? = null,
|
|
@@ -68,10 +38,6 @@ enum class TabViewType { DEFAULT, CARD }
|
|
|
68
38
|
|
|
69
39
|
enum class TabViewDirection { ROW, COLUMN }
|
|
70
40
|
|
|
71
|
-
// ---------------------------------------------------------------------------
|
|
72
|
-
// Public composable
|
|
73
|
-
// ---------------------------------------------------------------------------
|
|
74
|
-
|
|
75
41
|
@Composable
|
|
76
42
|
fun TabView(
|
|
77
43
|
modifier: Modifier = Modifier,
|
|
@@ -186,10 +152,6 @@ fun TabView(
|
|
|
186
152
|
}
|
|
187
153
|
}
|
|
188
154
|
|
|
189
|
-
// ---------------------------------------------------------------------------
|
|
190
|
-
// Default fixed-width tab bar
|
|
191
|
-
// ---------------------------------------------------------------------------
|
|
192
|
-
|
|
193
155
|
@Composable
|
|
194
156
|
private fun DefaultTabBar(
|
|
195
157
|
tabs: List<TabViewItem>,
|
|
@@ -240,24 +202,10 @@ private fun DefaultTabBar(
|
|
|
240
202
|
}
|
|
241
203
|
|
|
242
204
|
// Animated underline indicator
|
|
243
|
-
|
|
244
|
-
modifier = Modifier
|
|
245
|
-
.align(Alignment.BottomStart)
|
|
246
|
-
.offset(x = indicatorOffsetX)
|
|
247
|
-
.width(indicatorWidth)
|
|
248
|
-
.height(2.dp)
|
|
249
|
-
.background(
|
|
250
|
-
color = selectedColor,
|
|
251
|
-
shape = RoundedCornerShape(topStart = Radius.XXS, topEnd = Radius.XXS),
|
|
252
|
-
),
|
|
253
|
-
)
|
|
205
|
+
TabUnderlineIndicator(offsetX = indicatorOffsetX, width = indicatorWidth, color = selectedColor)
|
|
254
206
|
}
|
|
255
207
|
}
|
|
256
208
|
|
|
257
|
-
// ---------------------------------------------------------------------------
|
|
258
|
-
// Scrollable tab bar
|
|
259
|
-
// ---------------------------------------------------------------------------
|
|
260
|
-
|
|
261
209
|
@Composable
|
|
262
210
|
private fun ScrollableTabBar(
|
|
263
211
|
tabs: List<TabViewItem>,
|
|
@@ -338,24 +286,14 @@ private fun ScrollableTabBar(
|
|
|
338
286
|
}
|
|
339
287
|
|
|
340
288
|
// Animated underline indicator aligned to bottom of the bar
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
.width((animatedWidth - Spacing.XS * 2).coerceAtLeast(0.dp))
|
|
346
|
-
.height(2.dp)
|
|
347
|
-
.background(
|
|
348
|
-
color = selectedColor,
|
|
349
|
-
shape = RoundedCornerShape(topStart = Radius.XXS, topEnd = Radius.XXS),
|
|
350
|
-
),
|
|
289
|
+
TabUnderlineIndicator(
|
|
290
|
+
offsetX = animatedX - scrollOffsetDp + Spacing.XS,
|
|
291
|
+
width = (animatedWidth - Spacing.XS * 2).coerceAtLeast(0.dp),
|
|
292
|
+
color = selectedColor,
|
|
351
293
|
)
|
|
352
294
|
}
|
|
353
295
|
}
|
|
354
296
|
|
|
355
|
-
// ---------------------------------------------------------------------------
|
|
356
|
-
// Card tab bar
|
|
357
|
-
// ---------------------------------------------------------------------------
|
|
358
|
-
|
|
359
297
|
@Composable
|
|
360
298
|
private fun CardTabBar(
|
|
361
299
|
tabs: List<TabViewItem>,
|
|
@@ -394,17 +332,7 @@ private fun CardTabBar(
|
|
|
394
332
|
contentAlignment = Alignment.Center,
|
|
395
333
|
) {
|
|
396
334
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
|
397
|
-
|
|
398
|
-
tab.renderIcon.invoke(isActive)
|
|
399
|
-
Spacer(modifier = Modifier.width(Spacing.XS))
|
|
400
|
-
} else if (tab.icon != null) {
|
|
401
|
-
Icon(
|
|
402
|
-
source = tab.icon,
|
|
403
|
-
size = 18.dp,
|
|
404
|
-
color = iconColor,
|
|
405
|
-
)
|
|
406
|
-
Spacer(modifier = Modifier.width(Spacing.XS))
|
|
407
|
-
}
|
|
335
|
+
TabLeadingIcon(tab = tab, active = isActive, color = iconColor)
|
|
408
336
|
Text(
|
|
409
337
|
text = tab.title,
|
|
410
338
|
style = if (isActive) Typography.headerSSemibold else Typography.bodyDefaultRegular,
|
|
@@ -413,23 +341,13 @@ private fun CardTabBar(
|
|
|
413
341
|
overflow = TextOverflow.Ellipsis,
|
|
414
342
|
modifier = Modifier.weight(1f, fill = false),
|
|
415
343
|
)
|
|
416
|
-
|
|
417
|
-
Spacer(modifier = Modifier.width(Spacing.XS))
|
|
418
|
-
BadgeDot(size = tab.dotSize)
|
|
419
|
-
} else if (!tab.badgeValue.isNullOrEmpty()) {
|
|
420
|
-
Spacer(modifier = Modifier.width(Spacing.XS))
|
|
421
|
-
Badge(label = tab.badgeValue, modifier = Modifier)
|
|
422
|
-
}
|
|
344
|
+
TabTrailingBadge(tab)
|
|
423
345
|
}
|
|
424
346
|
}
|
|
425
347
|
}
|
|
426
348
|
}
|
|
427
349
|
}
|
|
428
350
|
|
|
429
|
-
// ---------------------------------------------------------------------------
|
|
430
|
-
// Shared tab item used by DefaultTabBar and ScrollableTabBar
|
|
431
|
-
// ---------------------------------------------------------------------------
|
|
432
|
-
|
|
433
351
|
@Composable
|
|
434
352
|
private fun TabItemView(
|
|
435
353
|
modifier: Modifier = Modifier,
|
|
@@ -500,17 +418,7 @@ private fun TabItemView(
|
|
|
500
418
|
horizontalArrangement = Arrangement.Center,
|
|
501
419
|
verticalAlignment = Alignment.CenterVertically,
|
|
502
420
|
) {
|
|
503
|
-
|
|
504
|
-
tab.renderIcon.invoke(active)
|
|
505
|
-
Spacer(modifier = Modifier.width(Spacing.XS))
|
|
506
|
-
} else if (tab.icon != null) {
|
|
507
|
-
Icon(
|
|
508
|
-
source = tab.icon,
|
|
509
|
-
size = 18.dp,
|
|
510
|
-
color = textColor,
|
|
511
|
-
)
|
|
512
|
-
Spacer(modifier = Modifier.width(Spacing.XS))
|
|
513
|
-
}
|
|
421
|
+
TabLeadingIcon(tab = tab, active = active, color = textColor)
|
|
514
422
|
Text(
|
|
515
423
|
text = tab.title,
|
|
516
424
|
style = textStyle,
|
|
@@ -519,13 +427,44 @@ private fun TabItemView(
|
|
|
519
427
|
overflow = TextOverflow.Ellipsis,
|
|
520
428
|
modifier = if (scrollable) Modifier else Modifier.weight(1f, fill = false),
|
|
521
429
|
)
|
|
522
|
-
|
|
523
|
-
Spacer(modifier = Modifier.width(Spacing.XS))
|
|
524
|
-
BadgeDot(size = tab.dotSize)
|
|
525
|
-
} else if (!tab.badgeValue.isNullOrEmpty()) {
|
|
526
|
-
Spacer(modifier = Modifier.width(Spacing.XS))
|
|
527
|
-
Badge(label = tab.badgeValue, modifier = Modifier)
|
|
528
|
-
}
|
|
430
|
+
TabTrailingBadge(tab)
|
|
529
431
|
}
|
|
530
432
|
}
|
|
531
433
|
}
|
|
434
|
+
|
|
435
|
+
@Composable
|
|
436
|
+
private fun BoxScope.TabUnderlineIndicator(offsetX: Dp, width: Dp, color: Color) {
|
|
437
|
+
Box(
|
|
438
|
+
modifier = Modifier
|
|
439
|
+
.align(Alignment.BottomStart)
|
|
440
|
+
.offset(x = offsetX)
|
|
441
|
+
.width(width)
|
|
442
|
+
.height(2.dp)
|
|
443
|
+
.background(
|
|
444
|
+
color = color,
|
|
445
|
+
shape = RoundedCornerShape(topStart = Radius.XXS, topEnd = Radius.XXS),
|
|
446
|
+
),
|
|
447
|
+
)
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
@Composable
|
|
451
|
+
private fun TabLeadingIcon(tab: TabViewItem, active: Boolean, color: Color) {
|
|
452
|
+
if (tab.renderIcon != null) {
|
|
453
|
+
tab.renderIcon.invoke(active)
|
|
454
|
+
Spacer(modifier = Modifier.width(Spacing.XS))
|
|
455
|
+
} else if (tab.icon != null) {
|
|
456
|
+
Icon(source = tab.icon, size = 18.dp, color = color)
|
|
457
|
+
Spacer(modifier = Modifier.width(Spacing.XS))
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
@Composable
|
|
462
|
+
private fun TabTrailingBadge(tab: TabViewItem) {
|
|
463
|
+
if (tab.showDot) {
|
|
464
|
+
Spacer(modifier = Modifier.width(Spacing.XS))
|
|
465
|
+
BadgeDot(size = tab.dotSize)
|
|
466
|
+
} else if (!tab.badgeValue.isNullOrEmpty()) {
|
|
467
|
+
Spacer(modifier = Modifier.width(Spacing.XS))
|
|
468
|
+
Badge(label = tab.badgeValue, modifier = Modifier)
|
|
469
|
+
}
|
|
470
|
+
}
|
|
@@ -13,11 +13,7 @@ import androidx.compose.ui.Modifier
|
|
|
13
13
|
import androidx.compose.ui.graphics.Color
|
|
14
14
|
import androidx.compose.ui.unit.dp
|
|
15
15
|
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
16
|
-
import vn.momo.kits.const
|
|
17
|
-
import vn.momo.kits.const.Radius
|
|
18
|
-
import vn.momo.kits.const.Spacing
|
|
19
|
-
import vn.momo.kits.const.Typography
|
|
20
|
-
import vn.momo.kits.const.scaleSize
|
|
16
|
+
import vn.momo.kits.const.*
|
|
21
17
|
import vn.momo.kits.modifier.conditional
|
|
22
18
|
|
|
23
19
|
enum class TagSize(val height: Float) {
|
|
@@ -15,11 +15,7 @@ import androidx.compose.ui.text.style.TextOverflow
|
|
|
15
15
|
import androidx.compose.ui.unit.TextUnit
|
|
16
16
|
import androidx.compose.ui.unit.dp
|
|
17
17
|
import vn.momo.kits.application.IsShowBaseLineDebug
|
|
18
|
-
import vn.momo.kits.const
|
|
19
|
-
import vn.momo.kits.const.Colors
|
|
20
|
-
import vn.momo.kits.const.Typography
|
|
21
|
-
import vn.momo.kits.const.getFontFamily
|
|
22
|
-
import vn.momo.kits.const.scaleSize
|
|
18
|
+
import vn.momo.kits.const.*
|
|
23
19
|
import vn.momo.kits.modifier.conditional
|
|
24
20
|
import vn.momo.kits.modifier.setAutomationId
|
|
25
21
|
|
|
@@ -3,18 +3,7 @@ package vn.momo.kits.components
|
|
|
3
3
|
import androidx.compose.foundation.background
|
|
4
4
|
import androidx.compose.foundation.border
|
|
5
5
|
import androidx.compose.foundation.clickable
|
|
6
|
-
import androidx.compose.foundation.layout
|
|
7
|
-
import androidx.compose.foundation.layout.Box
|
|
8
|
-
import androidx.compose.foundation.layout.Column
|
|
9
|
-
import androidx.compose.foundation.layout.IntrinsicSize
|
|
10
|
-
import androidx.compose.foundation.layout.Row
|
|
11
|
-
import androidx.compose.foundation.layout.Spacer
|
|
12
|
-
import androidx.compose.foundation.layout.fillMaxHeight
|
|
13
|
-
import androidx.compose.foundation.layout.fillMaxWidth
|
|
14
|
-
import androidx.compose.foundation.layout.height
|
|
15
|
-
import androidx.compose.foundation.layout.padding
|
|
16
|
-
import androidx.compose.foundation.layout.size
|
|
17
|
-
import androidx.compose.foundation.layout.width
|
|
6
|
+
import androidx.compose.foundation.layout.*
|
|
18
7
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
19
8
|
import androidx.compose.runtime.Composable
|
|
20
9
|
import androidx.compose.ui.Alignment
|