@momo-kits/native-kits 0.110.1-sp.3 → 0.110.1-sp.5
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/src/commonMain/kotlin/vn/momo/kits/application/Components.kt +1 -0
- package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +8 -9
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +8 -3
- package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +1 -5
- package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +2 -1
- package/ios/Switch/Switch.swift +26 -26
- package/package.json +1 -1
|
@@ -50,6 +50,7 @@ import vn.momo.kits.const.AppTheme
|
|
|
50
50
|
import vn.momo.kits.const.Colors
|
|
51
51
|
import vn.momo.kits.const.Spacing
|
|
52
52
|
import vn.momo.kits.const.Typography
|
|
53
|
+
import vn.momo.kits.modifier.setAutomationId
|
|
53
54
|
import vn.momo.kits.platform.getStatusBarHeight
|
|
54
55
|
import vn.momo.kits.utils.bottomBorder
|
|
55
56
|
|
|
@@ -22,6 +22,14 @@ import vn.momo.kits.const.defaultTheme
|
|
|
22
22
|
import vn.momo.kits.platform.disableOverscroll
|
|
23
23
|
import vn.momo.kits.platform.getStatusBarHeight
|
|
24
24
|
|
|
25
|
+
val PlatformApi = staticCompositionLocalOf<Any?> { null }
|
|
26
|
+
|
|
27
|
+
interface ComposeApi {
|
|
28
|
+
fun request(funcName: String, params: String?): String
|
|
29
|
+
fun request(funcName: String, params: String?, onResponse: ((String) -> Unit)?): String
|
|
30
|
+
fun requestCallback(funcName: String, params: String?, onResponse: ((String) -> Unit)?)
|
|
31
|
+
fun removeCallback(id: String)
|
|
32
|
+
}
|
|
25
33
|
|
|
26
34
|
val AppNavigator = staticCompositionLocalOf<Navigator> {
|
|
27
35
|
error("no navigator provided!")
|
|
@@ -59,15 +67,6 @@ class Navigator {
|
|
|
59
67
|
}
|
|
60
68
|
}
|
|
61
69
|
|
|
62
|
-
val PlatformApi = staticCompositionLocalOf<Any?> { null }
|
|
63
|
-
|
|
64
|
-
interface ComposeApi {
|
|
65
|
-
fun request(funcName: String, params: String?): String
|
|
66
|
-
fun request(funcName: String, params: String?, onResponse: ((String) -> Unit)?): String
|
|
67
|
-
fun requestCallback(funcName: String, params: String?, onResponse: ((String) -> Unit)?)
|
|
68
|
-
fun removeCallback(id: String)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
70
|
@Composable
|
|
72
71
|
fun ApplicationContainer(
|
|
73
72
|
theme: Theme = defaultTheme,
|
|
@@ -45,6 +45,7 @@ import vn.momo.kits.const.AppTheme
|
|
|
45
45
|
import vn.momo.kits.const.Radius
|
|
46
46
|
import vn.momo.kits.const.Spacing
|
|
47
47
|
import vn.momo.kits.const.Typography
|
|
48
|
+
import vn.momo.kits.modifier.setAutomationId
|
|
48
49
|
|
|
49
50
|
data class InputSizeDetail(
|
|
50
51
|
val borderWidth: Dp,
|
|
@@ -178,6 +179,7 @@ fun Input(
|
|
|
178
179
|
required: Boolean = false,
|
|
179
180
|
fontWeight: InputFontWeight = InputFontWeight.REGULAR,
|
|
180
181
|
keyboardType: KeyboardType = KeyboardType.Text,
|
|
182
|
+
modifier: Modifier = Modifier,
|
|
181
183
|
) {
|
|
182
184
|
var isFocused by remember { mutableStateOf(false) }
|
|
183
185
|
var passHidden by remember { mutableStateOf(false) }
|
|
@@ -203,9 +205,12 @@ fun Input(
|
|
|
203
205
|
|
|
204
206
|
val testId = if (disabled) "input_${floatingValue}_disabled" else "input_$floatingValue"
|
|
205
207
|
|
|
206
|
-
Column(modifier = Modifier.
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
Column(modifier = Modifier.
|
|
209
|
+
setAutomationId(testId)
|
|
210
|
+
// semantics {
|
|
211
|
+
// contentDescription = floatingValue; testTag = testId
|
|
212
|
+
// }
|
|
213
|
+
) {
|
|
209
214
|
BasicTextField(
|
|
210
215
|
enabled = !disabled,
|
|
211
216
|
readOnly = readOnly,
|
|
@@ -3,9 +3,6 @@ package vn.momo.kits.components
|
|
|
3
3
|
import androidx.compose.runtime.Composable
|
|
4
4
|
import androidx.compose.ui.Modifier
|
|
5
5
|
import androidx.compose.ui.graphics.Color
|
|
6
|
-
import androidx.compose.ui.semantics.contentDescription
|
|
7
|
-
import androidx.compose.ui.semantics.semantics
|
|
8
|
-
import androidx.compose.ui.semantics.testTag
|
|
9
6
|
import androidx.compose.ui.text.TextLayoutResult
|
|
10
7
|
import androidx.compose.ui.text.TextStyle
|
|
11
8
|
import androidx.compose.ui.text.style.TextAlign
|
|
@@ -18,7 +15,6 @@ import vn.momo.kits.const.Typography
|
|
|
18
15
|
import vn.momo.kits.const.getFontFamily
|
|
19
16
|
import vn.momo.kits.const.scaleSize
|
|
20
17
|
import vn.momo.kits.modifier.setAutomationId
|
|
21
|
-
import vn.momo.kits.platform.getPlatformName
|
|
22
18
|
|
|
23
19
|
@Composable
|
|
24
20
|
fun Text(
|
|
@@ -38,7 +34,7 @@ fun Text(
|
|
|
38
34
|
val font = getFontFamily(fontFamily, style.fontWeight)
|
|
39
35
|
|
|
40
36
|
androidx.compose.material3.Text(
|
|
41
|
-
modifier = modifier.setAutomationId(accessibilityId?:text),
|
|
37
|
+
modifier = modifier.setAutomationId(accessibilityId?:text, text),
|
|
42
38
|
text = text,
|
|
43
39
|
color = color ?: AppTheme.current.colors.text.default,
|
|
44
40
|
style = style,
|
|
@@ -11,7 +11,7 @@ import androidx.compose.ui.semantics.semantics
|
|
|
11
11
|
import androidx.compose.ui.semantics.testTag
|
|
12
12
|
import vn.momo.kits.platform.getPlatformName
|
|
13
13
|
|
|
14
|
-
fun Modifier.setAutomationId(accessibilityId : String) : Modifier {
|
|
14
|
+
fun Modifier.setAutomationId(accessibilityId : String, label: String? = null) : Modifier {
|
|
15
15
|
return if (getPlatformName() == "Android") {
|
|
16
16
|
semantics {
|
|
17
17
|
contentDescription = accessibilityId
|
|
@@ -19,6 +19,7 @@ fun Modifier.setAutomationId(accessibilityId : String) : Modifier {
|
|
|
19
19
|
} else {
|
|
20
20
|
semantics {
|
|
21
21
|
testTag = accessibilityId
|
|
22
|
+
contentDescription = label ?: accessibilityId
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
}
|
package/ios/Switch/Switch.swift
CHANGED
|
@@ -12,33 +12,33 @@ public struct Switch: View{
|
|
|
12
12
|
self.onChange = onChange
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
.frame(width: 6, height: 6)
|
|
26
|
-
.background(value ? Colors.green03 : Colors.black07)
|
|
27
|
-
.clipShape(Circle())
|
|
28
|
-
.opacity(disabled ? 0.4 : 1)
|
|
15
|
+
|
|
16
|
+
public var body: some View {
|
|
17
|
+
SwiftUI.Button(action: {
|
|
18
|
+
withAnimation{
|
|
19
|
+
value.toggle()
|
|
20
|
+
onChange?(value)
|
|
21
|
+
}
|
|
22
|
+
}){
|
|
23
|
+
HStack{
|
|
24
|
+
HStack {
|
|
29
25
|
}
|
|
30
|
-
.frame(width:
|
|
31
|
-
.background(Colors.
|
|
26
|
+
.frame(width: 6, height: 6)
|
|
27
|
+
.background(value ? Colors.pink03 : Colors.black07)
|
|
32
28
|
.clipShape(Circle())
|
|
33
|
-
.
|
|
34
|
-
.padding(.trailing,5)
|
|
35
|
-
|
|
29
|
+
.opacity(disabled ? 0.4 : 1)
|
|
36
30
|
}
|
|
37
|
-
.
|
|
38
|
-
.
|
|
39
|
-
.
|
|
40
|
-
.
|
|
41
|
-
.
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
.frame(width: 14, height: 14)
|
|
32
|
+
.background(Colors.black01)
|
|
33
|
+
.clipShape(Circle())
|
|
34
|
+
.padding(.leading,5)
|
|
35
|
+
.padding(.trailing,5)
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
.disabled(disabled)
|
|
39
|
+
.frame(width: 40, height: 24, alignment: value == true ? .trailing : .leading)
|
|
40
|
+
.background(value ? Colors.pink03 : Colors.black07)
|
|
41
|
+
.clipShape(Capsule())
|
|
42
|
+
.opacity(disabled ? 0.4 : 1)
|
|
43
|
+
}
|
|
44
44
|
}
|