diff --git a/CHANGELOG.md b/CHANGELOG.md index 650bc03..56c5668 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.0.27 + +* `TextField` has been renamed to `StandardInput` +* `StandardInput` now will look for changes in state + ## 0.0.26 * Add UIKitColumn diff --git a/gradle.properties b/gradle.properties index a708c80..47d4930 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,4 +9,4 @@ android.enableJetifier=true # Project data group=dev.inmo -version=0.0.26 +version=0.0.27 diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/TextField.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/StandardInput.kt similarity index 55% rename from src/jsMain/kotlin/dev/inmo/jsuikit/elements/TextField.kt rename to src/jsMain/kotlin/dev/inmo/jsuikit/elements/StandardInput.kt index af8a0a2..85044fa 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/TextField.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/StandardInput.kt @@ -9,7 +9,7 @@ import org.jetbrains.compose.web.dom.Input import org.w3c.dom.HTMLInputElement @Composable -fun TextField( +fun StandardInput( type: InputType, state: MutableState, disabledState: State? = null, @@ -23,7 +23,16 @@ fun TextField( placeholder ?.let(::placeholder) - onChange { state.value = it.value } + state.value.let { + when (it) { + is String -> value(it) + is Number -> value(it) + else -> {} + } + } + + onInput { state.value = it.value } + disabledState ?.let { if (it.value) { disabled() @@ -32,3 +41,14 @@ fun TextField( attributesCustomizer() } } + +@Composable +@Deprecated("Renamed", ReplaceWith("StandardInput", "dev.inmo.jsuikit.elements.StandardInput")) +fun TextField( + type: InputType, + state: MutableState, + disabledState: State? = null, + placeholder: String? = null, + vararg modifiers: UIKitModifier, + attributesCustomizer: AttrBuilderContext = {}, +) = StandardInput(type, state, disabledState, placeholder, modifiers = modifiers, attributesCustomizer)