Merge pull request #77 from InsanusMokrassar/0.5.2

0.5.2
This commit is contained in:
InsanusMokrassar 2023-01-26 22:44:37 +06:00 committed by GitHub
commit 7c81cea8af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 61 additions and 1 deletions

View File

@ -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

View File

@ -9,4 +9,4 @@ android.enableJetifier=true
# Project data
group=dev.inmo
version=0.5.1
version=0.5.2

View 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)
}

View File

@ -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)
})
}

View 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)

View File

@ -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")
}