2022-01-12 10:27:49 +00:00
|
|
|
package dev.inmo.jsuikit.elements
|
2021-12-22 08:38:12 +00:00
|
|
|
|
|
|
|
import androidx.compose.runtime.Composable
|
2022-01-12 10:27:49 +00:00
|
|
|
import dev.inmo.jsuikit.buildAndAddAttribute
|
2022-01-12 13:58:52 +00:00
|
|
|
import dev.inmo.jsuikit.modifiers.*
|
2022-04-15 07:06:14 +00:00
|
|
|
import dev.inmo.jsuikit.types.DropdownOptions
|
2022-01-12 10:27:49 +00:00
|
|
|
import dev.inmo.jsuikit.utils.Milliseconds
|
2022-01-13 05:55:08 +00:00
|
|
|
import org.jetbrains.compose.web.dom.*
|
2021-12-22 08:38:12 +00:00
|
|
|
import org.w3c.dom.HTMLDivElement
|
|
|
|
|
2022-04-15 07:06:14 +00:00
|
|
|
@Composable
|
|
|
|
fun Dropdown(
|
|
|
|
vararg modifiers: UIKitModifier,
|
|
|
|
dropdownOptions: DropdownOptions,
|
|
|
|
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {},
|
|
|
|
contentBuilder: ContentBuilder<HTMLDivElement>
|
|
|
|
) {
|
|
|
|
Div(
|
|
|
|
{
|
|
|
|
include(UIKitDropdown(dropdownOptions), *modifiers)
|
|
|
|
attributesCustomizer()
|
|
|
|
},
|
|
|
|
contentBuilder
|
|
|
|
)
|
|
|
|
}
|
2021-12-22 08:38:12 +00:00
|
|
|
@Composable
|
|
|
|
fun Dropdown(
|
2022-01-13 13:56:39 +00:00
|
|
|
vararg modifiers: UIKitModifier,
|
2021-12-22 08:38:12 +00:00
|
|
|
toggle: String? = null,
|
|
|
|
pos: UIKitDropdown.Position? = null,
|
|
|
|
mode: UIKitDropdown.Mode? = null,
|
|
|
|
delayShow: Milliseconds? = null,
|
|
|
|
delayHide: Milliseconds? = null,
|
|
|
|
boundary: String? = null,
|
|
|
|
boundaryAlign: Boolean? = null,
|
|
|
|
flip: UIKitDropdown.Flip? = null,
|
|
|
|
offset: Int? = null,
|
|
|
|
animation: UIKitAnimation? = null,
|
|
|
|
duration: Milliseconds? = null,
|
2022-01-13 05:55:08 +00:00
|
|
|
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {},
|
2021-12-22 08:38:12 +00:00
|
|
|
contentBuilder: ContentBuilder<HTMLDivElement>
|
|
|
|
) {
|
|
|
|
Div(
|
|
|
|
{
|
2022-04-15 07:06:14 +00:00
|
|
|
include(
|
|
|
|
UIKitDropdown(
|
|
|
|
DropdownOptions(
|
|
|
|
toggle = toggle,
|
|
|
|
pos = pos,
|
|
|
|
mode = mode,
|
|
|
|
delayShow = delayShow,
|
|
|
|
delayHide = delayHide,
|
|
|
|
boundary = boundary,
|
|
|
|
boundaryAlign = boundaryAlign,
|
|
|
|
flip = flip,
|
|
|
|
offset = offset,
|
|
|
|
animation = animation,
|
|
|
|
duration = duration
|
|
|
|
)
|
|
|
|
),
|
|
|
|
*modifiers
|
|
|
|
)
|
2022-01-13 05:55:08 +00:00
|
|
|
attributesCustomizer()
|
2021-12-22 08:38:12 +00:00
|
|
|
},
|
|
|
|
contentBuilder
|
|
|
|
)
|
|
|
|
}
|