@expo/ui 56.0.15 → 56.0.17
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/CHANGELOG.md +47 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +54 -6
- package/android/src/main/java/expo/modules/ui/HostView.kt +0 -2
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +65 -0
- package/android/src/main/java/expo/modules/ui/NavigationBarView.kt +95 -0
- package/android/src/main/java/expo/modules/ui/RNHostView.kt +182 -6
- package/android/src/main/java/expo/modules/ui/textfield/BasicTextField.kt +203 -0
- package/android/src/main/java/expo/modules/ui/{TextFieldView.kt → textfield/TextField.kt} +63 -267
- package/android/src/main/java/expo/modules/ui/textfield/TextFieldShared.kt +299 -0
- package/build/State/useNativeState.d.ts +8 -3
- package/build/State/useNativeState.d.ts.map +1 -1
- package/build/community/pager-view/PagerView.android.d.ts.map +1 -1
- package/build/jetpack-compose/NavigationBar/index.d.ts +101 -0
- package/build/jetpack-compose/NavigationBar/index.d.ts.map +1 -0
- package/build/jetpack-compose/TextField/BasicTextField.d.ts +36 -0
- package/build/jetpack-compose/TextField/BasicTextField.d.ts.map +1 -0
- package/build/jetpack-compose/TextField/TextField.d.ts +131 -0
- package/build/jetpack-compose/TextField/TextField.d.ts.map +1 -0
- package/build/jetpack-compose/TextField/index.d.ts +3 -244
- package/build/jetpack-compose/TextField/index.d.ts.map +1 -1
- package/build/jetpack-compose/TextField/shared.d.ts +171 -0
- package/build/jetpack-compose/TextField/shared.d.ts.map +1 -0
- package/build/jetpack-compose/index.d.ts +2 -1
- package/build/jetpack-compose/index.d.ts.map +1 -1
- package/build/jetpack-compose/modifiers/index.d.ts +42 -0
- package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/DisclosureGroup/index.d.ts +11 -2
- package/build/swift-ui/DisclosureGroup/index.d.ts.map +1 -1
- package/build/swift-ui/Image/index.d.ts +7 -1
- package/build/swift-ui/Image/index.d.ts.map +1 -1
- package/build/swift-ui/Label/index.d.ts +5 -0
- package/build/swift-ui/Label/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +100 -4
- package/build/swift-ui/modifiers/index.d.ts.map +1 -1
- package/build/universal/Collapsible/index.android.d.ts +1 -1
- package/build/universal/Collapsible/index.android.d.ts.map +1 -1
- package/build/universal/Collapsible/index.d.ts +1 -1
- package/build/universal/Collapsible/index.d.ts.map +1 -1
- package/build/universal/Collapsible/index.ios.d.ts +1 -1
- package/build/universal/Collapsible/index.ios.d.ts.map +1 -1
- package/build/universal/Collapsible/types.d.ts +5 -0
- package/build/universal/Collapsible/types.d.ts.map +1 -1
- package/build/universal/TextInput/index.android.d.ts.map +1 -1
- package/build/universal/TextInput/types.d.ts +5 -1
- package/build/universal/TextInput/types.d.ts.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/BottomSheetView.swift +1 -1
- package/ios/DisclosureGroupView.swift +36 -13
- package/ios/ImageView.swift +20 -14
- package/ios/Label.swift +26 -2
- package/ios/Modifiers/ButtonBorderShapeModifier.swift +46 -0
- package/ios/Modifiers/DynamicTypeSizeModifier.swift +56 -0
- package/ios/Modifiers/FontModifier.swift +4 -1
- package/ios/Modifiers/ImageScaleModifier.swift +29 -0
- package/ios/Modifiers/OnGeometryChangeModifier.swift +8 -16
- package/ios/Modifiers/ViewModifierRegistry.swift +89 -8
- package/ios/SecureFieldView.swift +17 -1
- package/ios/TextFieldView.swift +33 -2
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.15/expo.modules.ui-56.0.15-sources.jar → 56.0.17/expo.modules.ui-56.0.17-sources.jar} +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.15/expo.modules.ui-56.0.15.module → 56.0.17/expo.modules.ui-56.0.17.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.15/expo.modules.ui-56.0.15.pom → 56.0.17/expo.modules.ui-56.0.17.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.pom.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
- package/package.json +4 -4
- package/src/State/index.fx.ts +4 -1
- package/src/State/useNativeState.ts +24 -13
- package/src/community/datetime-picker/DateTimePicker.tsx +1 -1
- package/src/community/menu/MenuView.ios.tsx +1 -1
- package/src/community/pager-view/PagerView.android.tsx +16 -2
- package/src/community/pager-view/PagerView.ios.tsx +1 -1
- package/src/community/picker/Picker.ios.tsx +1 -1
- package/src/community/segmented-control/SegmentedControl.ios.tsx +1 -1
- package/src/community/slider/Slider.ios.tsx +1 -1
- package/src/jetpack-compose/NavigationBar/index.tsx +174 -0
- package/src/jetpack-compose/TextField/BasicTextField.tsx +118 -0
- package/src/jetpack-compose/TextField/TextField.tsx +198 -0
- package/src/jetpack-compose/TextField/index.ts +19 -0
- package/src/jetpack-compose/TextField/{index.tsx → shared.ts} +71 -203
- package/src/jetpack-compose/index.ts +7 -0
- package/src/jetpack-compose/modifiers/index.ts +49 -0
- package/src/swift-ui/BottomSheet/index.tsx +1 -1
- package/src/swift-ui/DisclosureGroup/index.tsx +14 -2
- package/src/swift-ui/Image/index.tsx +16 -3
- package/src/swift-ui/Label/index.tsx +8 -1
- package/src/swift-ui/modifiers/index.ts +143 -5
- package/src/universal/Collapsible/index.android.tsx +10 -2
- package/src/universal/Collapsible/index.ios.tsx +17 -3
- package/src/universal/Collapsible/index.tsx +8 -2
- package/src/universal/Collapsible/types.ts +7 -0
- package/src/universal/TextInput/index.android.tsx +26 -33
- package/src/universal/TextInput/types.ts +5 -1
- package/android/src/main/java/expo/modules/ui/ShadowNodeSyncFlush.kt +0 -28
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.pom.sha512 +0 -1
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
package expo.modules.ui.textfield
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.graphics.Color
|
|
5
|
+
import androidx.compose.foundation.text.KeyboardActions
|
|
6
|
+
import androidx.compose.foundation.text.KeyboardOptions
|
|
7
|
+
import androidx.compose.runtime.Composable
|
|
8
|
+
import androidx.compose.runtime.LaunchedEffect
|
|
9
|
+
import androidx.compose.runtime.mutableStateOf
|
|
10
|
+
import androidx.compose.runtime.remember
|
|
11
|
+
import androidx.compose.ui.Modifier
|
|
12
|
+
import androidx.compose.ui.focus.FocusRequester
|
|
13
|
+
import androidx.compose.ui.focus.focusRequester
|
|
14
|
+
import androidx.compose.ui.focus.onFocusChanged
|
|
15
|
+
import androidx.compose.ui.platform.LocalFocusManager
|
|
16
|
+
import androidx.compose.ui.text.TextRange
|
|
17
|
+
import androidx.compose.ui.text.TextStyle
|
|
18
|
+
import androidx.compose.ui.text.input.ImeAction
|
|
19
|
+
import androidx.compose.ui.text.input.KeyboardCapitalization
|
|
20
|
+
import androidx.compose.ui.text.input.KeyboardType
|
|
21
|
+
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
|
22
|
+
import androidx.compose.ui.text.input.TextFieldValue
|
|
23
|
+
import androidx.compose.ui.text.input.VisualTransformation
|
|
24
|
+
import androidx.compose.ui.text.style.TextAlign
|
|
25
|
+
import androidx.compose.ui.unit.TextUnit
|
|
26
|
+
import androidx.compose.ui.unit.sp
|
|
27
|
+
import expo.modules.kotlin.records.Field
|
|
28
|
+
import expo.modules.kotlin.records.Record
|
|
29
|
+
import expo.modules.kotlin.types.OptimizedRecord
|
|
30
|
+
import expo.modules.kotlin.views.AsyncFunctionHandle
|
|
31
|
+
import expo.modules.kotlin.views.AsyncFunctionHandle2
|
|
32
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
33
|
+
import expo.modules.ui.GenericEventPayload1
|
|
34
|
+
import expo.modules.ui.ModifierList
|
|
35
|
+
import expo.modules.ui.ModifierRegistry
|
|
36
|
+
import expo.modules.ui.TextAlignType
|
|
37
|
+
import expo.modules.ui.TextFontWeight
|
|
38
|
+
import expo.modules.ui.colorToComposeColorOrNull
|
|
39
|
+
import expo.modules.ui.resolveFontFamily
|
|
40
|
+
import expo.modules.ui.state.ObservableState
|
|
41
|
+
import expo.modules.ui.state.WorkletCallback
|
|
42
|
+
|
|
43
|
+
// region Records
|
|
44
|
+
|
|
45
|
+
@OptimizedRecord
|
|
46
|
+
data class TextFieldKeyboardOptionsRecord(
|
|
47
|
+
@Field val capitalization: String? = null,
|
|
48
|
+
@Field val autoCorrectEnabled: Boolean? = null,
|
|
49
|
+
@Field val keyboardType: String? = null,
|
|
50
|
+
@Field val imeAction: String? = null
|
|
51
|
+
) : Record
|
|
52
|
+
|
|
53
|
+
@OptimizedRecord
|
|
54
|
+
data class TextFieldTextStyleRecord(
|
|
55
|
+
@Field val textAlign: TextAlignType? = null,
|
|
56
|
+
@Field val color: Color? = null,
|
|
57
|
+
@Field val fontSize: Float? = null,
|
|
58
|
+
@Field val fontFamily: String? = null,
|
|
59
|
+
@Field val fontWeight: TextFontWeight? = null,
|
|
60
|
+
@Field val lineHeight: Float? = null,
|
|
61
|
+
@Field val letterSpacing: Float? = null
|
|
62
|
+
) : Record
|
|
63
|
+
|
|
64
|
+
data class KeyboardActionEvent(
|
|
65
|
+
@Field val action: String,
|
|
66
|
+
@Field val value: String
|
|
67
|
+
) : Record
|
|
68
|
+
|
|
69
|
+
data class TextFieldSelectionPayload(
|
|
70
|
+
@Field val start: Int,
|
|
71
|
+
@Field val end: Int
|
|
72
|
+
) : Record
|
|
73
|
+
|
|
74
|
+
data class TextFieldValuePayload(
|
|
75
|
+
@Field val text: String,
|
|
76
|
+
@Field val selection: TextFieldSelectionPayload
|
|
77
|
+
) : Record
|
|
78
|
+
|
|
79
|
+
// endregion Records
|
|
80
|
+
|
|
81
|
+
// region Mappers
|
|
82
|
+
|
|
83
|
+
private fun String?.toKeyboardType(): KeyboardType = when (this) {
|
|
84
|
+
"text" -> KeyboardType.Text
|
|
85
|
+
"number" -> KeyboardType.Number
|
|
86
|
+
"email" -> KeyboardType.Email
|
|
87
|
+
"phone" -> KeyboardType.Phone
|
|
88
|
+
"decimal" -> KeyboardType.Decimal
|
|
89
|
+
"password" -> KeyboardType.Password
|
|
90
|
+
"ascii" -> KeyboardType.Ascii
|
|
91
|
+
"uri" -> KeyboardType.Uri
|
|
92
|
+
"numberPassword" -> KeyboardType.NumberPassword
|
|
93
|
+
else -> KeyboardType.Text
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private fun String?.toCapitalization(): KeyboardCapitalization = when (this) {
|
|
97
|
+
"characters" -> KeyboardCapitalization.Characters
|
|
98
|
+
"none" -> KeyboardCapitalization.None
|
|
99
|
+
"sentences" -> KeyboardCapitalization.Sentences
|
|
100
|
+
"words" -> KeyboardCapitalization.Words
|
|
101
|
+
else -> KeyboardCapitalization.None
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
private fun String?.toImeAction(): ImeAction = when (this) {
|
|
105
|
+
"default" -> ImeAction.Default
|
|
106
|
+
"none" -> ImeAction.None
|
|
107
|
+
"go" -> ImeAction.Go
|
|
108
|
+
"search" -> ImeAction.Search
|
|
109
|
+
"send" -> ImeAction.Send
|
|
110
|
+
"previous" -> ImeAction.Previous
|
|
111
|
+
"next" -> ImeAction.Next
|
|
112
|
+
"done" -> ImeAction.Done
|
|
113
|
+
else -> ImeAction.Default
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
internal fun String?.toVisualTransformation(): VisualTransformation = when (this) {
|
|
117
|
+
"password" -> PasswordVisualTransformation()
|
|
118
|
+
else -> VisualTransformation.None
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
internal fun TextFieldTextStyleRecord?.toTextStyle(context: Context?): TextStyle {
|
|
122
|
+
if (this == null) return TextStyle.Default
|
|
123
|
+
return TextStyle(
|
|
124
|
+
color = colorToComposeColorOrNull(color) ?: androidx.compose.ui.graphics.Color.Unspecified,
|
|
125
|
+
fontSize = fontSize?.sp ?: TextUnit.Unspecified,
|
|
126
|
+
fontWeight = fontWeight?.toComposeFontWeight(),
|
|
127
|
+
fontFamily = context?.let { resolveFontFamily(fontFamily, it) },
|
|
128
|
+
letterSpacing = letterSpacing?.sp ?: TextUnit.Unspecified,
|
|
129
|
+
lineHeight = lineHeight?.sp ?: TextUnit.Unspecified,
|
|
130
|
+
textAlign = textAlign?.toComposeTextAlign() ?: TextAlign.Unspecified
|
|
131
|
+
)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// endregion Mappers
|
|
135
|
+
|
|
136
|
+
// region Value helpers
|
|
137
|
+
|
|
138
|
+
private fun ObservableState.extractSelection(textLength: Int): TextRange {
|
|
139
|
+
val selMap = value as? Map<*, *>
|
|
140
|
+
val start = (selMap?.get("start") as? Number)?.toInt()?.coerceIn(0, textLength) ?: 0
|
|
141
|
+
val end = (selMap?.get("end") as? Number)?.toInt()?.coerceIn(0, textLength) ?: 0
|
|
142
|
+
return TextRange(start, end)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// endregion Value helpers
|
|
146
|
+
|
|
147
|
+
// region Shared core
|
|
148
|
+
|
|
149
|
+
class TextFieldCore(
|
|
150
|
+
val value: TextFieldValue,
|
|
151
|
+
val onValueChange: (TextFieldValue) -> Unit,
|
|
152
|
+
val keyboardOptions: KeyboardOptions,
|
|
153
|
+
val keyboardActions: KeyboardActions,
|
|
154
|
+
val modifier: Modifier
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
@Composable
|
|
158
|
+
fun FunctionalComposableScope.rememberTextFieldCore(
|
|
159
|
+
value: ObservableState,
|
|
160
|
+
selection: ObservableState,
|
|
161
|
+
maxLength: Int?,
|
|
162
|
+
autoFocus: Boolean,
|
|
163
|
+
keyboardOptionsRecord: TextFieldKeyboardOptionsRecord?,
|
|
164
|
+
modifiers: ModifierList,
|
|
165
|
+
onValueChangeSync: WorkletCallback?,
|
|
166
|
+
setText: AsyncFunctionHandle<String>,
|
|
167
|
+
setSelection: AsyncFunctionHandle2<Int, Int>,
|
|
168
|
+
clear: AsyncFunctionHandle<Unit>,
|
|
169
|
+
focus: AsyncFunctionHandle<Unit>,
|
|
170
|
+
blur: AsyncFunctionHandle<Unit>,
|
|
171
|
+
onValueChanged: (TextFieldValuePayload) -> Unit,
|
|
172
|
+
onFocusChange: (GenericEventPayload1<Boolean>) -> Unit,
|
|
173
|
+
onKeyboardActionTriggered: (KeyboardActionEvent) -> Unit,
|
|
174
|
+
onSelectionChanged: (TextFieldSelectionPayload) -> Unit
|
|
175
|
+
): TextFieldCore {
|
|
176
|
+
val focusManager = LocalFocusManager.current
|
|
177
|
+
val focusRequester = remember { FocusRequester() }
|
|
178
|
+
val state = value
|
|
179
|
+
|
|
180
|
+
setText.handle { text ->
|
|
181
|
+
state.value = text
|
|
182
|
+
// setText moves the cursor to the end; use setSelection afterwards to override.
|
|
183
|
+
selection.value = mapOf("start" to text.length, "end" to text.length)
|
|
184
|
+
}
|
|
185
|
+
focus.handle {
|
|
186
|
+
focusRequester.requestFocus()
|
|
187
|
+
}
|
|
188
|
+
blur.handle {
|
|
189
|
+
focusManager.clearFocus()
|
|
190
|
+
}
|
|
191
|
+
setSelection.handle { start, end ->
|
|
192
|
+
val text = state.value as? String ?: ""
|
|
193
|
+
val clampedStart = start.coerceIn(0, text.length)
|
|
194
|
+
val clampedEnd = end.coerceIn(0, text.length)
|
|
195
|
+
selection.value = mapOf("start" to clampedStart, "end" to clampedEnd)
|
|
196
|
+
}
|
|
197
|
+
clear.handle {
|
|
198
|
+
state.value = ""
|
|
199
|
+
selection.value = mapOf("start" to 0, "end" to 0)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Keyboard
|
|
203
|
+
val keyboardOptions = KeyboardOptions.Default.copy(
|
|
204
|
+
keyboardType = keyboardOptionsRecord?.keyboardType.toKeyboardType(),
|
|
205
|
+
autoCorrectEnabled = keyboardOptionsRecord?.autoCorrectEnabled ?: true,
|
|
206
|
+
capitalization = keyboardOptionsRecord?.capitalization.toCapitalization(),
|
|
207
|
+
imeAction = keyboardOptionsRecord?.imeAction.toImeAction()
|
|
208
|
+
)
|
|
209
|
+
val currentText = { state.value as? String ?: "" }
|
|
210
|
+
val keyboardActions = KeyboardActions(
|
|
211
|
+
onDone = {
|
|
212
|
+
defaultKeyboardAction(ImeAction.Done)
|
|
213
|
+
onKeyboardActionTriggered(KeyboardActionEvent("done", currentText()))
|
|
214
|
+
},
|
|
215
|
+
onGo = {
|
|
216
|
+
defaultKeyboardAction(ImeAction.Go)
|
|
217
|
+
onKeyboardActionTriggered(KeyboardActionEvent("go", currentText()))
|
|
218
|
+
},
|
|
219
|
+
onNext = {
|
|
220
|
+
defaultKeyboardAction(ImeAction.Next)
|
|
221
|
+
onKeyboardActionTriggered(KeyboardActionEvent("next", currentText()))
|
|
222
|
+
},
|
|
223
|
+
onPrevious = {
|
|
224
|
+
defaultKeyboardAction(ImeAction.Previous)
|
|
225
|
+
onKeyboardActionTriggered(KeyboardActionEvent("previous", currentText()))
|
|
226
|
+
},
|
|
227
|
+
onSearch = {
|
|
228
|
+
defaultKeyboardAction(ImeAction.Search)
|
|
229
|
+
onKeyboardActionTriggered(KeyboardActionEvent("search", currentText()))
|
|
230
|
+
},
|
|
231
|
+
onSend = {
|
|
232
|
+
defaultKeyboardAction(ImeAction.Send)
|
|
233
|
+
onKeyboardActionTriggered(KeyboardActionEvent("send", currentText()))
|
|
234
|
+
}
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
// Modifier
|
|
238
|
+
val modifier = ModifierRegistry.applyModifiers(modifiers, appContext, composableScope, globalEventDispatcher)
|
|
239
|
+
.focusRequester(focusRequester)
|
|
240
|
+
.onFocusChanged { focusState ->
|
|
241
|
+
onFocusChange(GenericEventPayload1(focusState.isFocused))
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (autoFocus) {
|
|
245
|
+
LaunchedEffect(Unit) { focusRequester.requestFocus() }
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
val text = state.value as? String ?: ""
|
|
249
|
+
val sel = selection.extractSelection(text.length)
|
|
250
|
+
|
|
251
|
+
val localValue = remember { mutableStateOf(TextFieldValue(text, sel)) }
|
|
252
|
+
if (localValue.value.text != text || localValue.value.selection != sel) {
|
|
253
|
+
localValue.value = TextFieldValue(text, sel)
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
val onValueChange: (TextFieldValue) -> Unit = { incoming ->
|
|
257
|
+
val new = maxLength?.let { max ->
|
|
258
|
+
if (incoming.text.length > max) {
|
|
259
|
+
val truncated = incoming.text.substring(0, max)
|
|
260
|
+
incoming.copy(
|
|
261
|
+
text = truncated,
|
|
262
|
+
selection = TextRange(
|
|
263
|
+
incoming.selection.start.coerceAtMost(max),
|
|
264
|
+
incoming.selection.end.coerceAtMost(max)
|
|
265
|
+
)
|
|
266
|
+
)
|
|
267
|
+
} else {
|
|
268
|
+
null
|
|
269
|
+
}
|
|
270
|
+
} ?: incoming
|
|
271
|
+
val prev = localValue.value
|
|
272
|
+
localValue.value = new
|
|
273
|
+
if (new.selection != prev.selection) {
|
|
274
|
+
val cur = selection.value as? Map<*, *>
|
|
275
|
+
val curStart = (cur?.get("start") as? Number)?.toInt()
|
|
276
|
+
val curEnd = (cur?.get("end") as? Number)?.toInt()
|
|
277
|
+
if (curStart != new.selection.start || curEnd != new.selection.end) {
|
|
278
|
+
selection.value = mapOf(
|
|
279
|
+
"start" to new.selection.start,
|
|
280
|
+
"end" to new.selection.end
|
|
281
|
+
)
|
|
282
|
+
}
|
|
283
|
+
onSelectionChanged(TextFieldSelectionPayload(new.selection.start, new.selection.end))
|
|
284
|
+
}
|
|
285
|
+
if (new.text != prev.text) {
|
|
286
|
+
state.value = new.text
|
|
287
|
+
val payload = TextFieldValuePayload(
|
|
288
|
+
text = new.text,
|
|
289
|
+
selection = TextFieldSelectionPayload(new.selection.start, new.selection.end)
|
|
290
|
+
)
|
|
291
|
+
onValueChanged(payload)
|
|
292
|
+
onValueChangeSync?.invoke(new.text)
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
return TextFieldCore(localValue.value, onValueChange, keyboardOptions, keyboardActions, modifier)
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// endregion Shared core
|
|
@@ -12,6 +12,14 @@ export type ObservableState<T> = SharedObject & {
|
|
|
12
12
|
* applied. Prefer writing from a worklet when you need synchronous updates
|
|
13
13
|
*/
|
|
14
14
|
value: T;
|
|
15
|
+
/**
|
|
16
|
+
* Reads the current value. A React Compiler compliant alternative to reading `.value`
|
|
17
|
+
*/
|
|
18
|
+
get(): T;
|
|
19
|
+
/**
|
|
20
|
+
* Writes a new value. A React Compiler-compliant alternative to assigning `.value`
|
|
21
|
+
*/
|
|
22
|
+
set(value: T): void;
|
|
15
23
|
/**
|
|
16
24
|
* A single listener invoked on the native UI runtime whenever the value changes
|
|
17
25
|
* (after iOS `didSet` and Android's setter). Assigning replaces the previous
|
|
@@ -30,9 +38,6 @@ export type ObservableState<T> = SharedObject & {
|
|
|
30
38
|
* 'worklet';
|
|
31
39
|
* console.log('changed to', value);
|
|
32
40
|
* };
|
|
33
|
-
* return () => {
|
|
34
|
-
* state.onChange = null;
|
|
35
|
-
* };
|
|
36
41
|
* }, []);
|
|
37
42
|
* ```
|
|
38
43
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNativeState.d.ts","sourceRoot":"","sources":["../../src/State/useNativeState.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAA4B,MAAM,mBAAmB,CAAC;AAOhF;;;GAGG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,YAAY,GAAG;IAC9C;;;;;;OAMG;IACH,KAAK,EAAE,CAAC,CAAC;IAET
|
|
1
|
+
{"version":3,"file":"useNativeState.d.ts","sourceRoot":"","sources":["../../src/State/useNativeState.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAA4B,MAAM,mBAAmB,CAAC;AAOhF;;;GAGG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,YAAY,GAAG;IAC9C;;;;;;OAMG;IACH,KAAK,EAAE,CAAC,CAAC;IAET;;OAEG;IACH,GAAG,IAAI,CAAC,CAAC;IAET;;OAEG;IACH,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAEpB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAA;KAAE,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;CAC3D,CAAC;AAEF;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAQrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PagerView.android.d.ts","sourceRoot":"","sources":["../../../src/community/pager-view/PagerView.android.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAO/D;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"PagerView.android.d.ts","sourceRoot":"","sources":["../../../src/community/pager-view/PagerView.android.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAO/D;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,2CA0H9C"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { type ColorValue } from 'react-native';
|
|
2
|
+
import { type ModifierConfig } from '../../types';
|
|
3
|
+
type SlotProps = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Colors for navigation bar items in different states.
|
|
8
|
+
*/
|
|
9
|
+
export type NavigationBarItemColors = {
|
|
10
|
+
selectedIconColor?: ColorValue;
|
|
11
|
+
selectedTextColor?: ColorValue;
|
|
12
|
+
selectedIndicatorColor?: ColorValue;
|
|
13
|
+
unselectedIconColor?: ColorValue;
|
|
14
|
+
unselectedTextColor?: ColorValue;
|
|
15
|
+
disabledIconColor?: ColorValue;
|
|
16
|
+
disabledTextColor?: ColorValue;
|
|
17
|
+
};
|
|
18
|
+
export type NavigationBarProps = {
|
|
19
|
+
/**
|
|
20
|
+
* Background color of the navigation bar.
|
|
21
|
+
* @default NavigationBarDefaults.containerColor
|
|
22
|
+
*/
|
|
23
|
+
containerColor?: ColorValue;
|
|
24
|
+
/**
|
|
25
|
+
* Preferred content color inside the navigation bar.
|
|
26
|
+
* @default contentColorFor(containerColor)
|
|
27
|
+
*/
|
|
28
|
+
contentColor?: ColorValue;
|
|
29
|
+
/**
|
|
30
|
+
* Tonal elevation in dp.
|
|
31
|
+
* @default NavigationBarDefaults.Elevation
|
|
32
|
+
*/
|
|
33
|
+
tonalElevation?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Modifiers for the component.
|
|
36
|
+
*/
|
|
37
|
+
modifiers?: ModifierConfig[];
|
|
38
|
+
/**
|
|
39
|
+
* Navigation bar items.
|
|
40
|
+
*/
|
|
41
|
+
children?: React.ReactNode;
|
|
42
|
+
};
|
|
43
|
+
export type NavigationBarItemProps = {
|
|
44
|
+
/**
|
|
45
|
+
* Whether this item is currently selected.
|
|
46
|
+
*/
|
|
47
|
+
selected: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Callback that is called when the item is clicked.
|
|
50
|
+
*/
|
|
51
|
+
onClick?: () => void;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the item is enabled.
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
enabled?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Whether to always show the label.
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
alwaysShowLabel?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Colors for the item in different states.
|
|
64
|
+
*/
|
|
65
|
+
colors?: NavigationBarItemColors;
|
|
66
|
+
/**
|
|
67
|
+
* Modifiers for the component.
|
|
68
|
+
*/
|
|
69
|
+
modifiers?: ModifierConfig[];
|
|
70
|
+
/**
|
|
71
|
+
* Children containing `Icon`, `SelectedIcon`, and `Label` slots.
|
|
72
|
+
*/
|
|
73
|
+
children?: React.ReactNode;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Icon slot for `NavigationBarItem`.
|
|
77
|
+
*/
|
|
78
|
+
declare function NavigationBarItemIcon(props: SlotProps): import("react/jsx-runtime").JSX.Element;
|
|
79
|
+
/**
|
|
80
|
+
* Selected icon slot for `NavigationBarItem`. Falls back to `Icon` when omitted.
|
|
81
|
+
*/
|
|
82
|
+
declare function NavigationBarItemSelectedIcon(props: SlotProps): import("react/jsx-runtime").JSX.Element;
|
|
83
|
+
/**
|
|
84
|
+
* Label slot for `NavigationBarItem`.
|
|
85
|
+
*/
|
|
86
|
+
declare function NavigationBarItemLabel(props: SlotProps): import("react/jsx-runtime").JSX.Element;
|
|
87
|
+
/**
|
|
88
|
+
* A Material Design 3 navigation bar.
|
|
89
|
+
*/
|
|
90
|
+
export declare function NavigationBar(props: NavigationBarProps): import("react/jsx-runtime").JSX.Element;
|
|
91
|
+
/**
|
|
92
|
+
* A Material Design 3 navigation bar item. Must be used inside `NavigationBar`.
|
|
93
|
+
*/
|
|
94
|
+
declare function NavigationBarItemComponent(props: NavigationBarItemProps): import("react/jsx-runtime").JSX.Element;
|
|
95
|
+
declare namespace NavigationBarItemComponent {
|
|
96
|
+
var Icon: typeof NavigationBarItemIcon;
|
|
97
|
+
var SelectedIcon: typeof NavigationBarItemSelectedIcon;
|
|
98
|
+
var Label: typeof NavigationBarItemLabel;
|
|
99
|
+
}
|
|
100
|
+
export { NavigationBarItemComponent as NavigationBarItem };
|
|
101
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/jetpack-compose/NavigationBar/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,aAAa,CAAC;AAGlE,KAAK,SAAS,GAAG;IACf,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAOF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,iBAAiB,CAAC,EAAE,UAAU,CAAC;IAC/B,iBAAiB,CAAC,EAAE,UAAU,CAAC;IAC/B,sBAAsB,CAAC,EAAE,UAAU,CAAC;IACpC,mBAAmB,CAAC,EAAE,UAAU,CAAC;IACjC,mBAAmB,CAAC,EAAE,UAAU,CAAC;IACjC,iBAAiB,CAAC,EAAE,UAAU,CAAC;IAC/B,iBAAiB,CAAC,EAAE,UAAU,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5B;;;OAGG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,MAAM,CAAC,EAAE,uBAAuB,CAAC;IACjC;;OAEG;IACH,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAuCF;;GAEG;AACH,iBAAS,qBAAqB,CAAC,KAAK,EAAE,SAAS,2CAE9C;AAED;;GAEG;AACH,iBAAS,6BAA6B,CAAC,KAAK,EAAE,SAAS,2CAEtD;AAED;;GAEG;AACH,iBAAS,sBAAsB,CAAC,KAAK,EAAE,SAAS,2CAE/C;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CAOtD;AAED;;GAEG;AACH,iBAAS,0BAA0B,CAAC,KAAK,EAAE,sBAAsB,2CAOhE;kBAPQ,0BAA0B;;;;;AAanC,OAAO,EAAE,0BAA0B,IAAI,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ColorValue } from 'react-native';
|
|
2
|
+
import { type CommonTextFieldProperties, type TextFieldRef } from './shared';
|
|
3
|
+
/**
|
|
4
|
+
* Imperative methods for `BasicTextField`. Identical to {@link TextFieldRef}.
|
|
5
|
+
*/
|
|
6
|
+
export type BasicTextFieldRef = TextFieldRef;
|
|
7
|
+
/**
|
|
8
|
+
* Props for `BasicTextField`. Mirrors Compose's `BasicTextField`: a bare,
|
|
9
|
+
* unstyled text field with no Material chrome (no container, indicator, or
|
|
10
|
+
* built-in padding). Shares {@link CommonTextFieldProperties} with `TextField` and
|
|
11
|
+
* `OutlinedTextField`; use `BasicTextField.DecorationBox` to add your own
|
|
12
|
+
* decoration.
|
|
13
|
+
*/
|
|
14
|
+
export type BasicTextFieldProps = CommonTextFieldProperties & {
|
|
15
|
+
/**
|
|
16
|
+
* Color of the text cursor. Maps to Compose's `cursorBrush` via
|
|
17
|
+
* `SolidColor(color)`. Defaults to the theme's primary color
|
|
18
|
+
* (`MaterialTheme.colorScheme.primary`) so it stays visible in light and dark.
|
|
19
|
+
*/
|
|
20
|
+
cursorColor?: ColorValue;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A bare, unstyled Compose `BasicTextField` with no Material decoration.
|
|
24
|
+
*/
|
|
25
|
+
declare function BasicTextFieldComponent(props: BasicTextFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
declare namespace BasicTextFieldComponent {
|
|
27
|
+
var DecorationBox: (props: {
|
|
28
|
+
children: React.ReactNode;
|
|
29
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
var InnerTextField: () => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
var Placeholder: (props: {
|
|
32
|
+
children: React.ReactNode;
|
|
33
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
}
|
|
35
|
+
export { BasicTextFieldComponent as BasicTextField };
|
|
36
|
+
//# sourceMappingURL=BasicTextField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BasicTextField.d.ts","sourceRoot":"","sources":["../../../src/jetpack-compose/TextField/BasicTextField.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,YAAY,EAElB,MAAM,UAAU,CAAC;AAKlB;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,yBAAyB,GAAG;IAC5D;;;;OAIG;IACH,WAAW,CAAC,EAAE,UAAU,CAAC;CAC1B,CAAC;AAwEF;;GAEG;AACH,iBAAS,uBAAuB,CAAC,KAAK,EAAE,mBAAmB,2CAE1D;kBAFQ,uBAAuB;+BA/BF;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;;6BAoB/B;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE;;AAqBzD,OAAO,EAAE,uBAAuB,IAAI,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { ColorValue } from 'react-native';
|
|
2
|
+
import { type CommonTextFieldProperties } from './shared';
|
|
3
|
+
import { type ObservableState } from '../../State';
|
|
4
|
+
import { type ShapeJSXElement } from '../Shape';
|
|
5
|
+
/**
|
|
6
|
+
* Colors for `TextField` and `OutlinedTextField`.
|
|
7
|
+
* Maps to `TextFieldColors` in Compose, shared by both variants.
|
|
8
|
+
*/
|
|
9
|
+
export type TextFieldColors = {
|
|
10
|
+
focusedTextColor?: ColorValue;
|
|
11
|
+
unfocusedTextColor?: ColorValue;
|
|
12
|
+
disabledTextColor?: ColorValue;
|
|
13
|
+
errorTextColor?: ColorValue;
|
|
14
|
+
focusedContainerColor?: ColorValue;
|
|
15
|
+
unfocusedContainerColor?: ColorValue;
|
|
16
|
+
disabledContainerColor?: ColorValue;
|
|
17
|
+
errorContainerColor?: ColorValue;
|
|
18
|
+
cursorColor?: ColorValue;
|
|
19
|
+
errorCursorColor?: ColorValue;
|
|
20
|
+
focusedIndicatorColor?: ColorValue;
|
|
21
|
+
unfocusedIndicatorColor?: ColorValue;
|
|
22
|
+
disabledIndicatorColor?: ColorValue;
|
|
23
|
+
errorIndicatorColor?: ColorValue;
|
|
24
|
+
focusedLeadingIconColor?: ColorValue;
|
|
25
|
+
unfocusedLeadingIconColor?: ColorValue;
|
|
26
|
+
disabledLeadingIconColor?: ColorValue;
|
|
27
|
+
errorLeadingIconColor?: ColorValue;
|
|
28
|
+
focusedTrailingIconColor?: ColorValue;
|
|
29
|
+
unfocusedTrailingIconColor?: ColorValue;
|
|
30
|
+
disabledTrailingIconColor?: ColorValue;
|
|
31
|
+
errorTrailingIconColor?: ColorValue;
|
|
32
|
+
focusedLabelColor?: ColorValue;
|
|
33
|
+
unfocusedLabelColor?: ColorValue;
|
|
34
|
+
disabledLabelColor?: ColorValue;
|
|
35
|
+
errorLabelColor?: ColorValue;
|
|
36
|
+
focusedPlaceholderColor?: ColorValue;
|
|
37
|
+
unfocusedPlaceholderColor?: ColorValue;
|
|
38
|
+
disabledPlaceholderColor?: ColorValue;
|
|
39
|
+
errorPlaceholderColor?: ColorValue;
|
|
40
|
+
focusedSupportingTextColor?: ColorValue;
|
|
41
|
+
unfocusedSupportingTextColor?: ColorValue;
|
|
42
|
+
disabledSupportingTextColor?: ColorValue;
|
|
43
|
+
errorSupportingTextColor?: ColorValue;
|
|
44
|
+
focusedPrefixColor?: ColorValue;
|
|
45
|
+
unfocusedPrefixColor?: ColorValue;
|
|
46
|
+
disabledPrefixColor?: ColorValue;
|
|
47
|
+
errorPrefixColor?: ColorValue;
|
|
48
|
+
focusedSuffixColor?: ColorValue;
|
|
49
|
+
unfocusedSuffixColor?: ColorValue;
|
|
50
|
+
disabledSuffixColor?: ColorValue;
|
|
51
|
+
errorSuffixColor?: ColorValue;
|
|
52
|
+
};
|
|
53
|
+
export type TextFieldProps = CommonTextFieldProperties & {
|
|
54
|
+
/** @default false */
|
|
55
|
+
isError?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Shape used for the field's container outline/fill. Use the helpers from
|
|
58
|
+
* `Shape` (for example, `<Shape.Pill />` or `<Shape.RoundedCorner cornerRadii={...} />`).
|
|
59
|
+
* Defaults to the Material `OutlinedTextFieldDefaults.shape`/`TextFieldDefaults.shape`.
|
|
60
|
+
*/
|
|
61
|
+
shape?: ShapeJSXElement;
|
|
62
|
+
colors?: TextFieldColors;
|
|
63
|
+
};
|
|
64
|
+
export type OutlinedTextFieldProps = CommonTextFieldProperties & {
|
|
65
|
+
/** @default false */
|
|
66
|
+
isError?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Shape used for the field's container outline/fill. Use the helpers from
|
|
69
|
+
* `Shape` (for example, `<Shape.Pill />` or `<Shape.RoundedCorner cornerRadii={...} />`).
|
|
70
|
+
* Defaults to the Material `OutlinedTextFieldDefaults.shape`/`TextFieldDefaults.shape`.
|
|
71
|
+
*/
|
|
72
|
+
shape?: ShapeJSXElement;
|
|
73
|
+
colors?: TextFieldColors;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* A Material3 `TextField`.
|
|
77
|
+
*/
|
|
78
|
+
declare function TextFieldComponent(props: TextFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
79
|
+
declare namespace TextFieldComponent {
|
|
80
|
+
var Label: (props: {
|
|
81
|
+
children: React.ReactNode;
|
|
82
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
83
|
+
var Placeholder: (props: {
|
|
84
|
+
children: React.ReactNode;
|
|
85
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
86
|
+
var LeadingIcon: (props: {
|
|
87
|
+
children: React.ReactNode;
|
|
88
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
89
|
+
var TrailingIcon: (props: {
|
|
90
|
+
children: React.ReactNode;
|
|
91
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
92
|
+
var Prefix: (props: {
|
|
93
|
+
children: React.ReactNode;
|
|
94
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
95
|
+
var Suffix: (props: {
|
|
96
|
+
children: React.ReactNode;
|
|
97
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
98
|
+
var SupportingText: (props: {
|
|
99
|
+
children: React.ReactNode;
|
|
100
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* A Material3 `OutlinedTextField` with a transparent background and border outline.
|
|
104
|
+
*/
|
|
105
|
+
declare function OutlinedTextFieldComponent(props: OutlinedTextFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
106
|
+
declare namespace OutlinedTextFieldComponent {
|
|
107
|
+
var Label: (props: {
|
|
108
|
+
children: React.ReactNode;
|
|
109
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
110
|
+
var Placeholder: (props: {
|
|
111
|
+
children: React.ReactNode;
|
|
112
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
113
|
+
var LeadingIcon: (props: {
|
|
114
|
+
children: React.ReactNode;
|
|
115
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
116
|
+
var TrailingIcon: (props: {
|
|
117
|
+
children: React.ReactNode;
|
|
118
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
119
|
+
var Prefix: (props: {
|
|
120
|
+
children: React.ReactNode;
|
|
121
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
122
|
+
var Suffix: (props: {
|
|
123
|
+
children: React.ReactNode;
|
|
124
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
125
|
+
var SupportingText: (props: {
|
|
126
|
+
children: React.ReactNode;
|
|
127
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
128
|
+
}
|
|
129
|
+
export { TextFieldComponent as TextField, OutlinedTextFieldComponent as OutlinedTextField };
|
|
130
|
+
export { type ObservableState };
|
|
131
|
+
//# sourceMappingURL=TextField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/jetpack-compose/TextField/TextField.tsx"],"names":[],"mappings":"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"}
|