mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2025-12-04 13:26:27 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 93dd63c6b1 | |||
| eb06ff80a1 | |||
| 25ba9188e3 | |||
| 19ca960b35 | |||
| ef3b711e2b | |||
| 6bebb8b8d4 | |||
| c013a978d4 | |||
| 9f342f428a | |||
| 0beb781e2c | |||
| 5880db3db1 | |||
| b7e08af54a |
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,3 +1,17 @@
|
||||
# Changelog
|
||||
|
||||
## 0.0.9
|
||||
|
||||
* Improving of `Nav` support
|
||||
|
||||
## 0.0.8
|
||||
|
||||
Removing of redundant non standard things
|
||||
|
||||
## 0.0.7
|
||||
|
||||
Rewrite project onto multiplatform paradigm and return back varargs instead of most `Array<UIKitModifier>`
|
||||
|
||||
## 0.0.6
|
||||
|
||||
Changes in signatures of text field and list
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
# JSUIKit Kotlin
|
||||
|
||||
**IMPORTANT NOTICE**: ___Currently it is possible that you will have issues with `vararg` arguments passing to the functions.
|
||||
Use `arrayOf(...)` instead___
|
||||
|
||||
Hello :) This library is a wrapper for JavaScript/CSS [UIKit](https://getuikit.com) framework. It uses the same
|
||||
structure as in [UIKit Docs](https://getuikit.com/docs/introduction) and in most cases you may use it.
|
||||
|
||||
@@ -11,10 +8,10 @@ for you in case you are using it too.
|
||||
|
||||
## How to include
|
||||
|
||||
Last version: [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/jsuikitkotlin)
|
||||
Last version: [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/kjsuikit)
|
||||
|
||||
```groovy
|
||||
implementation "dev.inmo:jsuikitkotlin:$jsuikitkotlin_version"
|
||||
implementation "dev.inmo:kjsuikit:$kjsuikit_version"
|
||||
```
|
||||
|
||||
**THIS LIBRARY DO NOT ADD ANY JS OR CSS**. So, you must download and include UIKit js/css by yourself. See
|
||||
|
||||
39
build.gradle
39
build.gradle
@@ -15,35 +15,44 @@ buildscript {
|
||||
}
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.kt.js)
|
||||
alias(libs.plugins.kt.multiplatform)
|
||||
alias(libs.plugins.jb.compose)
|
||||
}
|
||||
|
||||
project.version = "$version"
|
||||
project.group = "$group"
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
google()
|
||||
}
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
google()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
js(IR) {
|
||||
browser()
|
||||
binaries.executable()
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
implementation libs.kt.stdlib
|
||||
implementation compose.runtime
|
||||
}
|
||||
}
|
||||
jsMain {
|
||||
dependencies {
|
||||
implementation compose.web.core
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation libs.kt.stdlib
|
||||
implementation compose.web.core
|
||||
implementation compose.runtime
|
||||
testImplementation libs.kt.test.js
|
||||
testImplementation libs.kt.test.junit
|
||||
jsTest {
|
||||
dependencies {
|
||||
implementation libs.kt.test.js
|
||||
implementation libs.kt.test.junit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apply from: "./github_release.gradle"
|
||||
|
||||
@@ -9,4 +9,4 @@ android.enableJetifier=true
|
||||
# Project data
|
||||
|
||||
group=dev.inmo
|
||||
version=0.0.6
|
||||
version=0.0.9
|
||||
|
||||
@@ -18,5 +18,5 @@ buildscript-gh-release = { module = "com.github.breadmoirai:github-release", ver
|
||||
|
||||
[plugins]
|
||||
|
||||
kt-js = { id = "org.jetbrains.kotlin.js", version.ref = "kt" }
|
||||
kt-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kt" }
|
||||
jb-compose = { id = "org.jetbrains.compose", version.ref = "jb-compose" }
|
||||
|
||||
@@ -1,72 +1,57 @@
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
task javadocJar(type: Jar) {
|
||||
task javadocsJar(type: Jar) {
|
||||
classifier = 'javadoc'
|
||||
}
|
||||
task sourcesJar(type: Jar) {
|
||||
kotlin.sourceSets.all {
|
||||
from(kotlin)
|
||||
}
|
||||
classifier = 'sources'
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
kotlin.js().components.forEach {
|
||||
from(it)
|
||||
publications.all {
|
||||
artifact javadocsJar
|
||||
|
||||
pom {
|
||||
description = "${project.name}"
|
||||
name = "${project.name}"
|
||||
url = "https://github.com/InsanusMokrassar/JSUIKitKBindings"
|
||||
|
||||
scm {
|
||||
developerConnection = "scm:git:[fetch=]https://github.com/InsanusMokrassar/JSUIKitKBindings.git[push=]https://github.com/InsanusMokrassar/JSUIKitKBindings.git"
|
||||
url = "https://github.com/InsanusMokrassar/JSUIKitKBindings.git"
|
||||
}
|
||||
|
||||
artifact javadocJar
|
||||
artifact sourcesJar
|
||||
|
||||
pom {
|
||||
resolveStrategy = Closure.DELEGATE_FIRST
|
||||
|
||||
description = "${project.name}"
|
||||
name = "${project.name}"
|
||||
url = "https://github.com/InsanusMokrassar/JSUIKitKBindings"
|
||||
|
||||
scm {
|
||||
developerConnection = "scm:git:[fetch=]https://github.com/InsanusMokrassar/JSUIKitKBindings.git[push=]https://github.com/InsanusMokrassar/JSUIKitKBindings.git"
|
||||
url = "https://github.com/InsanusMokrassar/JSUIKitKBindings.git"
|
||||
}
|
||||
|
||||
developers {
|
||||
|
||||
developer {
|
||||
id = "InsanusMokrassar"
|
||||
name = "Ovsiannikov Aleksei"
|
||||
email = "ovsyannikov.alexey95@gmail.com"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
licenses {
|
||||
|
||||
license {
|
||||
name = "Apache Software License 2.0"
|
||||
url = "https://opensource.org/licenses/Apache-2.0"
|
||||
}
|
||||
|
||||
}
|
||||
developers {
|
||||
|
||||
developer {
|
||||
id = "InsanusMokrassar"
|
||||
name = "Ovsiannikov Aleksei"
|
||||
email = "ovsyannikov.alexey95@gmail.com"
|
||||
}
|
||||
|
||||
}
|
||||
repositories {
|
||||
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
|
||||
maven {
|
||||
name = "sonatype"
|
||||
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
|
||||
credentials {
|
||||
username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
|
||||
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
|
||||
}
|
||||
|
||||
licenses {
|
||||
|
||||
license {
|
||||
name = "Apache Software License 2.0"
|
||||
url = "https://opensource.org/licenses/Apache-2.0"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
|
||||
maven {
|
||||
name = "sonatype"
|
||||
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
|
||||
credentials {
|
||||
username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
|
||||
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (project.hasProperty("signing.gnupg.keyName")) {
|
||||
apply plugin: 'signing'
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://opensource.org/licenses/Apache-2.0"}],"mavenConfig":{"name":"${project.name}","description":"${project.name}","url":"https://github.com/InsanusMokrassar/JSUIKitKBindings","vcsUrl":"https://github.com/InsanusMokrassar/JSUIKitKBindings.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}},"type":"JS"}
|
||||
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://opensource.org/licenses/Apache-2.0"}],"mavenConfig":{"name":"${project.name}","description":"${project.name}","url":"https://github.com/InsanusMokrassar/JSUIKitKBindings","vcsUrl":"https://github.com/InsanusMokrassar/JSUIKitKBindings.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}
|
||||
@@ -12,7 +12,7 @@ import org.w3c.dom.events.Event
|
||||
|
||||
@Composable
|
||||
fun DefaultButton(
|
||||
modifiers: Array<UIKitModifier> = emptyArray(),
|
||||
vararg modifiers: UIKitModifier,
|
||||
disabled: Boolean = false,
|
||||
buttonType: UIKitButton.Type = UIKitButton.Type.Default,
|
||||
onClick: ((SyntheticMouseEvent) -> Unit)? = null,
|
||||
@@ -37,14 +37,14 @@ fun DefaultButton(
|
||||
@Composable
|
||||
fun DefaultButton(
|
||||
text: String,
|
||||
modifiers: Array<UIKitModifier> = emptyArray(),
|
||||
vararg modifiers: UIKitModifier,
|
||||
disabled: Boolean = false,
|
||||
buttonType: UIKitButton.Type = UIKitButton.Type.Default,
|
||||
preTextContentAllocator: ContentBuilder<HTMLButtonElement>? = null,
|
||||
afterTextContentAllocator: ContentBuilder<HTMLButtonElement>? = null,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLButtonElement> = {},
|
||||
onClick: ((SyntheticMouseEvent) -> Unit)? = null
|
||||
) = DefaultButton(modifiers, disabled = disabled, buttonType = buttonType, onClick = onClick, attributesCustomizer = attributesCustomizer) {
|
||||
) = DefaultButton(*modifiers, disabled = disabled, buttonType = buttonType, onClick = onClick, attributesCustomizer = attributesCustomizer) {
|
||||
preTextContentAllocator ?.apply { preTextContentAllocator() }
|
||||
Text(text)
|
||||
afterTextContentAllocator ?.apply { afterTextContentAllocator() }
|
||||
@@ -53,7 +53,7 @@ fun DefaultButton(
|
||||
@Composable
|
||||
fun UploadButton(
|
||||
text: String,
|
||||
buttonModifiers: Array<UIKitModifier> = emptyArray(),
|
||||
vararg buttonModifiers: UIKitModifier,
|
||||
containerModifiers: Array<UIKitModifier> = emptyArray(),
|
||||
disabled: Boolean = false,
|
||||
buttonType: UIKitButton.Type = UIKitButton.Type.Default,
|
||||
@@ -26,7 +26,7 @@ private class DialogDisposableEffectResult(
|
||||
@Composable
|
||||
fun Dialog(
|
||||
title: String? = null,
|
||||
modifiers: Array<UIKitModifier> = emptyArray(),
|
||||
vararg modifiers: UIKitModifier,
|
||||
hide: (() -> Unit)? = null,
|
||||
hidden: (() -> Unit)? = null,
|
||||
footerBuilder: (@Composable () -> Unit)? = null,
|
||||
@@ -9,7 +9,7 @@ import org.w3c.dom.HTMLDivElement
|
||||
|
||||
@Composable
|
||||
fun Dropdown(
|
||||
modifiers: Array<UIKitModifier> = emptyArray(),
|
||||
vararg modifiers: UIKitModifier,
|
||||
toggle: String? = null,
|
||||
pos: UIKitDropdown.Position? = null,
|
||||
mode: UIKitDropdown.Mode? = null,
|
||||
@@ -8,7 +8,7 @@ import org.w3c.dom.HTMLDivElement
|
||||
|
||||
@Composable
|
||||
fun Flex(
|
||||
modifiers: Array<UIKitModifier> = emptyArray(),
|
||||
vararg modifiers: UIKitModifier,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {},
|
||||
filler: @Composable ElementScope<HTMLDivElement>.() -> Unit
|
||||
) {
|
||||
@@ -8,7 +8,7 @@ import org.w3c.dom.HTMLDivElement
|
||||
|
||||
@Composable
|
||||
fun GridColumn(
|
||||
modifiers: Array<UIKitModifier> = emptyArray(),
|
||||
vararg modifiers: UIKitModifier,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {},
|
||||
builder: @Composable ElementScope<HTMLDivElement>.() -> Unit
|
||||
) {
|
||||
@@ -24,7 +24,7 @@ fun GridColumn(
|
||||
|
||||
@Composable
|
||||
fun Grid(
|
||||
modifiers: Array<UIKitModifier> = emptyArray(),
|
||||
vararg modifiers: UIKitModifier,
|
||||
masonry: Boolean = false,
|
||||
parallax: Int? = null,
|
||||
marginClass: String? = null,
|
||||
@@ -204,7 +204,7 @@ sealed class Icon(val name: String) {
|
||||
|
||||
@Composable
|
||||
operator fun invoke(
|
||||
modifiers: Array<UIKitModifier> = emptyArray(),
|
||||
vararg modifiers: UIKitModifier,
|
||||
type: UIKitIconType = UIKitIconType.Default,
|
||||
ratio: Float? = null,
|
||||
attributesCustomizer: AttrBuilderContext<out HTMLElement> = {},
|
||||
@@ -228,17 +228,17 @@ sealed class Icon(val name: String) {
|
||||
|
||||
@Composable
|
||||
fun drawAsButton(
|
||||
modifiers: Array<UIKitModifier> = emptyArray(),
|
||||
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)
|
||||
) = invoke(*modifiers, type = UIKitIconType.Button, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
|
||||
|
||||
@Composable
|
||||
fun drawAsIcon(
|
||||
modifiers: Array<UIKitModifier> = emptyArray(),
|
||||
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)
|
||||
) = invoke(*modifiers, type = UIKitIconType.Default, ratio = ratio, onClick = onClick, attributesCustomizer = attributesCustomizer)
|
||||
}
|
||||
@@ -10,9 +10,9 @@ sealed interface Label {
|
||||
val suffix: String
|
||||
|
||||
@Composable
|
||||
operator fun invoke(
|
||||
fun draw(
|
||||
text: String,
|
||||
modifiers: Array<UIKitModifier> = emptyArray(),
|
||||
vararg modifiers: UIKitModifier,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLSpanElement> = {},
|
||||
) = Span(
|
||||
{
|
||||
@@ -12,7 +12,7 @@ import org.w3c.dom.HTMLUListElement
|
||||
fun <T> List(
|
||||
title: String,
|
||||
data: SnapshotStateList<T>,
|
||||
titleModifiers: Array<UIKitModifier> = emptyArray(),
|
||||
vararg titleModifiers: UIKitModifier,
|
||||
ulModifiers: Array<UIKitModifier> = emptyArray(),
|
||||
besidesTitleAndList: (@Composable () -> Unit)? = null,
|
||||
titleCustomizer: AttrBuilderContext<HTMLHeadingElement> = {},
|
||||
114
src/jsMain/kotlin/dev/inmo/jsuikit/elements/Nav.kt
Normal file
114
src/jsMain/kotlin/dev/inmo/jsuikit/elements/Nav.kt
Normal file
@@ -0,0 +1,114 @@
|
||||
package dev.inmo.jsuikit.elements
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.snapshots.SnapshotStateList
|
||||
import dev.inmo.jsuikit.buildAndAddAttribute
|
||||
import dev.inmo.jsuikit.modifiers.*
|
||||
import dev.inmo.jsuikit.utils.Milliseconds
|
||||
import org.jetbrains.compose.web.dom.*
|
||||
import org.jetbrains.compose.web.dom.Text
|
||||
import org.w3c.dom.*
|
||||
|
||||
@Composable
|
||||
fun Nav(
|
||||
vararg modifiers: UIKitModifier,
|
||||
multiple: Boolean? = null,
|
||||
collapsible: Boolean? = null,
|
||||
animation: UIKitAnimation? = null,
|
||||
duration: Milliseconds? = null,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLUListElement> = {},
|
||||
dataAllocator: ContentBuilder<HTMLUListElement>
|
||||
) {
|
||||
Ul(
|
||||
{
|
||||
buildAndAddAttribute("uk-nav") {
|
||||
"multiple" to multiple ?.toString()
|
||||
"collapsible" to collapsible ?.toString()
|
||||
"animation" to animation
|
||||
"duration" to duration ?.toString()
|
||||
}
|
||||
classes("uk-nav")
|
||||
include(*modifiers)
|
||||
attributesCustomizer()
|
||||
}
|
||||
) {
|
||||
dataAllocator()
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun <T> Nav(
|
||||
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
|
||||
) {
|
||||
Ul(
|
||||
{
|
||||
buildAndAddAttribute("uk-nav") {
|
||||
"multiple" to multiple ?.toString()
|
||||
"collapsible" to collapsible ?.toString()
|
||||
"animation" to animation
|
||||
"duration" to duration ?.toString()
|
||||
}
|
||||
classes("uk-nav")
|
||||
include(*ulModifiers)
|
||||
ulCustomizer()
|
||||
}
|
||||
) {
|
||||
NavHeader(
|
||||
title,
|
||||
*titleModifiers,
|
||||
attributesCustomizer = titleCustomizer
|
||||
)
|
||||
besidesTitleAndList ?.let { it() }
|
||||
data.forEach {
|
||||
elementAllocator(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun NavHeader(
|
||||
text: String,
|
||||
vararg modifiers: UIKitModifier,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLLIElement> = {},
|
||||
) {
|
||||
Li(
|
||||
{
|
||||
include(*modifiers, UIKitNav.Header)
|
||||
attributesCustomizer()
|
||||
}
|
||||
) {
|
||||
Text(text)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun NavElement(
|
||||
vararg modifiers: UIKitModifier,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLLIElement> = {},
|
||||
contentAllocator: ContentBuilder<HTMLLIElement>
|
||||
) {
|
||||
Li(
|
||||
{
|
||||
include(*modifiers)
|
||||
attributesCustomizer()
|
||||
}
|
||||
) {
|
||||
contentAllocator()
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun NavDivider() {
|
||||
Li({ include(UIKitNav.Divider) })
|
||||
}
|
||||
@@ -11,7 +11,7 @@ fun Navbar(
|
||||
leftBuilder: NavbarNavBuilder? = null,
|
||||
centerBuilder: NavbarNavBuilder? = null,
|
||||
rightBuilder: NavbarNavBuilder? = null,
|
||||
navModifiers: Array<UIKitModifier> = emptyArray(),
|
||||
vararg navModifiers: UIKitModifier,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLElement> = {},
|
||||
) {
|
||||
Nav(
|
||||
@@ -10,7 +10,7 @@ import org.w3c.dom.HTMLProgressElement
|
||||
@Composable
|
||||
fun Progress(
|
||||
value: Int,
|
||||
modifiers: Array<UIKitModifier> = emptyArray(),
|
||||
vararg modifiers: UIKitModifier,
|
||||
max: Int = 100,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLProgressElement> = {}
|
||||
) {
|
||||
@@ -8,7 +8,7 @@ import org.w3c.dom.HTMLDivElement
|
||||
|
||||
@Composable
|
||||
fun Spinner(
|
||||
modifiers: Array<UIKitModifier> = emptyArray(),
|
||||
vararg modifiers: UIKitModifier,
|
||||
ratio: Float? = null,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLDivElement> = {}
|
||||
) {
|
||||
@@ -23,6 +23,4 @@ fun Spinner(
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun DefaultSpinner() = Spinner(
|
||||
arrayOf(UIKitAlign.Center, UIKitMargin.Small, UIKitText.Alignment.Center)
|
||||
)
|
||||
fun DefaultSpinner() = Spinner(UIKitAlign.Center, UIKitMargin.Small, UIKitText.Alignment.Center)
|
||||
@@ -4,15 +4,16 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.snapshots.SnapshotStateList
|
||||
import dev.inmo.jsuikit.modifiers.*
|
||||
import org.jetbrains.compose.web.dom.*
|
||||
import org.w3c.dom.HTMLProgressElement
|
||||
import org.w3c.dom.HTMLTableElement
|
||||
import org.jetbrains.compose.web.dom.Text
|
||||
import org.w3c.dom.*
|
||||
|
||||
@Composable
|
||||
fun <T> DefaultTable(
|
||||
heading: List<String>,
|
||||
dataList: SnapshotStateList<T>,
|
||||
tableModifiers: Array<UIKitModifier> = emptyArray(),
|
||||
vararg tableModifiers: UIKitModifier,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLTableElement> = {},
|
||||
headingCustomizer: AttrBuilderContext<HTMLTableCellElement> = {},
|
||||
cellFiller: @Composable (i: Int, t: T) -> Unit
|
||||
) {
|
||||
val headingIndexes = heading.indices
|
||||
@@ -28,7 +29,7 @@ fun <T> DefaultTable(
|
||||
heading.forEach {
|
||||
Th(
|
||||
{
|
||||
include(UIKitExtension.TextTransformUnset)
|
||||
headingCustomizer()
|
||||
}
|
||||
) {
|
||||
Text(it)
|
||||
@@ -14,7 +14,7 @@ fun <T> TextField(
|
||||
state: MutableState<T>,
|
||||
disabledState: State<Boolean>? = null,
|
||||
placeholder: String? = null,
|
||||
modifiers: Array<UIKitModifier> = emptyArray(),
|
||||
vararg modifiers: UIKitModifier,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLInputElement> = {},
|
||||
) {
|
||||
Input(type) {
|
||||
@@ -1,52 +0,0 @@
|
||||
package dev.inmo.jsuikit.elements
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import dev.inmo.jsuikit.buildAndAddAttribute
|
||||
import dev.inmo.jsuikit.modifiers.*
|
||||
import dev.inmo.jsuikit.utils.Milliseconds
|
||||
import org.jetbrains.compose.web.dom.*
|
||||
import org.w3c.dom.HTMLLIElement
|
||||
import org.w3c.dom.HTMLUListElement
|
||||
|
||||
@Composable
|
||||
fun Nav(
|
||||
modifiers: Array<UIKitModifier> = emptyArray(),
|
||||
multiple: Boolean? = null,
|
||||
collapsible: Boolean? = null,
|
||||
animation: UIKitAnimation? = null,
|
||||
duration: Milliseconds? = null,
|
||||
attributesCustomizer: AttrBuilderContext<HTMLUListElement> = {},
|
||||
dataAllocator: ContentBuilder<HTMLUListElement>
|
||||
) {
|
||||
Ul(
|
||||
{
|
||||
buildAndAddAttribute("uk-nav") {
|
||||
"multiple" to multiple ?.toString()
|
||||
"collapsible" to collapsible ?.toString()
|
||||
"animation" to animation
|
||||
"duration" to duration ?.toString()
|
||||
}
|
||||
classes("uk-nav")
|
||||
include(*modifiers)
|
||||
attributesCustomizer()
|
||||
}
|
||||
) {
|
||||
dataAllocator()
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun NavElement(
|
||||
modifiers: Array<UIKitModifier> = emptyArray(),
|
||||
attributesCustomizer: AttrBuilderContext<HTMLLIElement> = {},
|
||||
contentAllocator: ContentBuilder<HTMLLIElement>
|
||||
) {
|
||||
Li(
|
||||
{
|
||||
include(*modifiers)
|
||||
attributesCustomizer
|
||||
}
|
||||
) {
|
||||
contentAllocator()
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package dev.inmo.jsuikit.modifiers
|
||||
|
||||
sealed class UIKitExtension(classname: String) : UIKitModifier {
|
||||
override val classes: Array<String> = arrayOf(classname)
|
||||
object TextTransformUnset : UIKitExtension("text_transform_unset")
|
||||
object CursorPointer : UIKitExtension("cursor_pointer")
|
||||
}
|
||||
Reference in New Issue
Block a user