mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-12-28 03:27:15 +00:00
upfill navs
This commit is contained in:
parent
1e452c78d1
commit
4282165d79
@ -2,6 +2,8 @@
|
||||
|
||||
## 0.0.11
|
||||
|
||||
* Upfill `Nav` and `UIKitNav`
|
||||
|
||||
## 0.0.10
|
||||
|
||||
* Filling of `UIKitUtility`
|
||||
|
@ -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,
|
||||
|
@ -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")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user