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
## 0.0.11
* Upfill `Nav` and `UIKitNav`
## 0.0.10
* Filling of `UIKitUtility`

View File

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

View File

@ -27,8 +27,7 @@ fun Nav(
"animation" to animation
"duration" to duration ?.toString()
}
classes("uk-nav")
include(*modifiers)
include(*modifiers, UIKitNav)
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
fun <T> Nav(
title: String,
@ -59,8 +115,7 @@ fun <T> Nav(
"animation" to animation
"duration" to duration ?.toString()
}
classes("uk-nav")
include(*ulModifiers)
include(*ulModifiers, UIKitNav)
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
fun NavHeader(
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
fun NavElement(
vararg modifiers: UIKitModifier,

View File

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