now StandardInput uses callback with input receiver

This commit is contained in:
InsanusMokrassar 2023-03-05 18:15:12 +06:00
parent 6502e0923e
commit 1eb14becde
1 changed files with 5 additions and 3 deletions

View File

@ -16,7 +16,7 @@ fun <T> StandardInput(
disabled: Boolean = false, disabled: Boolean = false,
placeholder: String? = null, placeholder: String? = null,
attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {}, attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {},
onChange: (T) -> Unit onChange: HTMLInputElement.(T) -> Unit
) { ) {
Input(type) { Input(type) {
classes("uk-input") classes("uk-input")
@ -32,7 +32,7 @@ fun <T> StandardInput(
} }
} }
onInput { onChange(it.value) } onInput { event -> event.target.onChange(event.value) }
if (disabled) { if (disabled) {
disabled() disabled()
@ -51,7 +51,9 @@ fun <T> DefaultInput(
vararg modifiers: UIKitModifier, vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {}, attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {},
onChange: (T) -> Unit onChange: (T) -> Unit
) = StandardInput(type, value, modifiers = modifiers, disabled, placeholder, attributesCustomizer, onChange) ) = StandardInput(type, value, modifiers = modifiers, disabled, placeholder, attributesCustomizer) {
onChange(it)
}
@Composable @Composable
fun <T> StandardInput( fun <T> StandardInput(