mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-11-29 21:48:46 +00:00
commit
186eff482d
@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## 0.0.47
|
||||
|
||||
* Add support of `Close` element
|
||||
|
||||
## 0.0.46
|
||||
|
||||
* Add support of `UIKitOverlay`
|
||||
|
@ -9,4 +9,4 @@ android.enableJetifier=true
|
||||
# Project data
|
||||
|
||||
group=dev.inmo
|
||||
version=0.0.46
|
||||
version=0.0.47
|
||||
|
45
src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt
Normal file
45
src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt
Normal file
@ -0,0 +1,45 @@
|
||||
package dev.inmo.jsuikit.elements
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.web.events.SyntheticMouseEvent
|
||||
import dev.inmo.jsuikit.modifiers.UIKitClose
|
||||
import dev.inmo.jsuikit.modifiers.include
|
||||
import dev.inmo.jsuikit.utils.Attrs
|
||||
import org.jetbrains.compose.web.attributes.ButtonType
|
||||
import org.jetbrains.compose.web.attributes.type
|
||||
import org.jetbrains.compose.web.dom.*
|
||||
import org.w3c.dom.HTMLAnchorElement
|
||||
import org.w3c.dom.HTMLButtonElement
|
||||
|
||||
object Close {
|
||||
@Composable
|
||||
fun drawAsLink(
|
||||
href: String = "#",
|
||||
attrs: Attrs<HTMLAnchorElement> = Attrs.empty(),
|
||||
contentBuilder: ContentBuilder<HTMLAnchorElement> = {}
|
||||
) = A(
|
||||
href,
|
||||
{
|
||||
include(UIKitClose)
|
||||
attrs.builder(this)
|
||||
},
|
||||
contentBuilder
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun drawAsButton(
|
||||
attrs: Attrs<HTMLButtonElement> = Attrs.empty(),
|
||||
contentBuilder: ContentBuilder<HTMLButtonElement> = {},
|
||||
onClick: ((SyntheticMouseEvent) -> Unit)? = null
|
||||
) = Button(
|
||||
{
|
||||
type(ButtonType.Button)
|
||||
include(UIKitClose)
|
||||
attrs.builder(this)
|
||||
onClick ?.let {
|
||||
onClick(onClick)
|
||||
}
|
||||
},
|
||||
contentBuilder
|
||||
)
|
||||
}
|
@ -77,15 +77,15 @@ sealed class Icon(val name: String) {
|
||||
object Grid : App("grid")
|
||||
sealed class More(iconName: String) : App("more${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
||||
object Vertical : More("vertical")
|
||||
companion object : More("more")
|
||||
companion object : More("")
|
||||
}
|
||||
sealed class Plus(iconName: String) : App("plus${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
||||
object Circle : Plus("circle")
|
||||
companion object : Plus("plus")
|
||||
companion object : Plus("")
|
||||
}
|
||||
sealed class Minus(iconName: String) : App("minus${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
||||
object Circle : Minus("circle")
|
||||
companion object : Minus("minus")
|
||||
companion object : Minus("")
|
||||
}
|
||||
object Close : App("close")
|
||||
object Check : App("check")
|
||||
@ -93,7 +93,7 @@ sealed class Icon(val name: String) {
|
||||
object Refresh : App("refresh")
|
||||
sealed class Play(iconName: String) : App("play${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
||||
object Circle : Play("circle")
|
||||
companion object : Play("play")
|
||||
companion object : Play("")
|
||||
}
|
||||
}
|
||||
sealed class Devices(iconName: String) : Icon(iconName) {
|
||||
@ -102,11 +102,11 @@ sealed class Icon(val name: String) {
|
||||
object Laptop : Devices("laptop")
|
||||
sealed class Tablet(iconName: String) : Devices("tablet${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
||||
object Landscape : Tablet("landscape")
|
||||
companion object : Tablet("tablet")
|
||||
companion object : Tablet("")
|
||||
}
|
||||
sealed class Phone(iconName: String) : Devices("phone${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
||||
object Landscape : Phone("landscape")
|
||||
companion object : Phone("phone")
|
||||
companion object : Phone("")
|
||||
}
|
||||
}
|
||||
sealed class Storage(iconName: String) : Icon(iconName) {
|
||||
@ -114,7 +114,7 @@ sealed class Icon(val name: String) {
|
||||
object Text : File("text")
|
||||
object Pdf : File("pdf")
|
||||
object Edit : File("edit")
|
||||
companion object : File("file")
|
||||
companion object : File("")
|
||||
}
|
||||
object Copy : Storage("copy")
|
||||
object Folder : Storage("folder")
|
||||
@ -177,7 +177,7 @@ sealed class Icon(val name: String) {
|
||||
object Foursquare : Brands("foursquare")
|
||||
sealed class Github(iconName: String) : Brands("github${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
||||
object Alt : Github("alt")
|
||||
companion object : Github("github")
|
||||
companion object : Github("")
|
||||
}
|
||||
object Gitter : Brands("gitter")
|
||||
object Google : Brands("google")
|
||||
|
@ -95,7 +95,7 @@ fun SubNav(
|
||||
@Composable
|
||||
fun <T> Nav(
|
||||
title: String,
|
||||
data: SnapshotStateList<T>,
|
||||
data: Iterable<T>,
|
||||
vararg ulModifiers: UIKitModifier,
|
||||
titleModifiers: Array<UIKitModifier> = emptyArray(),
|
||||
multiple: Boolean? = null,
|
||||
@ -134,7 +134,7 @@ fun <T> Nav(
|
||||
@Composable
|
||||
fun <T> DefaultNav(
|
||||
title: String,
|
||||
data: SnapshotStateList<T>,
|
||||
data: Iterable<T>,
|
||||
vararg ulModifiers: UIKitModifier,
|
||||
titleModifiers: Array<UIKitModifier> = emptyArray(),
|
||||
multiple: Boolean? = null,
|
||||
@ -163,7 +163,7 @@ fun <T> DefaultNav(
|
||||
@Composable
|
||||
fun <T> PrimaryNav(
|
||||
title: String,
|
||||
data: SnapshotStateList<T>,
|
||||
data: Iterable<T>,
|
||||
vararg ulModifiers: UIKitModifier,
|
||||
titleModifiers: Array<UIKitModifier> = emptyArray(),
|
||||
multiple: Boolean? = null,
|
||||
@ -192,7 +192,7 @@ fun <T> PrimaryNav(
|
||||
@Composable
|
||||
fun <T> SubNav(
|
||||
title: String,
|
||||
data: SnapshotStateList<T>,
|
||||
data: Iterable<T>,
|
||||
vararg ulModifiers: UIKitModifier,
|
||||
titleModifiers: Array<UIKitModifier> = emptyArray(),
|
||||
multiple: Boolean? = null,
|
||||
|
17
src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitClose.kt
Normal file
17
src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitClose.kt
Normal file
@ -0,0 +1,17 @@
|
||||
package dev.inmo.jsuikit.modifiers
|
||||
|
||||
sealed class UIKitClose(
|
||||
override val classes: Array<String> = emptyArray(),
|
||||
override val otherAttrs: Map<String, String> = emptyMap()
|
||||
) : UIKitModifier {
|
||||
|
||||
object Large : UIKitClose(
|
||||
arrayOf("uk-close-large")
|
||||
)
|
||||
|
||||
companion object : UIKitClose(
|
||||
arrayOf("uk-close"),
|
||||
mapOf("uk-close" to "")
|
||||
)
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user