@momo-kits/native-kits 0.162.2-sp.7-debug → 0.162.2-sp.8-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 +15 -1
- package/CLAUDE.md +78 -0
- package/compose/build.gradle.kts +12 -31
- package/compose/build.gradle.kts.backup +11 -30
- package/compose/compose.podspec +1 -1
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/OsFontScale.android.kt +7 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +2 -7
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +8 -11
- 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 +8 -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 +42 -65
- 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 +4 -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/KitFontScale.kt +22 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +11 -20
- 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 +9 -15
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +36 -24
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +48 -33
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +67 -61
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +6 -13
- 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/OsFontScale.kt +9 -0
- 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/OsFontScale.ios.kt +66 -0
- 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/ApplicationEnvironment.swift +4 -2
- package/ios/Application/Components.swift +16 -0
- package/ios/Application/Localize.swift +277 -0
- package/ios/Application/MaxApi.swift +18 -0
- package/ios/Application/Navigation/BottomTab/BottomTab.swift +1 -0
- package/ios/Application/Navigation/NavigationContainer.swift +27 -3
- package/ios/Application/Navigation/Navigator.swift +50 -29
- package/ios/Application/Navigation/Overplay/BottomSheet.swift +87 -19
- package/ios/Application/Navigation/Overplay/ModalScreen.swift +6 -0
- package/ios/Application/Navigation/Tracking/ScreenTracker.swift +117 -0
- package/ios/Application/Screen.swift +1 -1
- package/ios/Application/StackScreen.swift +49 -1
- package/ios/Badge/BadgeRibbon.swift +80 -0
- package/ios/Button/Button.swift +68 -12
- package/ios/Carousel/Carousel.swift +16 -1
- package/ios/Checkbox/Checkbox.swift +14 -20
- package/ios/Chip/Chip.swift +35 -26
- package/ios/Collapse/Collapse.swift +11 -1
- package/ios/Colors+Radius+Spacing/Colors.swift +9 -6
- package/ios/Colors+Radius+Spacing/Spacing.swift +3 -1
- package/ios/DateTimePicker/DateTimePicker.swift +4 -2
- package/ios/DateTimePicker/WheelPicker.swift +7 -3
- package/ios/Extensions/ActiveOpacityButtonStyle.swift +14 -0
- package/ios/Extensions/Color++.swift +5 -2
- package/ios/Icon/Icon.swift +5 -1
- package/ios/IconButton/IconButton.swift +35 -7
- 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 +31 -8
- package/ios/Input/InputPhoneNumber.swift +14 -3
- package/ios/Input/InputSearch.swift +7 -1
- package/ios/Input/InputTextArea.swift +78 -34
- package/ios/InputDropDown/InputDropDown.swift +4 -1
- package/ios/InputMoney/InputMoney.swift +16 -4
- package/ios/PARITY_AUDIT.md +641 -0
- package/ios/Popup/PopupDisplay.swift +3 -4
- package/ios/Popup/PopupNotify.swift +3 -4
- package/ios/Popup/PopupPromotion.swift +16 -8
- package/ios/ProgressInfo/ProgressInfo.swift +4 -2
- package/ios/Radio/Radio.swift +12 -13
- package/ios/Rating/Rating.swift +1 -1
- package/ios/Stepper/Stepper.swift +2 -2
- package/ios/Steps/Steps.swift +22 -6
- package/ios/SuggestAction/SuggestAction.swift +5 -3
- package/ios/Swipeable/SwipeCell.swift +5 -3
- package/ios/Switch/Switch.swift +53 -28
- package/ios/TabView/TabView.swift +18 -14
- package/ios/Template/TrustBanner/TrustBanner.swift +6 -7
- package/ios/Tooltip/Tooltip.swift +3 -0
- package/ios/Typography/FontScaleStore.swift +19 -0
- package/ios/Typography/Text.swift +3 -0
- package/ios/Typography/Typography.swift +8 -5
- package/ios/Uploader/Uploader.swift +0 -9
- package/ios/native-kits.podspec +1 -1
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
- package/package.json +1 -1
- package/ios/Colors+Radius+Spacing/MoMoUIKitsResources.swift +0 -2
|
@@ -16,6 +16,7 @@ public struct InputPhoneNumber: View {
|
|
|
16
16
|
public var error: String
|
|
17
17
|
public var errorSpacing: Bool
|
|
18
18
|
public var loading: Bool
|
|
19
|
+
public var required: Bool
|
|
19
20
|
public var rightIcon: String
|
|
20
21
|
public var rightIconColor: Color?
|
|
21
22
|
public var autofocus: Bool
|
|
@@ -24,8 +25,9 @@ public struct InputPhoneNumber: View {
|
|
|
24
25
|
public var onBlur: (() -> Void)?
|
|
25
26
|
public var onRightIconPressed: (() -> Void)?
|
|
26
27
|
public var accessibilityLabel: String?
|
|
27
|
-
|
|
28
|
+
|
|
28
29
|
@State private var isFocused: Bool = false
|
|
30
|
+
@FocusState private var isFieldFocused: Bool
|
|
29
31
|
|
|
30
32
|
public init(
|
|
31
33
|
text: Binding<String>,
|
|
@@ -52,6 +54,7 @@ public struct InputPhoneNumber: View {
|
|
|
52
54
|
self.error = error
|
|
53
55
|
self.errorSpacing = errorSpacing
|
|
54
56
|
self.loading = loading
|
|
57
|
+
self.required = required
|
|
55
58
|
self.rightIcon = rightIcon
|
|
56
59
|
self.rightIconColor = rightIconColor
|
|
57
60
|
self.autofocus = autofocus
|
|
@@ -90,9 +93,13 @@ public struct InputPhoneNumber: View {
|
|
|
90
93
|
// Text input
|
|
91
94
|
ZStack(alignment: .leading) {
|
|
92
95
|
if text.isEmpty {
|
|
93
|
-
MomoText(
|
|
96
|
+
MomoText(
|
|
97
|
+
placeholder + (required ? " *" : ""),
|
|
98
|
+
typography: size == .small ? .headerSSemibold : .headerMBold,
|
|
99
|
+
color: theme.colors.text.hint
|
|
100
|
+
)
|
|
94
101
|
}
|
|
95
|
-
|
|
102
|
+
|
|
96
103
|
TextField("", text: textBinding, onEditingChanged: { focused in
|
|
97
104
|
handleFocusChange(focused)
|
|
98
105
|
})
|
|
@@ -102,6 +109,10 @@ public struct InputPhoneNumber: View {
|
|
|
102
109
|
.foregroundColor(theme.colors.text.default)
|
|
103
110
|
.applyCursorColor(theme.colors.primary)
|
|
104
111
|
.lineLimit(1)
|
|
112
|
+
.focused($isFieldFocused)
|
|
113
|
+
.onAppear {
|
|
114
|
+
if autofocus { isFieldFocused = true }
|
|
115
|
+
}
|
|
105
116
|
.accessibility(identifier: accessibilityLabel ?? "")
|
|
106
117
|
.accessibilityValue(textBinding.wrappedValue.isEmpty ? placeholder : textBinding.wrappedValue)
|
|
107
118
|
}
|
|
@@ -238,7 +238,13 @@ public struct InputSearch: View {
|
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
if isFocused && !text.isEmpty {
|
|
241
|
-
SwiftButton(action: {
|
|
241
|
+
SwiftButton(action: {
|
|
242
|
+
text = ""
|
|
243
|
+
// Kotlin's clear icon fires a callback distinct from
|
|
244
|
+
// onChangeText (`onClearPress`, not ported here); route
|
|
245
|
+
// through onChangeText so clearing isn't a silent no-op.
|
|
246
|
+
onChangeText("")
|
|
247
|
+
}) {
|
|
242
248
|
Image(systemName: "xmark.circle.fill")
|
|
243
249
|
.foregroundColor(theme.colors.text.hint)
|
|
244
250
|
.frame(width: 16, height: 16)
|
|
@@ -109,6 +109,7 @@ public struct InputTextArea: View {
|
|
|
109
109
|
|
|
110
110
|
@State private var isFocused = false
|
|
111
111
|
@State private var isBlurred = false
|
|
112
|
+
@State private var floatingLabelHeight: CGFloat = 16
|
|
112
113
|
|
|
113
114
|
// Make the initializer public
|
|
114
115
|
public init(
|
|
@@ -182,45 +183,88 @@ public struct InputTextArea: View {
|
|
|
182
183
|
}
|
|
183
184
|
}
|
|
184
185
|
.padding(.horizontal, Spacing.S)
|
|
186
|
+
.background(
|
|
187
|
+
GeometryReader { geo in
|
|
188
|
+
Color.clear.onAppear { floatingLabelHeight = geo.size.height }
|
|
189
|
+
}
|
|
190
|
+
)
|
|
185
191
|
.background(theme.colors.background.surface)
|
|
186
|
-
|
|
192
|
+
// Kotlin centers the label within the box-height-tall decorationBox
|
|
193
|
+
// by default, then applies `offsetY = -scaleHeight / 2` — net effect:
|
|
194
|
+
// the label ends up centered exactly on the box's top border. Our
|
|
195
|
+
// ZStack anchors top-leading instead, so matching that requires
|
|
196
|
+
// offsetting by half the label's OWN measured height, not half the
|
|
197
|
+
// (104pt-tall) text-area box height.
|
|
198
|
+
.offset(x: Spacing.S, y: -floatingLabelHeight / 2)
|
|
187
199
|
.zIndex(10)
|
|
188
200
|
}
|
|
189
|
-
|
|
201
|
+
|
|
190
202
|
VStack {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
203
|
+
HStack(alignment: .top, spacing: 0) {
|
|
204
|
+
ZStack(alignment: .topLeading) {
|
|
205
|
+
if text.isEmpty {
|
|
206
|
+
Text(placeholder)
|
|
207
|
+
.foregroundColor(disabled ? theme.colors.text.disable : theme.colors.text.hint)
|
|
208
|
+
.font(.system(size: 16, weight: fontWeight))
|
|
209
|
+
.padding(.horizontal, 16)
|
|
210
|
+
.padding(.vertical, 12)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
UITextViewWrapper(
|
|
214
|
+
text: $text,
|
|
215
|
+
maxLength: maxLength,
|
|
216
|
+
textColor: disabled ? theme.colors.text.disable : theme.colors.text.default,
|
|
217
|
+
cursorColor: theme.colors.primary,
|
|
218
|
+
fontWeight: fontWeight,
|
|
219
|
+
disabled: disabled,
|
|
220
|
+
onChangeText: onChangeText,
|
|
221
|
+
onDone: {
|
|
222
|
+
// Handle done action if needed
|
|
223
|
+
},
|
|
224
|
+
onFocus: {
|
|
225
|
+
isFocused = true
|
|
226
|
+
onFocus()
|
|
227
|
+
}, onBlur: {
|
|
228
|
+
isFocused = false
|
|
229
|
+
isBlurred = true
|
|
230
|
+
onBlur()
|
|
231
|
+
})
|
|
232
|
+
.frame(height: height)
|
|
233
|
+
.padding(.horizontal, 12)
|
|
234
|
+
.padding(.vertical, 8)
|
|
235
|
+
.disabled(disabled)
|
|
198
236
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
.
|
|
222
|
-
|
|
223
|
-
|
|
237
|
+
.frame(maxWidth: .infinity)
|
|
238
|
+
|
|
239
|
+
// Clear button (mirrors Compose: focused + non-empty).
|
|
240
|
+
if isFocused && !text.isEmpty {
|
|
241
|
+
SwiftUI.Button(action: {
|
|
242
|
+
text = ""
|
|
243
|
+
onChangeText("")
|
|
244
|
+
}) {
|
|
245
|
+
Icon(source: "24_navigation_close_circle_full", size: 16, color: theme.colors.text.hint)
|
|
246
|
+
}
|
|
247
|
+
.padding(.leading, Spacing.XS)
|
|
248
|
+
.padding(.top, 12)
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Loading indicator and right icon (independent, mirrors
|
|
252
|
+
// Compose's RenderRightIcon: both can render at once).
|
|
253
|
+
if loading {
|
|
254
|
+
ActivityIndicator(isAnimating: .constant(true), style: .medium)
|
|
255
|
+
.frame(width: 16, height: 16)
|
|
256
|
+
.padding(.leading, Spacing.XS)
|
|
257
|
+
.padding(.top, 12)
|
|
258
|
+
}
|
|
259
|
+
if !icon.isEmpty {
|
|
260
|
+
SwiftUI.Button(action: onRightIconPressed) {
|
|
261
|
+
Icon(source: icon, size: 24, color: disabled ? theme.colors.text.disable : (iconColor ?? theme.colors.text.default))
|
|
262
|
+
}
|
|
263
|
+
.padding(.leading, Spacing.XS)
|
|
264
|
+
.padding(.top, 12)
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
224
268
|
HStack {
|
|
225
269
|
Spacer()
|
|
226
270
|
MomoText("\(text.count)/\(maxLength)", typography: .descriptionXsRegular, color: theme.colors.text.hint)
|
|
@@ -16,10 +16,13 @@ private struct RenderRightIcon: View {
|
|
|
16
16
|
let onPressed: () -> Void
|
|
17
17
|
|
|
18
18
|
var body: some View {
|
|
19
|
+
// Mirrors Compose's two independent `if` blocks: loading spinner and icon
|
|
20
|
+
// can both render at once, not exclusively (not an if/else).
|
|
19
21
|
if loading {
|
|
20
22
|
ActivityIndicator(isAnimating: .constant(true), style: .medium)
|
|
21
23
|
.frame(width: 16, height: 16)
|
|
22
|
-
}
|
|
24
|
+
}
|
|
25
|
+
if !icon.isEmpty {
|
|
23
26
|
SwiftUI.Button(action: onPressed) {
|
|
24
27
|
Icon(source: icon, size: 24, color: color)
|
|
25
28
|
}
|
|
@@ -75,6 +75,7 @@ public struct InputMoney: View {
|
|
|
75
75
|
public var onBlur: (() -> Void)?
|
|
76
76
|
|
|
77
77
|
@State private var isFocused: Bool = false
|
|
78
|
+
@State private var floatingLabelHeight: CGFloat = 16
|
|
78
79
|
|
|
79
80
|
public init(
|
|
80
81
|
text: Binding<String>,
|
|
@@ -141,8 +142,18 @@ public struct InputMoney: View {
|
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
144
|
.padding(.horizontal, Spacing.S)
|
|
145
|
+
.background(
|
|
146
|
+
GeometryReader { geo in
|
|
147
|
+
Color.clear.onAppear { floatingLabelHeight = geo.size.height }
|
|
148
|
+
}
|
|
149
|
+
)
|
|
144
150
|
.background(theme.colors.background.surface)
|
|
145
|
-
|
|
151
|
+
// Kotlin centers the label within the box-height-tall decorationBox by
|
|
152
|
+
// default, then applies `offsetY = -size.values.height / 2` — net effect:
|
|
153
|
+
// the label ends up centered exactly on the box's top border. Our ZStack
|
|
154
|
+
// anchors top-leading instead, so matching that requires offsetting by
|
|
155
|
+
// half the label's OWN measured height, not half the box height.
|
|
156
|
+
.offset(x: Spacing.S, y: -floatingLabelHeight / 2)
|
|
146
157
|
.zIndex(10)
|
|
147
158
|
}
|
|
148
159
|
|
|
@@ -188,13 +199,14 @@ public struct InputMoney: View {
|
|
|
188
199
|
}
|
|
189
200
|
}
|
|
190
201
|
|
|
191
|
-
// Loading indicator
|
|
202
|
+
// Loading indicator and right icon can both render (mirrors
|
|
203
|
+
// Compose's two independent `if` blocks, not if/else).
|
|
192
204
|
if loading {
|
|
193
205
|
ActivityIndicator(isAnimating: .constant(true), style: .medium)
|
|
194
206
|
.frame(width: 16, height: 16)
|
|
195
207
|
.padding(.leading, Spacing.S)
|
|
196
|
-
}
|
|
197
|
-
|
|
208
|
+
}
|
|
209
|
+
if !icon.isEmpty {
|
|
198
210
|
SwiftUI.Button(action: { onPressIcon?() }) {
|
|
199
211
|
Icon(source: icon, size: 24, color: iconTintColor)
|
|
200
212
|
.padding(.leading, Spacing.S)
|