Merge pull request #11 from InsanusMokrassar/0.0.11

0.0.11
This commit is contained in:
InsanusMokrassar 2022-01-21 11:32:00 +06:00 committed by GitHub
commit b5e93bc829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 173 additions and 7 deletions

View File

@ -1,5 +1,9 @@
# Changelog # Changelog
## 0.0.11
* Upfill `Nav` and `UIKitNav`
## 0.0.10 ## 0.0.10
* Filling of `UIKitUtility` * Filling of `UIKitUtility`

View File

@ -9,4 +9,4 @@ android.enableJetifier=true
# Project data # Project data
group=dev.inmo group=dev.inmo
version=0.0.10 version=0.0.11

View File

@ -27,8 +27,7 @@ fun Nav(
"animation" to animation "animation" to animation
"duration" to duration ?.toString() "duration" to duration ?.toString()
} }
classes("uk-nav") include(*modifiers, UIKitNav)
include(*modifiers)
attributesCustomizer() attributesCustomizer()
} }
) { ) {
@ -36,6 +35,63 @@ fun Nav(
} }
} }
@Composable
fun DefaultNav(
vararg modifiers: UIKitModifier,
multiple: Boolean? = null,
collapsible: Boolean? = null,
animation: UIKitAnimation? = null,
duration: Milliseconds? = null,
attributesCustomizer: AttrBuilderContext<HTMLUListElement> = {},
dataAllocator: ContentBuilder<HTMLUListElement>
) = Nav(
modifiers = modifiers + UIKitNav.Default,
multiple,
collapsible,
animation,
duration,
attributesCustomizer,
dataAllocator
)
@Composable
fun PrimaryNav(
vararg modifiers: UIKitModifier,
multiple: Boolean? = null,
collapsible: Boolean? = null,
animation: UIKitAnimation? = null,
duration: Milliseconds? = null,
attributesCustomizer: AttrBuilderContext<HTMLUListElement> = {},
dataAllocator: ContentBuilder<HTMLUListElement>
) = Nav(
modifiers = modifiers + UIKitNav.Primary,
multiple,
collapsible,
animation,
duration,
attributesCustomizer,
dataAllocator
)
@Composable
fun SubNav(
vararg modifiers: UIKitModifier,
multiple: Boolean? = null,
collapsible: Boolean? = null,
animation: UIKitAnimation? = null,
duration: Milliseconds? = null,
attributesCustomizer: AttrBuilderContext<HTMLUListElement> = {},
dataAllocator: ContentBuilder<HTMLUListElement>
) = Nav(
modifiers = modifiers + UIKitNav.SubNav,
multiple,
collapsible,
animation,
duration,
attributesCustomizer,
dataAllocator
)
@Composable @Composable
fun <T> Nav( fun <T> Nav(
title: String, title: String,
@ -59,8 +115,7 @@ fun <T> Nav(
"animation" to animation "animation" to animation
"duration" to duration ?.toString() "duration" to duration ?.toString()
} }
classes("uk-nav") include(*ulModifiers, UIKitNav)
include(*ulModifiers)
ulCustomizer() ulCustomizer()
} }
) { ) {
@ -76,6 +131,93 @@ fun <T> Nav(
} }
} }
@Composable
fun <T> DefaultNav(
title: String,
data: SnapshotStateList<T>,
vararg ulModifiers: UIKitModifier,
titleModifiers: Array<UIKitModifier> = emptyArray(),
multiple: Boolean? = null,
collapsible: Boolean? = null,
animation: UIKitAnimation? = null,
duration: Milliseconds? = null,
besidesTitleAndList: ContentBuilder<HTMLUListElement>? = null,
titleCustomizer: AttrBuilderContext<HTMLLIElement> = {},
ulCustomizer: AttrBuilderContext<HTMLUListElement> = {},
elementAllocator: @Composable ElementScope<HTMLUListElement>.(T) -> Unit
) = Nav(
title,
data,
ulModifiers = ulModifiers + UIKitNav.Default,
titleModifiers,
multiple,
collapsible,
animation,
duration,
besidesTitleAndList,
titleCustomizer,
ulCustomizer,
elementAllocator
)
@Composable
fun <T> PrimaryNav(
title: String,
data: SnapshotStateList<T>,
vararg ulModifiers: UIKitModifier,
titleModifiers: Array<UIKitModifier> = emptyArray(),
multiple: Boolean? = null,
collapsible: Boolean? = null,
animation: UIKitAnimation? = null,
duration: Milliseconds? = null,
besidesTitleAndList: ContentBuilder<HTMLUListElement>? = null,
titleCustomizer: AttrBuilderContext<HTMLLIElement> = {},
ulCustomizer: AttrBuilderContext<HTMLUListElement> = {},
elementAllocator: @Composable ElementScope<HTMLUListElement>.(T) -> Unit
) = Nav(
title,
data,
ulModifiers = ulModifiers + UIKitNav.Primary,
titleModifiers,
multiple,
collapsible,
animation,
duration,
besidesTitleAndList,
titleCustomizer,
ulCustomizer,
elementAllocator
)
@Composable
fun <T> SubNav(
title: String,
data: SnapshotStateList<T>,
vararg ulModifiers: UIKitModifier,
titleModifiers: Array<UIKitModifier> = emptyArray(),
multiple: Boolean? = null,
collapsible: Boolean? = null,
animation: UIKitAnimation? = null,
duration: Milliseconds? = null,
besidesTitleAndList: ContentBuilder<HTMLUListElement>? = null,
titleCustomizer: AttrBuilderContext<HTMLLIElement> = {},
ulCustomizer: AttrBuilderContext<HTMLUListElement> = {},
elementAllocator: @Composable ElementScope<HTMLUListElement>.(T) -> Unit
) = Nav(
title,
data,
ulModifiers = ulModifiers + UIKitNav.SubNav,
titleModifiers,
multiple,
collapsible,
animation,
duration,
besidesTitleAndList,
titleCustomizer,
ulCustomizer,
elementAllocator
)
@Composable @Composable
fun NavHeader( fun NavHeader(
text: String, text: String,
@ -92,6 +234,24 @@ fun NavHeader(
} }
} }
@Composable
fun NavItemElement(
vararg modifiers: UIKitModifier,
attributesCustomizer: AttrBuilderContext<HTMLLIElement> = {},
contentAllocator: ContentBuilder<HTMLAnchorElement>
) {
Li(
{
include(*modifiers)
attributesCustomizer()
}
) {
A("#") {
contentAllocator()
}
}
}
@Composable @Composable
fun NavElement( fun NavElement(
vararg modifiers: UIKitModifier, vararg modifiers: UIKitModifier,

View File

@ -3,8 +3,8 @@ package dev.inmo.jsuikit.modifiers
sealed class UIKitNav(classname: String) : UIKitModifier { sealed class UIKitNav(classname: String) : UIKitModifier {
override val classes: Array<String> = arrayOf(classname) override val classes: Array<String> = arrayOf(classname)
object Accordion : UIKitNav("uk-nav-parent-icon") object ParentIcon : UIKitNav("uk-nav-parent-icon")
object Subnav : UIKitNav("uk-nav-sub") object SubNav : UIKitNav("uk-nav-sub")
object Header : UIKitNav("uk-nav-header") object Header : UIKitNav("uk-nav-header")
object Divider : UIKitNav("uk-nav-divider") object Divider : UIKitNav("uk-nav-divider")
@ -14,4 +14,6 @@ sealed class UIKitNav(classname: String) : UIKitModifier {
object Primary : UIKitNav("uk-nav-primary") object Primary : UIKitNav("uk-nav-primary")
object Center : UIKitNav("uk-nav-center") object Center : UIKitNav("uk-nav-center")
companion object : UIKitNav("uk-nav")
} }