From 556ab4e0903a86601ac842d0ebd53273f0d0ab8d Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 2 Mar 2022 16:52:58 +0600 Subject: [PATCH] add DropAre, UIKitPlaceholder and UIKitForm#Custom now have nullable target --- CHANGELOG.md | 4 ++++ .../dev/inmo/jsuikit/elements/DropArea.kt | 24 +++++++++++++++++++ .../dev/inmo/jsuikit/modifiers/UIKitForm.kt | 2 +- .../jsuikit/modifiers/UIKitPlaceholder.kt | 5 ++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 src/jsMain/kotlin/dev/inmo/jsuikit/elements/DropArea.kt create mode 100644 src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitPlaceholder.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b39f3b..f579161 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## 0.0.41 +* Add `DropArea` +* Add `UIKitPlaceholder` +* `UIKitForm#Custom` now have nullable param target + ## 0.0.40 * All `DefaultTable` functions now use `Iterable` as data type diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/DropArea.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/DropArea.kt new file mode 100644 index 0000000..9901aff --- /dev/null +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/DropArea.kt @@ -0,0 +1,24 @@ +package dev.inmo.jsuikit.elements + +import androidx.compose.runtime.Composable +import dev.inmo.jsuikit.modifiers.* +import dev.inmo.jsuikit.utils.Attrs +import org.jetbrains.compose.web.attributes.InputType +import org.jetbrains.compose.web.dom.* +import org.w3c.dom.HTMLDivElement +import org.w3c.dom.HTMLInputElement + +@Composable +fun DropArea( + attrs: Attrs = Attrs.empty(), + inputAttrs: Attrs = Attrs.empty(), + contentBuilder: ContentBuilder = {} +) = Div( + { + include(UIKitPlaceholder, UIKitForm.Custom()) + attrs.builder(this) + } +) { + Input(InputType.File, attrs = { inputAttrs.builder.invoke(this) }) + contentBuilder(this) +} diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitForm.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitForm.kt index 341a09e..4c10841 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitForm.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitForm.kt @@ -47,7 +47,7 @@ sealed class UIKitForm( object Icon : UIKitForm("uk-form-icon") class Custom( - target: String = "true" + target: String? = null ) : UIKitForm( otherAttrs = mapOf( buildAttribute("uk-form-custom") { diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitPlaceholder.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitPlaceholder.kt new file mode 100644 index 0000000..a444b73 --- /dev/null +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitPlaceholder.kt @@ -0,0 +1,5 @@ +package dev.inmo.jsuikit.modifiers + +object UIKitPlaceholder : UIKitModifier { + override val classes: Array = arrayOf("uk-placeholder") +}