From d2ba2fe96adba737af35d36c01a82bf7caefb18d Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 19 Jun 2023 16:42:41 +0600 Subject: [PATCH] improvements --- CHANGELOG.md | 3 +++ src/jsMain/kotlin/dev/inmo/jsuikit/elements/Alert.kt | 4 ++-- src/jsMain/kotlin/dev/inmo/jsuikit/types/UIKit.kt | 3 +++ src/jsMain/kotlin/dev/inmo/jsuikit/types/UIKitTooltip.kt | 6 ++++++ 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 src/jsMain/kotlin/dev/inmo/jsuikit/types/UIKitTooltip.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index e3a3a89..02fba9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## 0.7.1 +* Type of `animation` parameter in `Alert` has been changed according to docs: now it is `Boolean` +* Add tooltip `JS` part support + ## 0.7.0 * `Kotlin`: `1.8.20` diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Alert.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Alert.kt index edec41f..731e0f7 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Alert.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Alert.kt @@ -12,7 +12,7 @@ import org.w3c.dom.HTMLDivElement @Composable fun Alert( attrs: Attrs = Attrs.empty(), - animation: UIKitAnimation? = UIKitAnimation.Fade, + animation: Boolean = true, duration: Milliseconds? = null, selClose: String? = null, content: ContentBuilder @@ -22,7 +22,7 @@ fun Alert( include(UIKitAlert) buildAndAddAttribute("uk-alert") { - "animation" to animation ?.classes ?.firstOrNull() + "animation" to animation "duration" to duration "sel-close" to selClose } diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/types/UIKit.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/types/UIKit.kt index 155d9d4..5f11a4f 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/types/UIKit.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/types/UIKit.kt @@ -17,4 +17,7 @@ external interface UIKit { fun dropdown(element: Element, options: DropdownOptions = definedExternally): Dropdown fun dropdown(selector: String, options: DropdownOptions = definedExternally): Dropdown? + + fun tooltip(element: Element): UIKitTooltip + fun tooltip(selector: String): UIKitTooltip? } diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/types/UIKitTooltip.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/types/UIKitTooltip.kt new file mode 100644 index 0000000..40d76ff --- /dev/null +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/types/UIKitTooltip.kt @@ -0,0 +1,6 @@ +package dev.inmo.jsuikit.types + +external interface UIKitTooltip { + fun show() + fun hide() +}