fixes for build

This commit is contained in:
InsanusMokrassar 2022-11-16 00:17:03 +06:00
parent 17ae0b119b
commit 0c281aa653
2 changed files with 58 additions and 56 deletions

View File

@ -202,14 +202,19 @@ sealed class Icon(val name: String) {
object Youtube : Brands("youtube") object Youtube : Brands("youtube")
} }
@Composable class Custom(name: String) : Icon(name)
operator fun invoke(
companion object {
}
}
@Composable
operator fun Icon.invoke(
vararg modifiers: UIKitModifier, vararg modifiers: UIKitModifier,
type: UIKitIconType = UIKitIconType.Default, type: UIKitIconType = UIKitIconType.Default,
ratio: Float? = null, ratio: Float? = null,
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {}, attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
onClick: ((Event) -> Unit)? = null onClick: ((Event) -> Unit)? = null
) { ) {
val configurer: AttrBuilderContext<out HTMLElement> = { val configurer: AttrBuilderContext<out HTMLElement> = {
include(*modifiers, type, UIKitIcon) include(*modifiers, type, UIKitIcon)
attr("uk-icon", "icon: $name${if (ratio != null) { "; ratio: $ratio" } else ""}") attr("uk-icon", "icon: $name${if (ratio != null) { "; ratio: $ratio" } else ""}")
@ -223,39 +228,36 @@ sealed class Icon(val name: String) {
UIKitIconType.Link -> A(href = "#", configurer) UIKitIconType.Link -> A(href = "#", configurer)
UIKitIconType.Button -> Button(configurer) UIKitIconType.Button -> Button(configurer)
} }
}
class Custom(name: String) : Icon(name)
@Composable
fun drawAsButton(
vararg modifiers: UIKitModifier,
ratio: Float? = null,
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
onClick: ((Event) -> Unit)? = null
) = invoke(*modifiers, type = UIKitIconType.Button, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
@Composable
fun drawAsIcon(
vararg modifiers: UIKitModifier,
ratio: Float? = null,
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
onClick: ((Event) -> Unit)? = null
) = invoke(*modifiers, type = UIKitIconType.Default, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
@Composable
fun drawAsLink(
vararg modifiers: UIKitModifier,
ratio: Float? = null,
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
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<out HTMLElement> = {},
onClick: ((Event) -> Unit)? = null
) = invoke(*modifiers, UIKitForm.Icon, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
} }
@Composable
fun Icon.drawAsButton(
vararg modifiers: UIKitModifier,
ratio: Float? = null,
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
onClick: ((Event) -> Unit)? = null
) = invoke(*modifiers, type = UIKitIconType.Button, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
@Composable
fun Icon.drawAsIcon(
vararg modifiers: UIKitModifier,
ratio: Float? = null,
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
onClick: ((Event) -> Unit)? = null
) = invoke(*modifiers, type = UIKitIconType.Default, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
@Composable
fun Icon.drawAsLink(
vararg modifiers: UIKitModifier,
ratio: Float? = null,
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
onClick: ((Event) -> Unit)? = null
) = invoke(*modifiers, type = UIKitIconType.Link, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
@Composable
fun Icon.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)

View File

@ -9,7 +9,7 @@ import org.jetbrains.compose.web.dom.Input
import org.w3c.dom.HTMLInputElement import org.w3c.dom.HTMLInputElement
@Composable @Composable
fun <T> StandardInput( fun <T> DefaultInput(
type: InputType<T>, type: InputType<T>,
value: T, value: T,
disabled: Boolean = false, disabled: Boolean = false,
@ -49,7 +49,7 @@ fun <T> StandardInput(
placeholder: String? = null, placeholder: String? = null,
vararg modifiers: UIKitModifier, vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {}, attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {},
) = StandardInput( ) = DefaultInput(
type, type,
state.value, state.value,
disabledState ?.value == true, disabledState ?.value == true,