mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-11-30 05:58:45 +00:00
commit
7c81cea8af
@ -1,5 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## 0.5.2
|
||||
|
||||
* More fixes in Dialogs
|
||||
* Badge supported
|
||||
* Inline creation support
|
||||
|
||||
## 0.5.1
|
||||
|
||||
* Fixes in new `Dialog`s
|
||||
|
@ -9,4 +9,4 @@ android.enableJetifier=true
|
||||
# Project data
|
||||
|
||||
group=dev.inmo
|
||||
version=0.5.1
|
||||
version=0.5.2
|
||||
|
25
src/jsMain/kotlin/dev/inmo/jsuikit/elements/Badge.kt
Normal file
25
src/jsMain/kotlin/dev/inmo/jsuikit/elements/Badge.kt
Normal file
@ -0,0 +1,25 @@
|
||||
package dev.inmo.jsuikit.elements
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import dev.inmo.jsuikit.modifiers.UIKitBadge
|
||||
import dev.inmo.jsuikit.modifiers.include
|
||||
import org.jetbrains.compose.web.dom.AttrBuilderContext
|
||||
import org.jetbrains.compose.web.dom.ContentBuilder
|
||||
import org.jetbrains.compose.web.dom.Span
|
||||
import org.jetbrains.compose.web.dom.Text
|
||||
import org.w3c.dom.HTMLSpanElement
|
||||
|
||||
@Composable
|
||||
fun Badge(
|
||||
text: String,
|
||||
onAfterText: ContentBuilder<HTMLSpanElement>? = null,
|
||||
onBeforeText: ContentBuilder<HTMLSpanElement>? = null,
|
||||
attrs: AttrBuilderContext<HTMLSpanElement>? = null
|
||||
) = Span({
|
||||
include(UIKitBadge)
|
||||
attrs ?.invoke(this)
|
||||
}) {
|
||||
onAfterText ?.invoke(this)
|
||||
Text(text)
|
||||
onBeforeText ?.invoke(this)
|
||||
}
|
@ -54,6 +54,8 @@ fun Dialog(
|
||||
|
||||
if (onHidden != null || removeOnHide) {
|
||||
htmlElement.addEventListener("hidden", {
|
||||
if (it.target != htmlElement) return@addEventListener
|
||||
|
||||
onHidden ?.invoke(htmlElement)
|
||||
|
||||
if (removeOnHide) {
|
||||
@ -64,6 +66,8 @@ fun Dialog(
|
||||
|
||||
onShown ?.let {
|
||||
htmlElement.addEventListener("shown", {
|
||||
if (it.target != htmlElement) return@addEventListener
|
||||
|
||||
onShown(htmlElement)
|
||||
})
|
||||
}
|
||||
|
18
src/jsMain/kotlin/dev/inmo/jsuikit/elements/Inline.kt
Normal file
18
src/jsMain/kotlin/dev/inmo/jsuikit/elements/Inline.kt
Normal file
@ -0,0 +1,18 @@
|
||||
package dev.inmo.jsuikit.elements
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import dev.inmo.jsuikit.modifiers.UIKitUtility
|
||||
import dev.inmo.jsuikit.modifiers.include
|
||||
import org.jetbrains.compose.web.dom.AttrBuilderContext
|
||||
import org.jetbrains.compose.web.dom.ContentBuilder
|
||||
import org.jetbrains.compose.web.dom.Div
|
||||
import org.w3c.dom.HTMLDivElement
|
||||
|
||||
@Composable
|
||||
fun Inline(
|
||||
attrBuilderContext: AttrBuilderContext<HTMLDivElement>? = null,
|
||||
contentBuilder: ContentBuilder<HTMLDivElement>
|
||||
) = Div({
|
||||
include(UIKitUtility.Inline)
|
||||
attrBuilderContext ?.invoke(this)
|
||||
}, contentBuilder)
|
@ -0,0 +1,7 @@
|
||||
package dev.inmo.jsuikit.modifiers
|
||||
|
||||
sealed class UIKitBadge(classname: String) : UIKitModifier {
|
||||
override val classes: Array<String> = arrayOf(classname)
|
||||
|
||||
companion object : UIKitBadge("uk-badge")
|
||||
}
|
Loading…
Reference in New Issue
Block a user