mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-12-22 08:37:24 +00:00
commit
186eff482d
@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.0.47
|
||||||
|
|
||||||
|
* Add support of `Close` element
|
||||||
|
|
||||||
## 0.0.46
|
## 0.0.46
|
||||||
|
|
||||||
* Add support of `UIKitOverlay`
|
* Add support of `UIKitOverlay`
|
||||||
|
@ -9,4 +9,4 @@ android.enableJetifier=true
|
|||||||
# Project data
|
# Project data
|
||||||
|
|
||||||
group=dev.inmo
|
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")
|
object Grid : App("grid")
|
||||||
sealed class More(iconName: String) : App("more${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
sealed class More(iconName: String) : App("more${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
||||||
object Vertical : More("vertical")
|
object Vertical : More("vertical")
|
||||||
companion object : More("more")
|
companion object : More("")
|
||||||
}
|
}
|
||||||
sealed class Plus(iconName: String) : App("plus${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
sealed class Plus(iconName: String) : App("plus${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
||||||
object Circle : Plus("circle")
|
object Circle : Plus("circle")
|
||||||
companion object : Plus("plus")
|
companion object : Plus("")
|
||||||
}
|
}
|
||||||
sealed class Minus(iconName: String) : App("minus${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
sealed class Minus(iconName: String) : App("minus${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
||||||
object Circle : Minus("circle")
|
object Circle : Minus("circle")
|
||||||
companion object : Minus("minus")
|
companion object : Minus("")
|
||||||
}
|
}
|
||||||
object Close : App("close")
|
object Close : App("close")
|
||||||
object Check : App("check")
|
object Check : App("check")
|
||||||
@ -93,7 +93,7 @@ sealed class Icon(val name: String) {
|
|||||||
object Refresh : App("refresh")
|
object Refresh : App("refresh")
|
||||||
sealed class Play(iconName: String) : App("play${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
sealed class Play(iconName: String) : App("play${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
||||||
object Circle : Play("circle")
|
object Circle : Play("circle")
|
||||||
companion object : Play("play")
|
companion object : Play("")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sealed class Devices(iconName: String) : Icon(iconName) {
|
sealed class Devices(iconName: String) : Icon(iconName) {
|
||||||
@ -102,11 +102,11 @@ sealed class Icon(val name: String) {
|
|||||||
object Laptop : Devices("laptop")
|
object Laptop : Devices("laptop")
|
||||||
sealed class Tablet(iconName: String) : Devices("tablet${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
sealed class Tablet(iconName: String) : Devices("tablet${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
||||||
object Landscape : Tablet("landscape")
|
object Landscape : Tablet("landscape")
|
||||||
companion object : Tablet("tablet")
|
companion object : Tablet("")
|
||||||
}
|
}
|
||||||
sealed class Phone(iconName: String) : Devices("phone${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
sealed class Phone(iconName: String) : Devices("phone${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
||||||
object Landscape : Phone("landscape")
|
object Landscape : Phone("landscape")
|
||||||
companion object : Phone("phone")
|
companion object : Phone("")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sealed class Storage(iconName: String) : Icon(iconName) {
|
sealed class Storage(iconName: String) : Icon(iconName) {
|
||||||
@ -114,7 +114,7 @@ sealed class Icon(val name: String) {
|
|||||||
object Text : File("text")
|
object Text : File("text")
|
||||||
object Pdf : File("pdf")
|
object Pdf : File("pdf")
|
||||||
object Edit : File("edit")
|
object Edit : File("edit")
|
||||||
companion object : File("file")
|
companion object : File("")
|
||||||
}
|
}
|
||||||
object Copy : Storage("copy")
|
object Copy : Storage("copy")
|
||||||
object Folder : Storage("folder")
|
object Folder : Storage("folder")
|
||||||
@ -177,7 +177,7 @@ sealed class Icon(val name: String) {
|
|||||||
object Foursquare : Brands("foursquare")
|
object Foursquare : Brands("foursquare")
|
||||||
sealed class Github(iconName: String) : Brands("github${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
sealed class Github(iconName: String) : Brands("github${iconName.takeIf { it.isNotEmpty() } ?.let { "-$it" } ?: "" }") {
|
||||||
object Alt : Github("alt")
|
object Alt : Github("alt")
|
||||||
companion object : Github("github")
|
companion object : Github("")
|
||||||
}
|
}
|
||||||
object Gitter : Brands("gitter")
|
object Gitter : Brands("gitter")
|
||||||
object Google : Brands("google")
|
object Google : Brands("google")
|
||||||
|
@ -95,7 +95,7 @@ fun SubNav(
|
|||||||
@Composable
|
@Composable
|
||||||
fun <T> Nav(
|
fun <T> Nav(
|
||||||
title: String,
|
title: String,
|
||||||
data: SnapshotStateList<T>,
|
data: Iterable<T>,
|
||||||
vararg ulModifiers: UIKitModifier,
|
vararg ulModifiers: UIKitModifier,
|
||||||
titleModifiers: Array<UIKitModifier> = emptyArray(),
|
titleModifiers: Array<UIKitModifier> = emptyArray(),
|
||||||
multiple: Boolean? = null,
|
multiple: Boolean? = null,
|
||||||
@ -134,7 +134,7 @@ fun <T> Nav(
|
|||||||
@Composable
|
@Composable
|
||||||
fun <T> DefaultNav(
|
fun <T> DefaultNav(
|
||||||
title: String,
|
title: String,
|
||||||
data: SnapshotStateList<T>,
|
data: Iterable<T>,
|
||||||
vararg ulModifiers: UIKitModifier,
|
vararg ulModifiers: UIKitModifier,
|
||||||
titleModifiers: Array<UIKitModifier> = emptyArray(),
|
titleModifiers: Array<UIKitModifier> = emptyArray(),
|
||||||
multiple: Boolean? = null,
|
multiple: Boolean? = null,
|
||||||
@ -163,7 +163,7 @@ fun <T> DefaultNav(
|
|||||||
@Composable
|
@Composable
|
||||||
fun <T> PrimaryNav(
|
fun <T> PrimaryNav(
|
||||||
title: String,
|
title: String,
|
||||||
data: SnapshotStateList<T>,
|
data: Iterable<T>,
|
||||||
vararg ulModifiers: UIKitModifier,
|
vararg ulModifiers: UIKitModifier,
|
||||||
titleModifiers: Array<UIKitModifier> = emptyArray(),
|
titleModifiers: Array<UIKitModifier> = emptyArray(),
|
||||||
multiple: Boolean? = null,
|
multiple: Boolean? = null,
|
||||||
@ -192,7 +192,7 @@ fun <T> PrimaryNav(
|
|||||||
@Composable
|
@Composable
|
||||||
fun <T> SubNav(
|
fun <T> SubNav(
|
||||||
title: String,
|
title: String,
|
||||||
data: SnapshotStateList<T>,
|
data: Iterable<T>,
|
||||||
vararg ulModifiers: UIKitModifier,
|
vararg ulModifiers: UIKitModifier,
|
||||||
titleModifiers: Array<UIKitModifier> = emptyArray(),
|
titleModifiers: Array<UIKitModifier> = emptyArray(),
|
||||||
multiple: Boolean? = null,
|
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