mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-12-22 00:27:25 +00:00
TextField -> StandardInput + fixes in it
This commit is contained in:
parent
17badd4724
commit
4a7101697a
@ -2,6 +2,9 @@
|
||||
|
||||
## 0.0.27
|
||||
|
||||
* `TextField` has been renamed to `StandardInput`
|
||||
* `StandardInput` now will look for changes in state
|
||||
|
||||
## 0.0.26
|
||||
|
||||
* Add UIKitColumn
|
||||
|
@ -9,7 +9,7 @@ import org.jetbrains.compose.web.dom.Input
|
||||
import org.w3c.dom.HTMLInputElement
|
||||
|
||||
@Composable
|
||||
fun <T> TextField(
|
||||
fun <T> StandardInput(
|
||||
type: InputType<T>,
|
||||
state: MutableState<T>,
|
||||
disabledState: State<Boolean>? = null,
|
||||
@ -23,7 +23,16 @@ fun <T> 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 <T> TextField(
|
||||
attributesCustomizer()
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Deprecated("Renamed", ReplaceWith("StandardInput", "dev.inmo.jsuikit.elements.StandardInput"))
|
||||
fun <T> TextField(
|
||||
type: InputType<T>,
|
||||
state: MutableState<T>,
|
||||
disabledState: State<Boolean>? = null,
|
||||
placeholder: String? = null,
|
||||
vararg modifiers: UIKitModifier,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {},
|
||||
) = StandardInput(type, state, disabledState, placeholder, modifiers = modifiers, attributesCustomizer)
|
Loading…
Reference in New Issue
Block a user