From 2f8c354d2a247fd45223fd9237a3d5bbc586b086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Rayapoull=C3=A9?= Date: Wed, 16 Aug 2023 15:27:16 +0200 Subject: [PATCH] fix: fixes for release 0.4.0 --- .../main/kotlin/com/adevinta/spark/Spark.kt | 27 ------------------- .../spark/components/divider/Divider.kt | 10 ++++--- .../spark/components/tags/TagFilled.kt | 10 +++---- .../tags/{TagTonal.kt => TagTinted.kt} | 0 .../spark/tools/preview/SparkPreview.kt | 10 +++---- .../tools/preview/SparkPreviewProvider.kt | 5 ---- 6 files changed, 17 insertions(+), 45 deletions(-) delete mode 100644 spark/src/main/kotlin/com/adevinta/spark/Spark.kt rename spark/src/main/kotlin/com/adevinta/spark/components/tags/{TagTonal.kt => TagTinted.kt} (100%) diff --git a/spark/src/main/kotlin/com/adevinta/spark/Spark.kt b/spark/src/main/kotlin/com/adevinta/spark/Spark.kt deleted file mode 100644 index 68efec6d9..000000000 --- a/spark/src/main/kotlin/com/adevinta/spark/Spark.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2023 Adevinta - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.adevinta.spark - -/** - * Spark - */ -public object Spark diff --git a/spark/src/main/kotlin/com/adevinta/spark/components/divider/Divider.kt b/spark/src/main/kotlin/com/adevinta/spark/components/divider/Divider.kt index 31d566a46..1900a2009 100644 --- a/spark/src/main/kotlin/com/adevinta/spark/components/divider/Divider.kt +++ b/spark/src/main/kotlin/com/adevinta/spark/components/divider/Divider.kt @@ -31,7 +31,7 @@ import androidx.compose.ui.unit.Dp import com.adevinta.spark.ExperimentalSparkApi import com.adevinta.spark.PreviewTheme import com.adevinta.spark.SparkTheme -import com.adevinta.spark.tokens.DisabledAlpha +import com.adevinta.spark.tokens.dim3 import com.adevinta.spark.tools.preview.ThemeProvider import com.adevinta.spark.tools.preview.ThemeVariant import androidx.compose.material3.Divider as MaterialDivider @@ -58,14 +58,18 @@ internal fun SparkDivider( * ![Divider image](https://developer.android.com/images/reference/androidx/compose/material3/divider.png) * * @param modifier the [Modifier] to be applied to this divider line. + * @param color the color of the divider, we recommend to use either outline or onSurface dim 3. */ @ExperimentalSparkApi @Composable -public fun Divider(modifier: Modifier = Modifier) { +public fun Divider( + modifier: Modifier = Modifier, + color: Color = SparkTheme.colors.onSurface.dim3, +) { SparkDivider( modifier = modifier, thickness = DividerDefaults.Thickness, - color = SparkTheme.colors.onSurface.copy(DisabledAlpha), + color = color, ) } diff --git a/spark/src/main/kotlin/com/adevinta/spark/components/tags/TagFilled.kt b/spark/src/main/kotlin/com/adevinta/spark/components/tags/TagFilled.kt index bb4daa85e..313403d07 100644 --- a/spark/src/main/kotlin/com/adevinta/spark/components/tags/TagFilled.kt +++ b/spark/src/main/kotlin/com/adevinta/spark/components/tags/TagFilled.kt @@ -30,7 +30,6 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter -import com.adevinta.spark.ExperimentalSparkApi import com.adevinta.spark.PreviewTheme import com.adevinta.spark.icons.SparkIcon import com.adevinta.spark.tools.preview.ThemeProvider @@ -44,7 +43,6 @@ import com.adevinta.spark.tools.preview.ThemeVariant * @param leadingIcon The spark icon shown at the start of the tag * @param tint The tint color for the icon. Use Color.Unspecified to not apply tint. */ -@ExperimentalSparkApi @Composable public fun TagFilled( text: String, @@ -63,11 +61,13 @@ public fun TagFilled( } /** - * Filled tag can be used to identify your brand DNA inside a list. + * Filled tag represent main information + * @param text The styled item label * @param modifier The [Modifier] to be applied to the component - * @param content The item label + * @param intent The [TagIntent] color to use + * @param leadingIcon The spark icon shown at the start of the tag + * @param tint The tint color for the icon. Use Color.Unspecified to not apply tint. */ -@ExperimentalSparkApi @Composable public fun TagFilled( text: AnnotatedString, diff --git a/spark/src/main/kotlin/com/adevinta/spark/components/tags/TagTonal.kt b/spark/src/main/kotlin/com/adevinta/spark/components/tags/TagTinted.kt similarity index 100% rename from spark/src/main/kotlin/com/adevinta/spark/components/tags/TagTonal.kt rename to spark/src/main/kotlin/com/adevinta/spark/components/tags/TagTinted.kt diff --git a/spark/src/main/kotlin/com/adevinta/spark/tools/preview/SparkPreview.kt b/spark/src/main/kotlin/com/adevinta/spark/tools/preview/SparkPreview.kt index 162ec86d9..16b4bfe9e 100644 --- a/spark/src/main/kotlin/com/adevinta/spark/tools/preview/SparkPreview.kt +++ b/spark/src/main/kotlin/com/adevinta/spark/tools/preview/SparkPreview.kt @@ -33,7 +33,7 @@ import androidx.compose.ui.tooling.preview.Preview device = "id:pixel_6", uiMode = UI_MODE_NIGHT_NO or UI_MODE_TYPE_NORMAL, ) -public annotation class SparkBasePreview +internal annotation class SparkBasePreview @Preview( name = "small font", @@ -49,7 +49,7 @@ public annotation class SparkBasePreview locale = "fr-rFR", fontScale = 1.5f, ) -public annotation class FontScalePreviews +internal annotation class FontScalePreviews @Preview( name = "phone", @@ -83,7 +83,7 @@ public annotation class FontScalePreviews locale = "fr-rFR", device = Devices.DESKTOP, ) -public annotation class DevicePreviews +internal annotation class DevicePreviews @Preview( name = "light", @@ -97,8 +97,8 @@ public annotation class DevicePreviews locale = "fr-rFR", uiMode = UI_MODE_NIGHT_YES, ) -public annotation class ThemesPreviews +internal annotation class ThemesPreviews @DevicePreviews @ThemesPreviews -public annotation class SparkPreviews +internal annotation class SparkPreviews diff --git a/spark/src/main/kotlin/com/adevinta/spark/tools/preview/SparkPreviewProvider.kt b/spark/src/main/kotlin/com/adevinta/spark/tools/preview/SparkPreviewProvider.kt index decc1be3f..61138a54f 100644 --- a/spark/src/main/kotlin/com/adevinta/spark/tools/preview/SparkPreviewProvider.kt +++ b/spark/src/main/kotlin/com/adevinta/spark/tools/preview/SparkPreviewProvider.kt @@ -25,11 +25,6 @@ import androidx.compose.ui.tooling.preview.PreviewParameterProvider import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider import kotlin.reflect.KClass -public class SparkPreviewProvider : PreviewParameterProvider> by compositeProvider( - ThemeProvider::class, - UserProProvider::class, -) - public class SparkPreviewParamProvider : CollectionPreviewParameterProvider( listOf( SparkPreviewParam(ThemeVariant.Light, UserType.Part, isLegacy = false),