From 687c3ab065bd82d7a0c3454eeb2f76ac522b2880 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 17 Feb 2022 14:56:47 +0600 Subject: [PATCH 1/6] start 0.0.36 --- CHANGELOG.md | 2 ++ gradle.properties | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1b2c06..c6f2fb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog +## 0.0.36 + ## 0.0.35 * Add `UIKitModal` diff --git a/gradle.properties b/gradle.properties index 1a71775..5e98a7e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,4 +9,4 @@ android.enableJetifier=true # Project data group=dev.inmo -version=0.0.35 +version=0.0.36 From fc2fb24fce33b732ce0ec2598ea655d8e1f5c5e8 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 17 Feb 2022 14:57:09 +0600 Subject: [PATCH 2/6] reorder comment arguments --- CHANGELOG.md | 2 ++ src/jsMain/kotlin/dev/inmo/jsuikit/elements/Comment.kt | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6f2fb4..a345497 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 0.0.36 +* Reorder arguments in `DefaultComment` fun + ## 0.0.35 * Add `UIKitModal` diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Comment.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Comment.kt index 65774d7..dc118df 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Comment.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Comment.kt @@ -45,16 +45,16 @@ fun Comment( @Composable fun DefaultComment( + rootAttrs: Attrs = Attrs.empty(), headerGridAttrs: Attrs? = null, + headerAttrs: Attrs? = null, + additionalHeaderContent: ContentBuilder? = null, avatarUrl: String? = null, avatarAttrs: Attrs? = null, titleAttrs: Attrs? = null, titleContent: ContentBuilder? = null, metaAttrs: Attrs? = null, metaContent: ContentBuilder? = null, - rootAttrs: Attrs = Attrs.empty(), - headerAttrs: Attrs? = null, - additionalHeaderContent: ContentBuilder? = null, bodyAttrs: Attrs? = null, bodyContent: ContentBuilder? = null, ) { From d4d0adf02059b1cee8ed6503f7af499ed2893414 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 17 Feb 2022 15:16:30 +0600 Subject: [PATCH 3/6] vertical and horizontal in margins --- CHANGELOG.md | 1 + .../dev/inmo/jsuikit/modifiers/UIKitMargin.kt | 43 +++++++++++++------ 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a345497..2ae7d4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 0.0.36 * Reorder arguments in `DefaultComment` fun +* Add `Vertical` and `Horizontal` members in margins ## 0.0.35 diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitMargin.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitMargin.kt index b9c6865..9b6e51c 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitMargin.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitMargin.kt @@ -1,68 +1,87 @@ package dev.inmo.jsuikit.modifiers -sealed class UIKitMargin(val classname: String) : UIKitModifier { - override val classes: Array = arrayOf(classname) +sealed class UIKitMargin(vararg classnames: String) : UIKitModifier { + @Suppress("UNCHECKED_CAST") + override val classes: Array = classnames as Array - object Top : Small("uk-margin-top") - object Bottom : Small("uk-margin-bottom") - object Left : Small("uk-margin-left") - object Right : Small("uk-margin-right") + object Top : UIKitMargin("uk-margin-top") + object Bottom : UIKitMargin("uk-margin-bottom") + object Left : UIKitMargin("uk-margin-left") + object Right : UIKitMargin("uk-margin-right") + object Vertical : UIKitMargin() { override val classes: Array = Top.classes + Bottom.classes } + object Horizontal : UIKitMargin() { override val classes: Array = Left.classes + Right.classes } companion object : Small("uk-margin") - sealed class Small(classname: String) : UIKitMargin(classname) { + sealed class Small(vararg classnames: String) : UIKitMargin(*classnames) { object Top : Small("uk-margin-small-top") object Bottom : Small("uk-margin-small-bottom") object Left : Small("uk-margin-small-left") object Right : Small("uk-margin-small-right") + + object Vertical : Small() { + override val classes: Array = Top.classes + Bottom.classes + } + object Horizontal : Small() { + override val classes: Array = Left.classes + Right.classes + } + companion object : Small("uk-margin-small") } - sealed class Medium(classname: String) : UIKitMargin(classname) { + sealed class Medium(vararg classnames: String) : UIKitMargin(*classnames) { object Top : Medium("uk-margin-medium-top") object Bottom : Medium("uk-margin-medium-bottom") object Left : Medium("uk-margin-medium-left") object Right : Medium("uk-margin-medium-right") + object Vertical : Medium() { override val classes: Array = Top.classes + Bottom.classes } + object Horizontal : Medium() { override val classes: Array = Left.classes + Right.classes } companion object : Medium("uk-margin-medium") } - sealed class Large(classname: String) : UIKitMargin(classname) { + sealed class Large(vararg classnames: String) : UIKitMargin(*classnames) { object Top : Large("uk-margin-large-top") object Bottom : Large("uk-margin-large-bottom") object Left : Large("uk-margin-large-left") object Right : Large("uk-margin-large-right") + object Vertical : Large() { override val classes: Array = Top.classes + Bottom.classes } + object Horizontal : Large() { override val classes: Array = Left.classes + Right.classes } companion object : Large("uk-margin-large") } - sealed class XLarge(classname: String) : UIKitMargin(classname) { + sealed class XLarge(vararg classnames: String) : UIKitMargin(*classnames) { object Top : XLarge("uk-margin-xlarge-top") object Bottom : XLarge("uk-margin-xlarge-bottom") object Left : XLarge("uk-margin-xlarge-left") object Right : XLarge("uk-margin-xlarge-right") + object Vertical : XLarge() { override val classes: Array = Top.classes + Bottom.classes } + object Horizontal : XLarge() { override val classes: Array = Left.classes + Right.classes } companion object : XLarge("uk-margin-xlarge") } - sealed class Auto(classname: String) : UIKitMargin(classname) { + sealed class Auto(vararg classnames: String) : UIKitMargin(*classnames) { object Top : Auto("uk-margin-auto-top") object Bottom : Auto("uk-margin-auto-bottom") object Left : Auto("uk-margin-auto-left") object Right : Auto("uk-margin-auto-right") object Vertical : Auto("uk-margin-auto-vertical") + object Horizontal : Auto() { override val classes: Array = Left.classes + Right.classes } companion object : Auto("uk-margin-auto") } - sealed class Remove(classname: String) : UIKitMargin(classname) { + sealed class Remove(vararg classnames: String) : UIKitMargin(*classnames) { object Top : Remove("uk-margin-remove-top") object Bottom : Remove("uk-margin-remove-bottom") object Left : Remove("uk-margin-remove-left") object Right : Remove("uk-margin-remove-right") object Vertical : Remove("uk-margin-remove-vertical") + object Horizontal : Remove() { override val classes: Array = Left.classes + Right.classes } object Adjacent : Remove("uk-margin-remove-adjacent") object FirstChild : Remove("uk-margin-remove-first-child") object LastChild : Remove("uk-margin-remove-last-child") From 366971bcf5cb521d75aa4af14ebbafeb5e4d079d Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 17 Feb 2022 17:28:42 +0600 Subject: [PATCH 4/6] add afterHeaderBuilder and beforeFooterBuilder in Dialog --- CHANGELOG.md | 1 + src/jsMain/kotlin/dev/inmo/jsuikit/elements/Dialog.kt | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ae7d4c..75e0686 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Reorder arguments in `DefaultComment` fun * Add `Vertical` and `Horizontal` members in margins +* Add `afterHeaderBuilder` and `beforeFooterBuilder` properties in `Dialog` fun ## 0.0.35 diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Dialog.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Dialog.kt index 96428eb..2771ac2 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Dialog.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Dialog.kt @@ -31,6 +31,8 @@ fun Dialog( dialogAttrsBuilder: AttrBuilderContext? = null, headerAttrsBuilder: AttrBuilderContext? = null, headerBuilder: ContentBuilder? = null, + afterHeaderBuilder: ContentBuilder? = null, + beforeFooterBuilder: ContentBuilder? = null, footerAttrsBuilder: AttrBuilderContext? = null, footerBuilder: ContentBuilder? = null, bodyAttrsBuilder: AttrBuilderContext? = null, @@ -62,6 +64,7 @@ fun Dialog( it() } } + afterHeaderBuilder ?.let { it() } Div( { include(UIKitModal.Body) @@ -70,6 +73,7 @@ fun Dialog( ) { bodyBuilder() } + beforeFooterBuilder ?.let { it() } footerBuilder ?.let { Div( { From 7b06e0ecb133fae6be8164bf8e0d72a9180d7fcf Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 17 Feb 2022 17:46:15 +0600 Subject: [PATCH 5/6] add UIKitCustom --- CHANGELOG.md | 1 + src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitCustom.kt | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitCustom.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 75e0686..f1a49f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * Reorder arguments in `DefaultComment` fun * Add `Vertical` and `Horizontal` members in margins * Add `afterHeaderBuilder` and `beforeFooterBuilder` properties in `Dialog` fun +* Add `UIKitCustom` to be able for simple creating of custom modifiers ## 0.0.35 diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitCustom.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitCustom.kt new file mode 100644 index 0000000..6d0a580 --- /dev/null +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitCustom.kt @@ -0,0 +1,6 @@ +package dev.inmo.jsuikit.modifiers + +class UIKitCustom( + override val classes: Array = emptyArray(), + override val otherAttrs: Map = emptyMap() +) : UIKitModifier From 44c35c6778eaf63d0be4de5193cb034824b51703 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 17 Feb 2022 19:31:31 +0600 Subject: [PATCH 6/6] support of UIKitForm --- CHANGELOG.md | 1 + .../kotlin/dev/inmo/jsuikit/elements/Icon.kt | 8 +++ .../dev/inmo/jsuikit/modifiers/UIKitForm.kt | 58 +++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitForm.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index f1a49f4..646ea91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Add `Vertical` and `Horizontal` members in margins * Add `afterHeaderBuilder` and `beforeFooterBuilder` properties in `Dialog` fun * Add `UIKitCustom` to be able for simple creating of custom modifiers +* Add support of `UIKitForm` ## 0.0.35 diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Icon.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Icon.kt index ab923af..f4162af 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Icon.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Icon.kt @@ -250,4 +250,12 @@ sealed class Icon(val name: String) { attributesCustomizer: AttrBuilderContext = {}, onClick: ((Event) -> Unit)? = null ) = invoke(*modifiers, type = UIKitIconType.Link, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer) + + @Composable + fun drawAsFormInputPart( + vararg modifiers: UIKitModifier, + ratio: Float? = null, + attributesCustomizer: AttrBuilderContext = {}, + onClick: ((Event) -> Unit)? = null + ) = invoke(*modifiers, UIKitForm.Icon, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer) } diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitForm.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitForm.kt new file mode 100644 index 0000000..341a09e --- /dev/null +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitForm.kt @@ -0,0 +1,58 @@ +package dev.inmo.jsuikit.modifiers + +import dev.inmo.jsuikit.utils.buildAttribute + +sealed class UIKitForm( + vararg classnames: String, + override val otherAttrs: Map = emptyMap() +) : UIKitModifier { + @Suppress("UNCHECKED_CAST") + override val classes: Array = classnames as Array + + object Fieldset : UIKitForm("uk-fieldset") + object Legend : UIKitForm("uk-legend") + + object Input : UIKitForm("uk-input") + object Select : UIKitForm("uk-select") + object TextArea : UIKitForm("uk-textarea") + object Radio : UIKitForm("uk-radio", otherAttrs = mapOf("type" to "radio")) + object Checkbox : UIKitForm("uk-checkbox", otherAttrs = mapOf("type" to "checkbox")) + object Range : UIKitForm("uk-range", otherAttrs = mapOf("type" to "range")) + + sealed class State(vararg classnames: String) : UIKitForm(*classnames) { + object Danger : State("uk-form-danger") + object Success : State("uk-form-success") + } + sealed class Size(vararg classnames: String) : UIKitForm(*classnames) { + object Large : Size("uk-form-large") + object Default : Size() // :) + object Small : Size("uk-form-small") + } + sealed class Width(vararg classnames: String) : UIKitForm(*classnames) { + object Large : Width("uk-form-width-large") + object Medium : Width("uk-form-width-medium") + object Small : Width("uk-form-width-small") + object XSmall : Width("uk-form-width-xsmall") + } + + object Blank : UIKitForm("uk-form-blank") + + sealed class Layout(vararg classnames: String) : UIKitForm(*classnames) { + object Stacked : Layout("uk-form-stacked") + object Horizontal : Layout("uk-form-horizontal") + object Label : Layout("uk-form-label") + object Controls : Layout("uk-form-controls") + } + + object Icon : UIKitForm("uk-form-icon") + + class Custom( + target: String = "true" + ) : UIKitForm( + otherAttrs = mapOf( + buildAttribute("uk-form-custom") { + "target" to target + } + ) + ) +}