@momo-kits/native-kits 0.156.4 → 0.156.5-debug
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build.gradle.kts +11 -0
- package/compose/build.gradle.kts +180 -0
- package/compose/build.gradle.kts.backup +180 -0
- package/compose/compose.podspec +54 -0
- package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +113 -0
- package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
- package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
- package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +57 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +95 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +201 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +222 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +48 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +305 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +33 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +715 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +121 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +405 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +69 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +83 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +32 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +340 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +348 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +94 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +136 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +543 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +23 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +76 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +148 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +188 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +116 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +447 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +172 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +244 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +231 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +234 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +254 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +241 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +364 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +56 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +41 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +92 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +40 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +352 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +103 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +70 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +17 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +96 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +96 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +92 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +130 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +214 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +177 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +205 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +239 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +191 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +306 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +13 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +189 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +285 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +35 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +2 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +59 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +68 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +14 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +50 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +239 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +119 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +98 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +163 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +331 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +497 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +162 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +226 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +187 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +274 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +80 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +306 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +31 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +370 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +132 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +42 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +62 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +88 -0
- package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +152 -0
- package/gradle/libs.versions.toml +57 -0
- package/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/gradle/wrapper/gradle-wrapper.properties +8 -0
- package/gradle.properties +26 -0
- package/gradlew +252 -0
- package/gradlew.bat +94 -0
- package/ios/Button/Button.swift +6 -7
- package/ios/Input/Input.swift +73 -34
- package/ios/Input/InputPhoneNumber.swift +16 -15
- package/package.json +1 -1
- package/settings.gradle.kts +52 -0
package/gradlew.bat
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
@rem
|
|
2
|
+
@rem Copyright 2015 the original author or authors.
|
|
3
|
+
@rem
|
|
4
|
+
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
@rem you may not use this file except in compliance with the License.
|
|
6
|
+
@rem You may obtain a copy of the License at
|
|
7
|
+
@rem
|
|
8
|
+
@rem https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
@rem
|
|
10
|
+
@rem Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
@rem See the License for the specific language governing permissions and
|
|
14
|
+
@rem limitations under the License.
|
|
15
|
+
@rem
|
|
16
|
+
@rem SPDX-License-Identifier: Apache-2.0
|
|
17
|
+
@rem
|
|
18
|
+
|
|
19
|
+
@if "%DEBUG%"=="" @echo off
|
|
20
|
+
@rem ##########################################################################
|
|
21
|
+
@rem
|
|
22
|
+
@rem Gradle startup script for Windows
|
|
23
|
+
@rem
|
|
24
|
+
@rem ##########################################################################
|
|
25
|
+
|
|
26
|
+
@rem Set local scope for the variables with windows NT shell
|
|
27
|
+
if "%OS%"=="Windows_NT" setlocal
|
|
28
|
+
|
|
29
|
+
set DIRNAME=%~dp0
|
|
30
|
+
if "%DIRNAME%"=="" set DIRNAME=.
|
|
31
|
+
@rem This is normally unused
|
|
32
|
+
set APP_BASE_NAME=%~n0
|
|
33
|
+
set APP_HOME=%DIRNAME%
|
|
34
|
+
|
|
35
|
+
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
|
36
|
+
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
|
37
|
+
|
|
38
|
+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
39
|
+
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
|
40
|
+
|
|
41
|
+
@rem Find java.exe
|
|
42
|
+
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
43
|
+
|
|
44
|
+
set JAVA_EXE=java.exe
|
|
45
|
+
%JAVA_EXE% -version >NUL 2>&1
|
|
46
|
+
if %ERRORLEVEL% equ 0 goto execute
|
|
47
|
+
|
|
48
|
+
echo. 1>&2
|
|
49
|
+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
|
50
|
+
echo. 1>&2
|
|
51
|
+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
|
52
|
+
echo location of your Java installation. 1>&2
|
|
53
|
+
|
|
54
|
+
goto fail
|
|
55
|
+
|
|
56
|
+
:findJavaFromJavaHome
|
|
57
|
+
set JAVA_HOME=%JAVA_HOME:"=%
|
|
58
|
+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
59
|
+
|
|
60
|
+
if exist "%JAVA_EXE%" goto execute
|
|
61
|
+
|
|
62
|
+
echo. 1>&2
|
|
63
|
+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
|
64
|
+
echo. 1>&2
|
|
65
|
+
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
|
66
|
+
echo location of your Java installation. 1>&2
|
|
67
|
+
|
|
68
|
+
goto fail
|
|
69
|
+
|
|
70
|
+
:execute
|
|
71
|
+
@rem Setup the command line
|
|
72
|
+
|
|
73
|
+
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@rem Execute Gradle
|
|
77
|
+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
|
78
|
+
|
|
79
|
+
:end
|
|
80
|
+
@rem End local scope for the variables with windows NT shell
|
|
81
|
+
if %ERRORLEVEL% equ 0 goto mainEnd
|
|
82
|
+
|
|
83
|
+
:fail
|
|
84
|
+
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
85
|
+
rem the _cmd.exe /c_ return code!
|
|
86
|
+
set EXIT_CODE=%ERRORLEVEL%
|
|
87
|
+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
|
88
|
+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
|
89
|
+
exit /b %EXIT_CODE%
|
|
90
|
+
|
|
91
|
+
:mainEnd
|
|
92
|
+
if "%OS%"=="Windows_NT" endlocal
|
|
93
|
+
|
|
94
|
+
:omega
|
package/ios/Button/Button.swift
CHANGED
|
@@ -106,11 +106,12 @@ extension ButtonSize {
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
var
|
|
109
|
+
var typographyStyle: TypographyStyle {
|
|
110
110
|
switch self {
|
|
111
|
-
case .large: return .
|
|
112
|
-
case .medium: return .
|
|
113
|
-
case .small: return .
|
|
111
|
+
case .large: return .actionDefaultBold
|
|
112
|
+
case .medium: return .actionSBold
|
|
113
|
+
case .small: return .actionXsBold
|
|
114
|
+
default : return .actionDefaultBold
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
117
|
}
|
|
@@ -180,9 +181,7 @@ public struct Button: View {
|
|
|
180
181
|
iconLeft.frame(width: size.iconSize, height: size.iconSize)
|
|
181
182
|
}
|
|
182
183
|
|
|
183
|
-
|
|
184
|
-
.font(size.font)
|
|
185
|
-
.foregroundColor(fg)
|
|
184
|
+
MomoText(title, typography: size.typographyStyle, color: fg)
|
|
186
185
|
.lineLimit(1)
|
|
187
186
|
.truncationMode(.tail)
|
|
188
187
|
|
package/ios/Input/Input.swift
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
import SwiftUI
|
|
3
|
+
import Combine
|
|
3
4
|
|
|
4
5
|
public struct Input: View {
|
|
5
6
|
@Binding public var text: String
|
|
@@ -31,7 +32,7 @@ public struct Input: View {
|
|
|
31
32
|
|
|
32
33
|
@State private var isFocused: Bool = false
|
|
33
34
|
@State private var isPasswordHidden: Bool = true
|
|
34
|
-
@
|
|
35
|
+
@State private var lastTextValue: String = ""
|
|
35
36
|
|
|
36
37
|
public init(
|
|
37
38
|
text: Binding<String>,
|
|
@@ -89,6 +90,22 @@ public struct Input: View {
|
|
|
89
90
|
|
|
90
91
|
// MARK: - Body
|
|
91
92
|
public var body: some View {
|
|
93
|
+
let textBinding = Binding<String>(
|
|
94
|
+
get: { self.text },
|
|
95
|
+
set: { newValue in
|
|
96
|
+
// For SecureField, infer focus when text changes
|
|
97
|
+
if self.secureTextEntry && !self.isFocused && newValue != self.lastTextValue {
|
|
98
|
+
DispatchQueue.main.async {
|
|
99
|
+
self.isFocused = true
|
|
100
|
+
self.onFocus?()
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
self.lastTextValue = newValue
|
|
104
|
+
self.text = newValue
|
|
105
|
+
self.onChangeText?(newValue)
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
|
|
92
109
|
VStack(alignment: .leading, spacing: 4) {
|
|
93
110
|
ZStack(alignment: .topLeading) {
|
|
94
111
|
// Floating label
|
|
@@ -127,34 +144,35 @@ public struct Input: View {
|
|
|
127
144
|
}
|
|
128
145
|
|
|
129
146
|
if secureTextEntry && isPasswordHidden {
|
|
130
|
-
SecureField("", text:
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
147
|
+
SecureField("", text: textBinding, onCommit: {
|
|
148
|
+
handleSecureFieldBlur()
|
|
149
|
+
})
|
|
150
|
+
.keyboardType(keyboardType)
|
|
151
|
+
.font(fontWeight == .bold ? .action_s_bold : .body_default_regular)
|
|
152
|
+
.foregroundColor(getTextColor())
|
|
153
|
+
.disabled(disabled || readOnly)
|
|
154
|
+
.applyPrimaryCursorColor()
|
|
155
|
+
.simultaneousGesture(TapGesture().onEnded {
|
|
156
|
+
handleSecureFieldFocus()
|
|
157
|
+
})
|
|
139
158
|
} else {
|
|
140
|
-
TextField("", text:
|
|
159
|
+
TextField("", text: textBinding, onEditingChanged: { focused in
|
|
141
160
|
handleFocusChange(focused)
|
|
142
161
|
})
|
|
143
|
-
.keyboardType(
|
|
162
|
+
.keyboardType(keyboardType)
|
|
144
163
|
.font(fontWeight == .bold ? .action_s_bold : .body_default_regular)
|
|
145
164
|
.foregroundColor(getTextColor())
|
|
146
165
|
.disabled(disabled || readOnly)
|
|
147
166
|
.applyPrimaryCursorColor()
|
|
148
|
-
.focused($isTextFieldFocused)
|
|
149
|
-
.onChange(of: text) { newValue in
|
|
150
|
-
onChangeText?(newValue)
|
|
151
|
-
}
|
|
152
167
|
}
|
|
153
168
|
}
|
|
154
169
|
|
|
155
170
|
// Clear button (only show when focused and has text)
|
|
156
171
|
if isFocused && !text.isEmpty {
|
|
157
|
-
SwiftUI.Button(action: {
|
|
172
|
+
SwiftUI.Button(action: {
|
|
173
|
+
text = ""
|
|
174
|
+
onChangeText?("")
|
|
175
|
+
}) {
|
|
158
176
|
Icon(source: "24_navigation_close_circle_full", size: 16, color: Colors.black12)
|
|
159
177
|
.padding(.leading, Spacing.S)
|
|
160
178
|
}
|
|
@@ -169,13 +187,15 @@ public struct Input: View {
|
|
|
169
187
|
|
|
170
188
|
// Right icon (password toggle or custom icon)
|
|
171
189
|
if secureTextEntry {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
190
|
+
if !text.isEmpty {
|
|
191
|
+
SwiftUI.Button(action: togglePasswordVisibility) {
|
|
192
|
+
Icon(
|
|
193
|
+
source: isPasswordHidden ? "24_security_eye_off" : "24_security_eye_open",
|
|
194
|
+
size: 24,
|
|
195
|
+
color: rightIconColor
|
|
196
|
+
)
|
|
197
|
+
.padding(.leading, Spacing.S)
|
|
198
|
+
}
|
|
179
199
|
}
|
|
180
200
|
} else if !rightIcon.isEmpty {
|
|
181
201
|
SwiftUI.Button(action: { onRightIconPressed?() }) {
|
|
@@ -204,18 +224,26 @@ public struct Input: View {
|
|
|
204
224
|
)
|
|
205
225
|
}
|
|
206
226
|
.onAppear {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
227
|
+
lastTextValue = text
|
|
228
|
+
}
|
|
229
|
+
.onReceive(NotificationCenter.default.publisher(for: UIResponder.keyboardWillHideNotification)) { _ in
|
|
230
|
+
// Reset focus when keyboard is dismissed
|
|
231
|
+
if isFocused {
|
|
232
|
+
DispatchQueue.main.async {
|
|
233
|
+
if secureTextEntry {
|
|
234
|
+
handleSecureFieldBlur()
|
|
235
|
+
} else {
|
|
236
|
+
handleFocusChange(false)
|
|
237
|
+
}
|
|
210
238
|
}
|
|
211
239
|
}
|
|
212
240
|
}
|
|
213
|
-
.
|
|
214
|
-
|
|
215
|
-
if
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
241
|
+
.onReceive(NotificationCenter.default.publisher(for: UITextField.textDidEndEditingNotification)) { _ in
|
|
242
|
+
// Reset focus when any text field ends editing
|
|
243
|
+
if isFocused && secureTextEntry {
|
|
244
|
+
DispatchQueue.main.async {
|
|
245
|
+
self.handleSecureFieldBlur()
|
|
246
|
+
}
|
|
219
247
|
}
|
|
220
248
|
}
|
|
221
249
|
}
|
|
@@ -224,7 +252,6 @@ public struct Input: View {
|
|
|
224
252
|
|
|
225
253
|
private func handleFocusChange(_ focused: Bool) {
|
|
226
254
|
isFocused = focused
|
|
227
|
-
isTextFieldFocused = focused
|
|
228
255
|
if focused {
|
|
229
256
|
onFocus?()
|
|
230
257
|
} else {
|
|
@@ -232,6 +259,18 @@ public struct Input: View {
|
|
|
232
259
|
}
|
|
233
260
|
}
|
|
234
261
|
|
|
262
|
+
private func handleSecureFieldFocus() {
|
|
263
|
+
if !isFocused {
|
|
264
|
+
isFocused = true
|
|
265
|
+
onFocus?()
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
private func handleSecureFieldBlur() {
|
|
270
|
+
isFocused = false
|
|
271
|
+
onBlur?()
|
|
272
|
+
}
|
|
273
|
+
|
|
235
274
|
private func togglePasswordVisibility() {
|
|
236
275
|
isPasswordHidden.toggle()
|
|
237
276
|
onRightIconPressed?()
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
import SwiftUI
|
|
9
|
-
|
|
10
9
|
public struct InputPhoneNumber: View {
|
|
11
10
|
@Binding public var text: String
|
|
12
11
|
|
|
@@ -18,12 +17,12 @@ public struct InputPhoneNumber: View {
|
|
|
18
17
|
public var rightIcon: String
|
|
19
18
|
public var rightIconColor: Color
|
|
20
19
|
public var autofocus: Bool
|
|
20
|
+
public var onChangeText: ((String) -> Void)?
|
|
21
21
|
public var onFocus: (() -> Void)?
|
|
22
22
|
public var onBlur: (() -> Void)?
|
|
23
23
|
public var onRightIconPressed: (() -> Void)?
|
|
24
24
|
|
|
25
25
|
@State private var isFocused: Bool = false
|
|
26
|
-
@FocusState private var isTextFieldFocused: Bool
|
|
27
26
|
|
|
28
27
|
public init(
|
|
29
28
|
text: Binding<String>,
|
|
@@ -36,6 +35,7 @@ public struct InputPhoneNumber: View {
|
|
|
36
35
|
rightIcon: String = "",
|
|
37
36
|
rightIconColor: Color = Colors.black12,
|
|
38
37
|
autofocus: Bool = false,
|
|
38
|
+
onChangeText: ((String) -> Void)? = nil,
|
|
39
39
|
onFocus: (() -> Void)? = nil,
|
|
40
40
|
onBlur: (() -> Void)? = nil,
|
|
41
41
|
onRightIconPressed: (() -> Void)? = nil
|
|
@@ -49,6 +49,7 @@ public struct InputPhoneNumber: View {
|
|
|
49
49
|
self.rightIcon = rightIcon
|
|
50
50
|
self.rightIconColor = rightIconColor
|
|
51
51
|
self.autofocus = autofocus
|
|
52
|
+
self.onChangeText = onChangeText
|
|
52
53
|
self.onFocus = onFocus
|
|
53
54
|
self.onBlur = onBlur
|
|
54
55
|
self.onRightIconPressed = onRightIconPressed
|
|
@@ -56,6 +57,14 @@ public struct InputPhoneNumber: View {
|
|
|
56
57
|
|
|
57
58
|
// MARK: - Body
|
|
58
59
|
public var body: some View {
|
|
60
|
+
let textBinding = Binding<String>(
|
|
61
|
+
get: { self.text },
|
|
62
|
+
set: { newValue in
|
|
63
|
+
self.text = newValue
|
|
64
|
+
self.onChangeText?(newValue)
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
|
|
59
68
|
VStack(alignment: .leading, spacing: 4) {
|
|
60
69
|
HStack(spacing: 0) {
|
|
61
70
|
// 🇻🇳 Flag
|
|
@@ -77,7 +86,7 @@ public struct InputPhoneNumber: View {
|
|
|
77
86
|
MomoText(placeholder, typography: size == .small ? .headerSSemibold : .headerMBold, color: Colors.black12)
|
|
78
87
|
}
|
|
79
88
|
|
|
80
|
-
TextField("", text:
|
|
89
|
+
TextField("", text: textBinding, onEditingChanged: { focused in
|
|
81
90
|
handleFocusChange(focused)
|
|
82
91
|
})
|
|
83
92
|
.keyboardType(.numberPad)
|
|
@@ -85,13 +94,14 @@ public struct InputPhoneNumber: View {
|
|
|
85
94
|
.foregroundColor(Colors.black17)
|
|
86
95
|
.applyPrimaryCursorColor()
|
|
87
96
|
.lineLimit(1)
|
|
88
|
-
.focused($isTextFieldFocused)
|
|
89
|
-
|
|
90
97
|
}
|
|
91
98
|
|
|
92
99
|
// Clear button
|
|
93
100
|
if isFocused && !text.isEmpty {
|
|
94
|
-
SwiftUI.Button(action: {
|
|
101
|
+
SwiftUI.Button(action: {
|
|
102
|
+
text = ""
|
|
103
|
+
onChangeText?("")
|
|
104
|
+
}) {
|
|
95
105
|
Icon(source: "24_navigation_close_circle_full", size: 16, color: Colors.black12)
|
|
96
106
|
.padding(.leading, Spacing.S)
|
|
97
107
|
}
|
|
@@ -129,21 +139,12 @@ public struct InputPhoneNumber: View {
|
|
|
129
139
|
hintText: hintText
|
|
130
140
|
)
|
|
131
141
|
}
|
|
132
|
-
.onAppear {
|
|
133
|
-
if autofocus {
|
|
134
|
-
// Small delay to ensure the view is fully loaded
|
|
135
|
-
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
|
136
|
-
isTextFieldFocused = true
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
// MARK: - Helpers
|
|
143
145
|
|
|
144
146
|
private func handleFocusChange(_ focused: Bool) {
|
|
145
147
|
isFocused = focused
|
|
146
|
-
isTextFieldFocused = focused
|
|
147
148
|
if focused {
|
|
148
149
|
onFocus?()
|
|
149
150
|
} else {
|
package/package.json
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import org.gradle.kotlin.dsl.maven
|
|
2
|
+
|
|
3
|
+
rootProject.name = "momo-native-kits"
|
|
4
|
+
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
|
|
5
|
+
|
|
6
|
+
pluginManagement {
|
|
7
|
+
repositories {
|
|
8
|
+
google {
|
|
9
|
+
mavenContent {
|
|
10
|
+
includeGroupAndSubgroups("androidx")
|
|
11
|
+
includeGroupAndSubgroups("com.android")
|
|
12
|
+
includeGroupAndSubgroups("com.google")
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
mavenCentral()
|
|
16
|
+
gradlePluginPortal()
|
|
17
|
+
maven {
|
|
18
|
+
url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
|
|
19
|
+
credentials {username = "download_packages"; password = "gldt-bjDqLpU_sPcHDuXau2ws" }
|
|
20
|
+
}
|
|
21
|
+
maven {
|
|
22
|
+
url = uri("http://nexus.mservice.com.vn:8081/repository/maven-public/")
|
|
23
|
+
isAllowInsecureProtocol = true
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
dependencyResolutionManagement {
|
|
29
|
+
repositories {
|
|
30
|
+
google {
|
|
31
|
+
mavenContent {
|
|
32
|
+
includeGroupAndSubgroups("androidx")
|
|
33
|
+
includeGroupAndSubgroups("com.android")
|
|
34
|
+
includeGroupAndSubgroups("com.google")
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
mavenCentral()
|
|
38
|
+
maven {
|
|
39
|
+
url = uri("https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven")
|
|
40
|
+
credentials {username = "download_packages"; password = "gldt-bjDqLpU_sPcHDuXau2ws" }
|
|
41
|
+
}
|
|
42
|
+
maven {
|
|
43
|
+
url = uri("http://nexus.mservice.com.vn:8081/repository/maven-public/")
|
|
44
|
+
isAllowInsecureProtocol = true
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
include(":compose")
|
|
50
|
+
|
|
51
|
+
include(":sample:androidApp")
|
|
52
|
+
include(":sample:shared")
|