mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-12-22 00:27:25 +00:00
support of UIKitForm
This commit is contained in:
parent
7b06e0ecb1
commit
44c35c6778
@ -6,6 +6,7 @@
|
|||||||
* Add `Vertical` and `Horizontal` members in margins
|
* Add `Vertical` and `Horizontal` members in margins
|
||||||
* Add `afterHeaderBuilder` and `beforeFooterBuilder` properties in `Dialog` fun
|
* Add `afterHeaderBuilder` and `beforeFooterBuilder` properties in `Dialog` fun
|
||||||
* Add `UIKitCustom` to be able for simple creating of custom modifiers
|
* Add `UIKitCustom` to be able for simple creating of custom modifiers
|
||||||
|
* Add support of `UIKitForm`
|
||||||
|
|
||||||
## 0.0.35
|
## 0.0.35
|
||||||
|
|
||||||
|
@ -250,4 +250,12 @@ sealed class Icon(val name: String) {
|
|||||||
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
|
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
|
||||||
onClick: ((Event) -> Unit)? = null
|
onClick: ((Event) -> Unit)? = null
|
||||||
) = invoke(*modifiers, type = UIKitIconType.Link, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
|
) = invoke(*modifiers, type = UIKitIconType.Link, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun drawAsFormInputPart(
|
||||||
|
vararg modifiers: UIKitModifier,
|
||||||
|
ratio: Float? = null,
|
||||||
|
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
|
||||||
|
onClick: ((Event) -> Unit)? = null
|
||||||
|
) = invoke(*modifiers, UIKitForm.Icon, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
|
||||||
}
|
}
|
||||||
|
58
src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitForm.kt
Normal file
58
src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitForm.kt
Normal file
@ -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<String, String> = emptyMap()
|
||||||
|
) : UIKitModifier {
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
override val classes: Array<String> = classnames as Array<String>
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user