@momo-kits/native-kits 0.169.5-beta.4-debug → 0.169.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/compose/build.gradle.kts +1 -1
- package/compose/compose.podspec +1 -1
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +4 -17
- package/gradle.properties +1 -1
- package/ios/Input/InputPhoneNumber.swift +9 -37
- package/ios/native-kits.podspec +1 -1
- package/ios-demo/MoMoUIKitsDemo.podspec +1 -1
- package/ios-demo/Sources/MoMoUIKitsDemo/SampleDemos/InputPhoneNumberDemo.swift +4 -15
- package/package.json +1 -1
package/compose/build.gradle.kts
CHANGED
package/compose/compose.podspec
CHANGED
|
@@ -66,14 +66,6 @@ private fun getBorderColor(isFocused: Boolean, error: String): Color {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
/**
|
|
70
|
-
* @param icon Deprecated: use [trailing].
|
|
71
|
-
* @param iconColor Deprecated: use [trailingColor].
|
|
72
|
-
* @param onRightIconPressed Deprecated: use [onPressTrailing].
|
|
73
|
-
* @param trailing Icon key or URL; wins over [icon] when not empty.
|
|
74
|
-
* @param trailingColor Wins over [iconColor] when set.
|
|
75
|
-
* @param onPressTrailing Wins over [onRightIconPressed] when set.
|
|
76
|
-
*/
|
|
77
69
|
@Composable
|
|
78
70
|
fun InputPhoneNumber(
|
|
79
71
|
text: MutableState<String> = remember { mutableStateOf("") },
|
|
@@ -89,9 +81,6 @@ fun InputPhoneNumber(
|
|
|
89
81
|
onFocus: () -> Unit = {},
|
|
90
82
|
onBlur: () -> Unit = {},
|
|
91
83
|
loading: Boolean = false,
|
|
92
|
-
trailing: String = "",
|
|
93
|
-
trailingColor: Color? = null,
|
|
94
|
-
onPressTrailing: (() -> Unit)? = null,
|
|
95
84
|
modifier: Modifier = Modifier,
|
|
96
85
|
inputModifier: Modifier = Modifier,
|
|
97
86
|
) {
|
|
@@ -100,11 +89,11 @@ fun InputPhoneNumber(
|
|
|
100
89
|
|
|
101
90
|
// Memoized color calculations
|
|
102
91
|
val theme = AppTheme.current
|
|
103
|
-
val colors = remember(theme, iconColor
|
|
92
|
+
val colors = remember(theme, iconColor) {
|
|
104
93
|
Triple(
|
|
105
94
|
theme.colors.text.default, // textColor
|
|
106
95
|
theme.colors.text.hint, // placeholderColor
|
|
107
|
-
|
|
96
|
+
iconColor // iconTintColor
|
|
108
97
|
)
|
|
109
98
|
}
|
|
110
99
|
|
|
@@ -222,10 +211,8 @@ fun InputPhoneNumber(
|
|
|
222
211
|
}
|
|
223
212
|
}
|
|
224
213
|
|
|
225
|
-
//
|
|
226
|
-
|
|
227
|
-
val onTrailingPress = onPressTrailing ?: onRightIconPressed
|
|
228
|
-
RenderRightIcon(loading, trailingIcon, iconTintColor, onTrailingPress)
|
|
214
|
+
// Right icon (password toggle or custom icon)
|
|
215
|
+
RenderRightIcon(loading, icon, iconTintColor, onRightIconPressed)
|
|
229
216
|
}
|
|
230
217
|
}
|
|
231
218
|
},
|
package/gradle.properties
CHANGED
|
@@ -18,22 +18,13 @@ public struct InputPhoneNumber: View {
|
|
|
18
18
|
public var errorSpacing: Bool
|
|
19
19
|
public var loading: Bool
|
|
20
20
|
public var required: Bool
|
|
21
|
-
/// Deprecated: use `trailing`.
|
|
22
21
|
public var rightIcon: String
|
|
23
|
-
/// Deprecated: use `trailingColor`.
|
|
24
22
|
public var rightIconColor: Color?
|
|
25
|
-
/// Icon key or URL; wins over `rightIcon` when not empty.
|
|
26
|
-
public var trailing: String
|
|
27
|
-
/// Wins over `rightIconColor` when set.
|
|
28
|
-
public var trailingColor: Color?
|
|
29
23
|
public var autofocus: Bool
|
|
30
24
|
public var onChangeText: ((String) -> Void)?
|
|
31
25
|
public var onFocus: (() -> Void)?
|
|
32
26
|
public var onBlur: (() -> Void)?
|
|
33
|
-
/// Deprecated: use `onPressTrailing`.
|
|
34
27
|
public var onRightIconPressed: (() -> Void)?
|
|
35
|
-
/// Wins over `onRightIconPressed` when set.
|
|
36
|
-
public var onPressTrailing: (() -> Void)?
|
|
37
28
|
public var accessibilityLabel: String?
|
|
38
29
|
|
|
39
30
|
@State private var isFocused: Bool = false
|
|
@@ -50,14 +41,11 @@ public struct InputPhoneNumber: View {
|
|
|
50
41
|
required: Bool = false,
|
|
51
42
|
rightIcon: String = "",
|
|
52
43
|
rightIconColor: Color? = nil,
|
|
53
|
-
trailing: String = "",
|
|
54
|
-
trailingColor: Color? = nil,
|
|
55
44
|
autofocus: Bool = false,
|
|
56
45
|
onChangeText: ((String) -> Void)? = nil,
|
|
57
46
|
onFocus: (() -> Void)? = nil,
|
|
58
47
|
onBlur: (() -> Void)? = nil,
|
|
59
48
|
onRightIconPressed: (() -> Void)? = nil,
|
|
60
|
-
onPressTrailing: (() -> Void)? = nil,
|
|
61
49
|
accessibilityLabel: String? = nil
|
|
62
50
|
) {
|
|
63
51
|
self._text = text
|
|
@@ -70,14 +58,11 @@ public struct InputPhoneNumber: View {
|
|
|
70
58
|
self.required = required
|
|
71
59
|
self.rightIcon = rightIcon
|
|
72
60
|
self.rightIconColor = rightIconColor
|
|
73
|
-
self.trailing = trailing
|
|
74
|
-
self.trailingColor = trailingColor
|
|
75
61
|
self.autofocus = autofocus
|
|
76
62
|
self.onChangeText = onChangeText
|
|
77
63
|
self.onFocus = onFocus
|
|
78
64
|
self.onBlur = onBlur
|
|
79
65
|
self.onRightIconPressed = onRightIconPressed
|
|
80
|
-
self.onPressTrailing = onPressTrailing
|
|
81
66
|
self.accessibilityLabel = accessibilityLabel
|
|
82
67
|
}
|
|
83
68
|
|
|
@@ -144,13 +129,16 @@ public struct InputPhoneNumber: View {
|
|
|
144
129
|
.accessibilityIdentifier("ic_clear")
|
|
145
130
|
}
|
|
146
131
|
|
|
147
|
-
//
|
|
132
|
+
// Loading indicator
|
|
148
133
|
if loading {
|
|
149
|
-
ActivityIndicator(isAnimating: .constant(true), style: .medium, color:
|
|
134
|
+
ActivityIndicator(isAnimating: .constant(true), style: .medium, color: rightIconColor ?? theme.colors.text.default)
|
|
150
135
|
.frame(width: 16, height: 16)
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// ✅ Right icon
|
|
139
|
+
if !rightIcon.isEmpty {
|
|
140
|
+
SwiftUI.Button(action: { onRightIconPressed?() }) {
|
|
141
|
+
Icon(source: rightIcon, size: 24, color: rightIconColor ?? theme.colors.text.default)
|
|
154
142
|
.padding(.leading, Spacing.S)
|
|
155
143
|
}
|
|
156
144
|
}
|
|
@@ -176,23 +164,7 @@ public struct InputPhoneNumber: View {
|
|
|
176
164
|
}
|
|
177
165
|
|
|
178
166
|
// MARK: - Helpers
|
|
179
|
-
|
|
180
|
-
private var trailingIcon: String {
|
|
181
|
-
return trailing.isEmpty ? rightIcon : trailing
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
private var trailingTint: Color {
|
|
185
|
-
return trailingColor ?? rightIconColor ?? theme.colors.text.default
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
private func pressTrailing() {
|
|
189
|
-
if let onPressTrailing {
|
|
190
|
-
onPressTrailing()
|
|
191
|
-
return
|
|
192
|
-
}
|
|
193
|
-
onRightIconPressed?()
|
|
194
|
-
}
|
|
195
|
-
|
|
167
|
+
|
|
196
168
|
private func handleFocusChange(_ focused: Bool) {
|
|
197
169
|
guard focused != isFocused else { return }
|
|
198
170
|
isFocused = focused
|
package/ios/native-kits.podspec
CHANGED
|
@@ -28,8 +28,6 @@ private struct InputPhoneNumberPreview: View {
|
|
|
28
28
|
@State private var t3 = ""
|
|
29
29
|
@State private var t4 = ""
|
|
30
30
|
@State private var t5 = ""
|
|
31
|
-
@State private var t6 = ""
|
|
32
|
-
@State private var trailingPressCount = 0
|
|
33
31
|
|
|
34
32
|
var body: some View {
|
|
35
33
|
BasicColumnBox("Size", alignment: .leading) {
|
|
@@ -43,16 +41,7 @@ private struct InputPhoneNumberPreview: View {
|
|
|
43
41
|
InputPhoneNumber(text: $t4, placeholder: "Enter here", error: "error message")
|
|
44
42
|
}
|
|
45
43
|
BasicColumnBox("Trailing Icon", alignment: .leading) {
|
|
46
|
-
InputPhoneNumber(text: $t5, placeholder: "Phone",
|
|
47
|
-
}
|
|
48
|
-
BasicColumnBox("Trailing bấm được", alignment: .leading) {
|
|
49
|
-
InputPhoneNumber(
|
|
50
|
-
text: $t6,
|
|
51
|
-
placeholder: "Phone",
|
|
52
|
-
trailing: "Phonebook",
|
|
53
|
-
onPressTrailing: { trailingPressCount += 1 }
|
|
54
|
-
)
|
|
55
|
-
MomoText("Đã bấm icon: \(trailingPressCount)")
|
|
44
|
+
InputPhoneNumber(text: $t5, placeholder: "Phone", rightIcon: "24_ic_public", rightIconColor: Colors.pink03)
|
|
56
45
|
}
|
|
57
46
|
}
|
|
58
47
|
}
|
|
@@ -66,7 +55,7 @@ private struct InputPhoneNumberPlayground: View {
|
|
|
66
55
|
@State private var hintText = ""
|
|
67
56
|
@State private var error = ""
|
|
68
57
|
@State private var size: PlaygroundOption? = inputSizeList.first { $0.key == "small" }
|
|
69
|
-
@State private var
|
|
58
|
+
@State private var rightIcon: PlaygroundOption?
|
|
70
59
|
@State private var loading = false
|
|
71
60
|
@State private var required = false
|
|
72
61
|
|
|
@@ -81,7 +70,7 @@ private struct InputPhoneNumberPlayground: View {
|
|
|
81
70
|
error: error,
|
|
82
71
|
loading: loading,
|
|
83
72
|
required: required,
|
|
84
|
-
|
|
73
|
+
rightIcon: (rightIcon?.value as? String) ?? ""
|
|
85
74
|
)
|
|
86
75
|
},
|
|
87
76
|
params: [
|
|
@@ -89,7 +78,7 @@ private struct InputPhoneNumberPlayground: View {
|
|
|
89
78
|
.string("HintText", $hintText),
|
|
90
79
|
.string("Error", $error),
|
|
91
80
|
.radio("Size", inputSizeList, $size),
|
|
92
|
-
.option("
|
|
81
|
+
.option("RightIcon", playgroundIcons, $rightIcon),
|
|
93
82
|
.checkbox("Loading", $loading),
|
|
94
83
|
.checkbox("Required", $required),
|
|
95
84
|
]
|