mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-11-05 07:53:57 +00:00
commit
f7eecc01e3
@ -1,5 +1,10 @@
|
||||
# Changelog
|
||||
|
||||
## 0.0.34
|
||||
|
||||
* Add `Alert`
|
||||
* Add `Animation#KenBurns`
|
||||
|
||||
## 0.0.33
|
||||
|
||||
* Fixes in attributes building and related things
|
||||
|
@ -9,4 +9,4 @@ android.enableJetifier=true
|
||||
# Project data
|
||||
|
||||
group=dev.inmo
|
||||
version=0.0.33
|
||||
version=0.0.34
|
||||
|
49
src/jsMain/kotlin/dev/inmo/jsuikit/elements/Alert.kt
Normal file
49
src/jsMain/kotlin/dev/inmo/jsuikit/elements/Alert.kt
Normal file
@ -0,0 +1,49 @@
|
||||
package dev.inmo.jsuikit.elements
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import dev.inmo.jsuikit.buildAndAddAttribute
|
||||
import dev.inmo.jsuikit.modifiers.*
|
||||
import dev.inmo.jsuikit.utils.Attrs
|
||||
import dev.inmo.jsuikit.utils.Milliseconds
|
||||
import org.jetbrains.compose.web.dom.*
|
||||
import org.w3c.dom.HTMLAnchorElement
|
||||
import org.w3c.dom.HTMLDivElement
|
||||
|
||||
@Composable
|
||||
fun Alert(
|
||||
attrs: Attrs<HTMLDivElement> = Attrs.empty(),
|
||||
animation: UIKitAnimation? = UIKitAnimation.Fade,
|
||||
duration: Milliseconds? = null,
|
||||
selClose: String? = null,
|
||||
content: ContentBuilder<HTMLDivElement>
|
||||
) = Div(
|
||||
{
|
||||
attrs.builder(this)
|
||||
include(UIKitAlert)
|
||||
|
||||
buildAndAddAttribute("uk-alert") {
|
||||
"animation" to animation ?.classes ?.firstOrNull()
|
||||
"duration" to duration
|
||||
"sel-close" to selClose
|
||||
}
|
||||
},
|
||||
content
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun AlertCloseButton(
|
||||
attrs: Attrs<HTMLAnchorElement> = Attrs.empty(),
|
||||
content: ContentBuilder<HTMLAnchorElement> = @Composable {}
|
||||
) {
|
||||
A(
|
||||
null,
|
||||
{
|
||||
include(UIKitAlert.Close, UIKitIcon)
|
||||
attr("uk-close", "")
|
||||
classes("uk-close")
|
||||
attrs.builder(this)
|
||||
},
|
||||
content
|
||||
)
|
||||
|
||||
}
|
@ -211,8 +211,7 @@ sealed class Icon(val name: String) {
|
||||
onClick: ((Event) -> Unit)? = null
|
||||
) {
|
||||
val configurer: AttrBuilderContext<out HTMLElement> = {
|
||||
classes("uk-icon")
|
||||
include(*modifiers, type)
|
||||
include(*modifiers, type, UIKitIcon)
|
||||
attr("uk-icon", "icon: $name${if (ratio != null) { "; ratio: $ratio" } else ""}")
|
||||
onClick ?.let { _ ->
|
||||
onClick { onClick(it.nativeEvent) }
|
||||
|
18
src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitAlert.kt
Normal file
18
src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitAlert.kt
Normal file
@ -0,0 +1,18 @@
|
||||
package dev.inmo.jsuikit.modifiers
|
||||
|
||||
sealed class UIKitAlert(classname: String) : UIKitModifier {
|
||||
override val classes: Array<String> = arrayOf(classname)
|
||||
|
||||
sealed class Style(classname: String) : UIKitAlert(classname) {
|
||||
|
||||
object Primary : Style("uk-alert-primary")
|
||||
object Success : Style("uk-alert-success")
|
||||
object Warning : Style("uk-alert-warning")
|
||||
object Danger : Style("uk-alert-danger")
|
||||
|
||||
}
|
||||
|
||||
object Close : UIKitAlert("uk-alert-close")
|
||||
|
||||
companion object : UIKitAlert("uk-alert")
|
||||
}
|
@ -60,4 +60,6 @@ sealed class UIKitAnimation (name: String) : UIKitModifier, AttributeValue(name)
|
||||
|
||||
object Fast : UIKitAnimation("fast")
|
||||
|
||||
object KenBurns : UIKitAnimation("kenburns")
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
package dev.inmo.jsuikit.modifiers
|
||||
|
||||
sealed class UIKitIcon(classname: String) : UIKitModifier {
|
||||
override val classes: Array<String> = arrayOf(classname)
|
||||
|
||||
companion object : UIKitIcon("uk-icon")
|
||||
}
|
Loading…
Reference in New Issue
Block a user