Compare commits

...

17 Commits

Author SHA1 Message Date
665432cdce Merge pull request #81 from InsanusMokrassar/0.7.0
0.7.0
2023-04-13 12:10:00 +06:00
5e379ee3e2 update dependencies 2023-04-13 12:09:01 +06:00
5a86d6705b start 0.7.0 2023-04-13 12:08:43 +06:00
25134879c1 Merge pull request #80 from InsanusMokrassar/0.6.2
0.6.2
2023-03-10 22:31:03 +06:00
30a85795dd start 0.6.2 && update compose 2023-03-10 15:07:19 +06:00
730da9f759 Merge pull request #79 from InsanusMokrassar/0.6.1
0.6.1
2023-03-05 21:36:49 +06:00
8178fa9d39 value in StandardInput is nullable 2023-03-05 18:50:59 +06:00
1eb14becde now StandardInput uses callback with input receiver 2023-03-05 18:15:12 +06:00
6502e0923e DefaultInput -> StandardInput 2023-03-05 14:41:30 +06:00
443043cff5 update dependencies 2023-03-05 14:37:57 +06:00
1765214c97 remove redundant settings fromm gradle.properties 2023-03-05 14:36:16 +06:00
dcc6495030 start 0.6.1 2023-03-05 14:35:56 +06:00
1c16fb4ed7 Merge pull request #78 from InsanusMokrassar/0.6.0
0.6.0
2023-02-28 12:42:40 +06:00
a60fb67ad3 update compose 2023-02-28 12:35:34 +06:00
f8402b24d1 update dependencies 2023-02-28 12:21:43 +06:00
f70f4674ed start 0.6.0 2023-02-28 12:20:49 +06:00
7c81cea8af Merge pull request #77 from InsanusMokrassar/0.5.2
0.5.2
2023-01-26 22:44:37 +06:00
5 changed files with 62 additions and 31 deletions

View File

@@ -1,5 +1,24 @@
# Changelog # Changelog
## 0.7.0
* `Kotlin`: `1.8.20`
* `Compose`: `1.4.0`
## 0.6.2
* `Compose`: `1.3.1`
## 0.6.1
* `DefaultInput` has been renamed to `StandardInput`
* `Compose`: `1.3.1-rc02`
## 0.6.0
* `Kotlin`: `1.8.10`
* `Compose`: `1.3.1-rc01`
## 0.5.2 ## 0.5.2
* More fixes in Dialogs * More fixes in Dialogs

View File

@@ -3,10 +3,8 @@ org.gradle.parallel=true
kotlin.js.generate.externals=true kotlin.js.generate.externals=true
kotlin.incremental=true kotlin.incremental=true
kotlin.incremental.js=true kotlin.incremental.js=true
android.useAndroidX=true
android.enableJetifier=true
# Project data # Project data
group=dev.inmo group=dev.inmo
version=0.5.2 version=0.7.0

View File

@@ -1,8 +1,8 @@
[versions] [versions]
kt = "1.7.20" kt = "1.8.20"
jb-compose = "1.2.2" jb-compose = "1.4.0"
jb-dokka = "1.7.20" jb-dokka = "1.8.10"
gh-release = "2.4.1" gh-release = "2.4.1"
[libraries] [libraries]

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@@ -8,6 +8,40 @@ import org.jetbrains.compose.web.dom.AttrBuilderContext
import org.jetbrains.compose.web.dom.Input import org.jetbrains.compose.web.dom.Input
import org.w3c.dom.HTMLInputElement import org.w3c.dom.HTMLInputElement
@Composable
fun <T> StandardInput(
type: InputType<T>,
value: T? = null,
vararg modifiers: UIKitModifier,
disabled: Boolean = false,
placeholder: String? = null,
attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {},
onChange: HTMLInputElement.(T) -> Unit
) {
Input(type) {
classes("uk-input")
include(*modifiers)
placeholder ?.let(::placeholder)
value ?.let {
when (it) {
is String -> value(it)
is Number -> value(it)
else -> {}
}
}
onInput { event -> event.target.onChange(event.value) }
if (disabled) {
disabled()
}
attributesCustomizer()
}
}
@Deprecated("Renamed", ReplaceWith("StandardInput(type, value, *modifiers, disabled, placeholder, attributesCustomizer, onChange)"))
@Composable @Composable
fun <T> DefaultInput( fun <T> DefaultInput(
type: InputType<T>, type: InputType<T>,
@@ -17,28 +51,8 @@ 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) {
Input(type) { onChange(it)
classes("uk-input")
include(*modifiers)
placeholder ?.let(::placeholder)
value.let {
when (it) {
is String -> value(it)
is Number -> value(it)
else -> {}
}
}
onInput { onChange(it.value) }
if (disabled) {
disabled()
}
attributesCustomizer()
}
} }
@Composable @Composable
@@ -49,12 +63,12 @@ fun <T> StandardInput(
placeholder: String? = null, placeholder: String? = null,
vararg modifiers: UIKitModifier, vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {}, attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {},
) = DefaultInput( ) = StandardInput(
type, type,
state.value, state.value,
modifiers = modifiers,
disabledState ?.value == true, disabledState ?.value == true,
placeholder, placeholder,
modifiers = modifiers,
attributesCustomizer = attributesCustomizer attributesCustomizer = attributesCustomizer
) { ) {
state.value = it state.value = it