From 061b55b164ec4451447bbe986cf2125fc32826a1 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 25 Mar 2022 16:44:50 +0600 Subject: [PATCH 1/6] start 0.0.47 --- CHANGELOG.md | 2 ++ gradle.properties | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44505a5..fbdf774 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## 0.0.47 + ## 0.0.46 * Add support of `UIKitOverlay` diff --git a/gradle.properties b/gradle.properties index 806b7cf..16a4a5c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,4 +9,4 @@ android.enableJetifier=true # Project data group=dev.inmo -version=0.0.46 +version=0.0.47 From b4a0ff6ece1f8c50993b8470beb88580877bab63 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 25 Mar 2022 16:45:30 +0600 Subject: [PATCH 2/6] add support of close element --- CHANGELOG.md | 2 + .../kotlin/dev/inmo/jsuikit/elements/Close.kt | 37 +++++++++++++++++++ .../dev/inmo/jsuikit/modifiers/UIKitClose.kt | 17 +++++++++ 3 files changed, 56 insertions(+) create mode 100644 src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt create mode 100644 src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitClose.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index fbdf774..8e77a6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 0.0.47 +* Add support of `Close` element + ## 0.0.46 * Add support of `UIKitOverlay` diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt new file mode 100644 index 0000000..6e5a17b --- /dev/null +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt @@ -0,0 +1,37 @@ +package dev.inmo.jsuikit.elements + +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 { + fun drawAsLink( + href: String = "#", + attrs: Attrs = Attrs.empty(), + contentBuilder: ContentBuilder = {} + ) = A( + href, + { + include(UIKitClose) + attrs.builder(this) + }, + contentBuilder + ) + + fun drawAsButton( + attrs: Attrs = Attrs.empty(), + contentBuilder: ContentBuilder = {} + ) = Button( + { + type(ButtonType.Button) + include(UIKitClose) + attrs.builder(this) + }, + contentBuilder + ) +} diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitClose.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitClose.kt new file mode 100644 index 0000000..c0b425a --- /dev/null +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitClose.kt @@ -0,0 +1,17 @@ +package dev.inmo.jsuikit.modifiers + +sealed class UIKitClose( + override val classes: Array = emptyArray(), + override val otherAttrs: Map = emptyMap() +) : UIKitModifier { + + object Large : UIKitClose( + arrayOf("uk-close-large") + ) + + companion object : UIKitClose( + arrayOf("uk-close"), + mapOf("uk-close" to "") + ) + +} From c337dd2b2d70ead5f59718863c1813e38bbb5a88 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 25 Mar 2022 16:46:14 +0600 Subject: [PATCH 3/6] add composable annotations to close functions --- src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt index 6e5a17b..99dbfb0 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt @@ -1,5 +1,6 @@ package dev.inmo.jsuikit.elements +import androidx.compose.runtime.Composable import dev.inmo.jsuikit.modifiers.UIKitClose import dev.inmo.jsuikit.modifiers.include import dev.inmo.jsuikit.utils.Attrs @@ -10,6 +11,7 @@ import org.w3c.dom.HTMLAnchorElement import org.w3c.dom.HTMLButtonElement object Close { + @Composable fun drawAsLink( href: String = "#", attrs: Attrs = Attrs.empty(), @@ -23,6 +25,7 @@ object Close { contentBuilder ) + @Composable fun drawAsButton( attrs: Attrs = Attrs.empty(), contentBuilder: ContentBuilder = {} From 04a94cfabecb4f6c2c244b89f0627407cfa16cf7 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 25 Mar 2022 16:56:39 +0600 Subject: [PATCH 4/6] add onClick callback into Close#drawAsButton --- src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt index 99dbfb0..5ee1723 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Close.kt @@ -1,6 +1,7 @@ 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 @@ -28,12 +29,16 @@ object Close { @Composable fun drawAsButton( attrs: Attrs = Attrs.empty(), - contentBuilder: ContentBuilder = {} + contentBuilder: ContentBuilder = {}, + onClick: ((SyntheticMouseEvent) -> Unit)? = null ) = Button( { type(ButtonType.Button) include(UIKitClose) attrs.builder(this) + onClick ?.let { + onClick(onClick) + } }, contentBuilder ) From fa41022df5aa5a2608b19c5da85b4c52aee9c2b8 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 25 Mar 2022 17:13:50 +0600 Subject: [PATCH 5/6] use iterables in navs --- src/jsMain/kotlin/dev/inmo/jsuikit/elements/Nav.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Nav.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Nav.kt index 6c048c7..518c99c 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Nav.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Nav.kt @@ -95,7 +95,7 @@ fun SubNav( @Composable fun Nav( title: String, - data: SnapshotStateList, + data: Iterable, vararg ulModifiers: UIKitModifier, titleModifiers: Array = emptyArray(), multiple: Boolean? = null, @@ -134,7 +134,7 @@ fun Nav( @Composable fun DefaultNav( title: String, - data: SnapshotStateList, + data: Iterable, vararg ulModifiers: UIKitModifier, titleModifiers: Array = emptyArray(), multiple: Boolean? = null, @@ -163,7 +163,7 @@ fun DefaultNav( @Composable fun PrimaryNav( title: String, - data: SnapshotStateList, + data: Iterable, vararg ulModifiers: UIKitModifier, titleModifiers: Array = emptyArray(), multiple: Boolean? = null, @@ -192,7 +192,7 @@ fun PrimaryNav( @Composable fun SubNav( title: String, - data: SnapshotStateList, + data: Iterable, vararg ulModifiers: UIKitModifier, titleModifiers: Array = emptyArray(), multiple: Boolean? = null, From 4a204f89717432854cbf6472a873de08cc907084 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 25 Mar 2022 19:27:02 +0600 Subject: [PATCH 6/6] fixes in icons --- .../kotlin/dev/inmo/jsuikit/elements/Icon.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Icon.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Icon.kt index f4162af..945e8bb 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Icon.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Icon.kt @@ -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")