diff --git a/CHANGELOG.md b/CHANGELOG.md index 34ad16d..c886dff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 0.0.43 + +* Several new extensions for `UIKitModifier` like `UIKitModifier#onSmallScreen` +* Support of `Tile` + ## 0.0.42 * Migration to compose 1.1.0 diff --git a/gradle.properties b/gradle.properties index cbd324d..046fce6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,4 +9,4 @@ android.enableJetifier=true # Project data group=dev.inmo -version=0.0.42 +version=0.0.43 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2e6e589..00e33ed 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Grid.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Grid.kt index d0c357e..bc31bce 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Grid.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Grid.kt @@ -10,7 +10,7 @@ import org.w3c.dom.HTMLDivElement fun GridColumn( vararg modifiers: UIKitModifier, attributesCustomizer: AttrBuilderContext = {}, - builder: @Composable ElementScope.() -> Unit + builder: @Composable ElementScope.() -> Unit = {} ) { Div( { @@ -30,7 +30,7 @@ fun Grid( marginClass: String? = null, firstColumnClass: String? = null, attributesCustomizer: AttrBuilderContext = {}, - builder: @Composable ElementScope.() -> Unit + builder: @Composable ElementScope.() -> Unit = {} ) { val attrs = listOfNotNull( if (masonry) "masonry" to "true" else null, diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Tile.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Tile.kt new file mode 100644 index 0000000..5a533c3 --- /dev/null +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/elements/Tile.kt @@ -0,0 +1,21 @@ +package dev.inmo.jsuikit.elements + +import androidx.compose.runtime.Composable +import dev.inmo.jsuikit.modifiers.UIKitTile +import dev.inmo.jsuikit.modifiers.include +import dev.inmo.jsuikit.utils.Attrs +import org.jetbrains.compose.web.dom.ContentBuilder +import org.jetbrains.compose.web.dom.Div +import org.w3c.dom.HTMLDivElement + +@Composable +fun Tile( + attrs: Attrs = Attrs.empty(), + contentBuilder: ContentBuilder +) = Div( + { + include(UIKitTile) + attrs.builder(this) + }, + contentBuilder +) diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitScreenSizeModifier.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitScreenSizeModifier.kt index f5e4248..61d2871 100644 --- a/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitScreenSizeModifier.kt +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitScreenSizeModifier.kt @@ -20,3 +20,12 @@ sealed class UIKitScreenSizeModifier(val name: String) { } fun UIKitModifier.applyWhenScreenSizeIs(size: UIKitScreenSizeModifier) = size.modify(this) + +val UIKitModifier.onSmallScreens + get() = applyWhenScreenSizeIs(UIKitScreenSizeModifier.Small) +val UIKitModifier.onMediumScreens + get() = applyWhenScreenSizeIs(UIKitScreenSizeModifier.Medium) +val UIKitModifier.onLargeScreens + get() = applyWhenScreenSizeIs(UIKitScreenSizeModifier.Large) +val UIKitModifier.onXLargeScreens + get() = applyWhenScreenSizeIs(UIKitScreenSizeModifier.XLarge) diff --git a/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitTile.kt b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitTile.kt new file mode 100644 index 0000000..49a2161 --- /dev/null +++ b/src/jsMain/kotlin/dev/inmo/jsuikit/modifiers/UIKitTile.kt @@ -0,0 +1,15 @@ +package dev.inmo.jsuikit.modifiers + +sealed class UIKitTile( + override val classes: Array = emptyArray(), + override val otherAttrs: Map = emptyMap() +) : UIKitModifier { + + object Default : UIKitTile(arrayOf("uk-tile-default")) + object Muted : UIKitTile(arrayOf("uk-tile-muted")) + object Primary : UIKitTile(arrayOf("uk-tile-primary")) + object Secondary : UIKitTile(arrayOf("uk-tile-secondary")) + + companion object : UIKitTile(arrayOf("uk-tile")) + +}