2022-01-12 10:27:49 +00:00
|
|
|
package dev.inmo.jsuikit.elements
|
2021-12-22 08:38:12 +00:00
|
|
|
|
|
|
|
import androidx.compose.runtime.*
|
2022-01-12 10:30:45 +00:00
|
|
|
import dev.inmo.jsuikit.modifers.UIKitModifier
|
|
|
|
import dev.inmo.jsuikit.modifers.include
|
2021-12-22 08:38:12 +00:00
|
|
|
import org.jetbrains.compose.web.attributes.*
|
|
|
|
import org.jetbrains.compose.web.dom.Input
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
fun <T> TextField(
|
|
|
|
type: InputType<T>,
|
|
|
|
state: MutableState<T>,
|
|
|
|
disabledState: State<Boolean>? = null,
|
|
|
|
placeholder: String? = null,
|
|
|
|
vararg modifiers: UIKitModifier
|
|
|
|
) {
|
|
|
|
Input(type) {
|
|
|
|
classes("uk-input")
|
|
|
|
include(*modifiers)
|
|
|
|
|
|
|
|
placeholder ?.let(::placeholder)
|
|
|
|
|
|
|
|
onChange { state.value = it.value }
|
|
|
|
disabledState ?.let {
|
|
|
|
if (it.value) {
|
|
|
|
disabled()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|