mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2025-12-04 13:26:27 +00:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d2ba2fe96a | |||
| c0ce6f5b71 | |||
| 665432cdce | |||
| 5e379ee3e2 | |||
| 5a86d6705b | |||
| 25134879c1 | |||
| 30a85795dd | |||
| 730da9f759 | |||
| 8178fa9d39 | |||
| 1eb14becde | |||
| 6502e0923e | |||
| 443043cff5 | |||
| 1765214c97 | |||
| dcc6495030 | |||
| 1c16fb4ed7 |
19
CHANGELOG.md
19
CHANGELOG.md
@@ -1,5 +1,24 @@
|
||||
# Changelog
|
||||
|
||||
## 0.7.1
|
||||
|
||||
* Type of `animation` parameter in `Alert` has been changed according to docs: now it is `Boolean`
|
||||
* Add tooltip `JS` part support
|
||||
|
||||
## 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`
|
||||
|
||||
@@ -3,10 +3,8 @@ org.gradle.parallel=true
|
||||
kotlin.js.generate.externals=true
|
||||
kotlin.incremental=true
|
||||
kotlin.incremental.js=true
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
|
||||
# Project data
|
||||
|
||||
group=dev.inmo
|
||||
version=0.6.0
|
||||
version=0.7.1
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[versions]
|
||||
|
||||
kt = "1.8.10"
|
||||
jb-compose = "1.3.1-rc01"
|
||||
jb-dokka = "1.7.20"
|
||||
kt = "1.8.20"
|
||||
jb-compose = "1.4.0"
|
||||
jb-dokka = "1.8.10"
|
||||
gh-release = "2.4.1"
|
||||
|
||||
[libraries]
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
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
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.w3c.dom.HTMLDivElement
|
||||
@Composable
|
||||
fun Alert(
|
||||
attrs: Attrs<HTMLDivElement> = Attrs.empty(),
|
||||
animation: UIKitAnimation? = UIKitAnimation.Fade,
|
||||
animation: Boolean = true,
|
||||
duration: Milliseconds? = null,
|
||||
selClose: String? = null,
|
||||
content: ContentBuilder<HTMLDivElement>
|
||||
@@ -22,7 +22,7 @@ fun Alert(
|
||||
include(UIKitAlert)
|
||||
|
||||
buildAndAddAttribute("uk-alert") {
|
||||
"animation" to animation ?.classes ?.firstOrNull()
|
||||
"animation" to animation
|
||||
"duration" to duration
|
||||
"sel-close" to selClose
|
||||
}
|
||||
|
||||
@@ -8,6 +8,40 @@ import org.jetbrains.compose.web.dom.AttrBuilderContext
|
||||
import org.jetbrains.compose.web.dom.Input
|
||||
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
|
||||
fun <T> DefaultInput(
|
||||
type: InputType<T>,
|
||||
@@ -17,28 +51,8 @@ fun <T> DefaultInput(
|
||||
vararg modifiers: UIKitModifier,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {},
|
||||
onChange: (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 { onChange(it.value) }
|
||||
|
||||
if (disabled) {
|
||||
disabled()
|
||||
}
|
||||
attributesCustomizer()
|
||||
}
|
||||
) = StandardInput(type, value, modifiers = modifiers, disabled, placeholder, attributesCustomizer) {
|
||||
onChange(it)
|
||||
}
|
||||
|
||||
@Composable
|
||||
@@ -49,12 +63,12 @@ fun <T> StandardInput(
|
||||
placeholder: String? = null,
|
||||
vararg modifiers: UIKitModifier,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {},
|
||||
) = DefaultInput(
|
||||
) = StandardInput(
|
||||
type,
|
||||
state.value,
|
||||
modifiers = modifiers,
|
||||
disabledState ?.value == true,
|
||||
placeholder,
|
||||
modifiers = modifiers,
|
||||
attributesCustomizer = attributesCustomizer
|
||||
) {
|
||||
state.value = it
|
||||
|
||||
@@ -17,4 +17,7 @@ external interface UIKit {
|
||||
|
||||
fun dropdown(element: Element, options: DropdownOptions = definedExternally): Dropdown
|
||||
fun dropdown(selector: String, options: DropdownOptions = definedExternally): Dropdown?
|
||||
|
||||
fun tooltip(element: Element): UIKitTooltip
|
||||
fun tooltip(selector: String): UIKitTooltip?
|
||||
}
|
||||
|
||||
6
src/jsMain/kotlin/dev/inmo/jsuikit/types/UIKitTooltip.kt
Normal file
6
src/jsMain/kotlin/dev/inmo/jsuikit/types/UIKitTooltip.kt
Normal file
@@ -0,0 +1,6 @@
|
||||
package dev.inmo.jsuikit.types
|
||||
|
||||
external interface UIKitTooltip {
|
||||
fun show()
|
||||
fun hide()
|
||||
}
|
||||
Reference in New Issue
Block a user