diff --git a/core/src/main/java/com/orange/ouds/core/component/contrastedsurface/OudsContrastedSurface.kt b/core/src/main/java/com/orange/ouds/core/component/contrastedsurface/OudsContrastedSurface.kt new file mode 100644 index 00000000..cafcd967 --- /dev/null +++ b/core/src/main/java/com/orange/ouds/core/component/contrastedsurface/OudsContrastedSurface.kt @@ -0,0 +1,114 @@ +/* + * Software Name: OUDS Android + * SPDX-FileCopyrightText: Copyright (c) Orange SA + * SPDX-License-Identifier: MIT + * + * This software is distributed under the MIT license, + * the text of which is available at https://opensource.org/license/MIT/ + * or see the "LICENSE" file for more details. + * + * Software description: Android library of reusable graphical components + */ + +package com.orange.ouds.core.component.contrastedsurface + +import androidx.compose.foundation.BorderStroke +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.RectangleShape +import androidx.compose.ui.graphics.Shape +import androidx.compose.ui.tooling.preview.PreviewParameter +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import com.orange.ouds.core.theme.LocalContrastedSurface +import com.orange.ouds.core.theme.value +import com.orange.ouds.core.utilities.OudsPreview +import com.orange.ouds.foundation.utilities.BasicPreviewParameterProvider +import com.orange.ouds.foundation.utilities.UiModePreviews +import com.orange.ouds.theme.tokens.OudsColorKeyToken +import com.orange.ouds.theme.tokens.OudsSpaceKeyToken + +@Composable +fun OudsContrastedSurface( + color: OudsColorKeyToken.Surface, + modifier: Modifier = Modifier, + shape: Shape = RectangleShape, + tonalElevation: Dp = 0.dp, + shadowElevation: Dp = 0.dp, + border: BorderStroke? = null, + content: @Composable () -> Unit +) { + CompositionLocalProvider(LocalContrastedSurface provides color) { + Surface( + modifier = modifier, + shape = shape, + color = color.value, + contentColor = contentColorFor(color), + tonalElevation = tonalElevation, + shadowElevation = shadowElevation, + border = border, + content = content + ) + } +} + +@Composable +private fun contentColorFor(color: OudsColorKeyToken.Surface): Color { + return when (color) { + OudsColorKeyToken.Surface.Brand.Primary -> OudsColorKeyToken.Content.OnBrand.Primary + OudsColorKeyToken.Surface.Status.Accent.Emphasized, + OudsColorKeyToken.Surface.Status.Info.Emphasized, + OudsColorKeyToken.Surface.Status.Negative.Emphasized, + OudsColorKeyToken.Surface.Status.Positive.Emphasized, + OudsColorKeyToken.Surface.Status.Warning.Emphasized -> OudsColorKeyToken.Content.OnStatus.Emphasized + OudsColorKeyToken.Surface.Status.Neutral.Emphasized -> OudsColorKeyToken.Content.OnStatus.EmphasizedNeutral + OudsColorKeyToken.Surface.Status.Accent.Muted, + OudsColorKeyToken.Surface.Status.Info.Muted, + OudsColorKeyToken.Surface.Status.Negative.Muted, + OudsColorKeyToken.Surface.Status.Positive.Muted, + OudsColorKeyToken.Surface.Status.Neutral.Muted, + OudsColorKeyToken.Surface.Status.Warning.Muted -> OudsColorKeyToken.Content.OnStatus.Muted + }.value +} + +@Suppress("PreviewShouldNotBeCalledRecursively") +@UiModePreviews.Default +@Composable +private fun PreviewOudsContrastedSurface(@PreviewParameter(OudsContrastedSurfacePreviewParameterProvider::class) parameter: OudsColorKeyToken.Surface) { + PreviewOudsContrastedSurface(darkThemeEnabled = isSystemInDarkTheme(), parameter = parameter) +} + +@Composable +internal fun PreviewOudsContrastedSurface(darkThemeEnabled: Boolean, parameter: OudsColorKeyToken.Surface) = OudsPreview(darkThemeEnabled = darkThemeEnabled) { + OudsContrastedSurface(color = parameter) { + Text( + modifier = Modifier.padding(all = OudsSpaceKeyToken.Fixed.Medium.value), + text = parameter.name.removePrefix("OudsColorKeyToken."), + ) + } +} + +internal class OudsContrastedSurfacePreviewParameterProvider : BasicPreviewParameterProvider(*previewParameterValues.toTypedArray()) + +private val previewParameterValues: List + get() = listOf( + OudsColorKeyToken.Surface.Brand.Primary, + OudsColorKeyToken.Surface.Status.Accent.Emphasized, + OudsColorKeyToken.Surface.Status.Accent.Muted, + OudsColorKeyToken.Surface.Status.Info.Emphasized, + OudsColorKeyToken.Surface.Status.Info.Muted, + OudsColorKeyToken.Surface.Status.Negative.Emphasized, + OudsColorKeyToken.Surface.Status.Negative.Muted, + OudsColorKeyToken.Surface.Status.Neutral.Emphasized, + OudsColorKeyToken.Surface.Status.Neutral.Muted, + OudsColorKeyToken.Surface.Status.Positive.Emphasized, + OudsColorKeyToken.Surface.Status.Positive.Muted, + OudsColorKeyToken.Surface.Status.Warning.Emphasized, + OudsColorKeyToken.Surface.Status.Warning.Muted, + ) diff --git a/core/src/main/java/com/orange/ouds/core/theme/OudsTheme.kt b/core/src/main/java/com/orange/ouds/core/theme/OudsTheme.kt index fea18327..3c59a974 100644 --- a/core/src/main/java/com/orange/ouds/core/theme/OudsTheme.kt +++ b/core/src/main/java/com/orange/ouds/core/theme/OudsTheme.kt @@ -21,6 +21,7 @@ import androidx.compose.runtime.ReadOnlyComposable import androidx.compose.runtime.compositionLocalOf import androidx.compose.runtime.staticCompositionLocalOf import com.orange.ouds.theme.OudsThemeContract +import com.orange.ouds.theme.tokens.OudsColorKeyToken import com.orange.ouds.theme.tokens.components.OudsComponentsTokens private fun missingCompositionLocalError(compositionLocalName: String): Nothing = @@ -40,6 +41,7 @@ private val LocalOpacities = staticCompositionLocalOf { missingCo private val LocalSizes = staticCompositionLocalOf { missingCompositionLocalError("LocalSizes") } private val LocalSpaces = staticCompositionLocalOf { missingCompositionLocalError("LocalSpaces") } private val LocalComponentsTokens = staticCompositionLocalOf { missingCompositionLocalError("LocalComponentsTokens") } +internal val LocalContrastedSurface = staticCompositionLocalOf { null } object OudsTheme { @@ -111,7 +113,6 @@ fun OudsTheme( darkThemeEnabled: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit ) { - val colorScheme = if (darkThemeEnabled) themeContract.colorTokens.darkColorScheme else themeContract.colorTokens.lightColorScheme val materialColorScheme = if (darkThemeEnabled) materialDarkColorScheme else materialLightColorScheme diff --git a/core/src/test/java/com/orange/ouds/core/component/contrastedsurface/OudsContrastedSurfaceTest.kt b/core/src/test/java/com/orange/ouds/core/component/contrastedsurface/OudsContrastedSurfaceTest.kt new file mode 100644 index 00000000..5d234a83 --- /dev/null +++ b/core/src/test/java/com/orange/ouds/core/component/contrastedsurface/OudsContrastedSurfaceTest.kt @@ -0,0 +1,54 @@ +/* + * Software Name: OUDS Android + * SPDX-FileCopyrightText: Copyright (c) Orange SA + * SPDX-License-Identifier: MIT + * + * This software is distributed under the MIT license, + * the text of which is available at https://opensource.org/license/MIT/ + * or see the "LICENSE" file for more details. + * + * Software description: Android library of reusable graphical components + */ + +package com.orange.ouds.core.component.contrastedsurface + +import app.cash.paparazzi.Paparazzi +import com.android.ide.common.rendering.api.SessionParams +import com.orange.ouds.theme.tokens.OudsColorKeyToken +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.Parameterized + +@RunWith(Parameterized::class) +internal class OudsContrastedSurfaceTest(private val parameter: OudsColorKeyToken.Surface) { + + companion object { + @JvmStatic + @Parameterized.Parameters + internal fun data() = OudsContrastedSurfacePreviewParameterProvider().values.toList() + } + + @get:Rule + val paparazzi = Paparazzi(renderingMode = SessionParams.RenderingMode.SHRINK, maxPercentDifference = 0.0) + + @Test + fun takeOudsContrastedSurfaceLightThemeSnapshot() { + paparazzi.snapshot { + PreviewOudsContrastedSurface( + darkThemeEnabled = false, + parameter = parameter + ) + } + } + + @Test + fun takeOudsContrastedSurfaceDarkThemeSnapshot() { + paparazzi.snapshot { + PreviewOudsContrastedSurface( + darkThemeEnabled = true, + parameter = parameter + ) + } + } +} diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[0].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[0].png new file mode 100644 index 00000000..add825e2 Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[0].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[10].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[10].png new file mode 100644 index 00000000..36f26d9c Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[10].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[11].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[11].png new file mode 100644 index 00000000..c1805b28 Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[11].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[12].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[12].png new file mode 100644 index 00000000..321d74c2 Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[12].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[1].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[1].png new file mode 100644 index 00000000..dc1b32aa Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[1].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[2].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[2].png new file mode 100644 index 00000000..6238d424 Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[2].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[3].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[3].png new file mode 100644 index 00000000..d336fe85 Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[3].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[4].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[4].png new file mode 100644 index 00000000..72228dc2 Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[4].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[5].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[5].png new file mode 100644 index 00000000..4b36c9c2 Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[5].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[6].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[6].png new file mode 100644 index 00000000..478a60a9 Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[6].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[7].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[7].png new file mode 100644 index 00000000..a834cf89 Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[7].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[8].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[8].png new file mode 100644 index 00000000..51e853ef Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[8].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[9].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[9].png new file mode 100644 index 00000000..a95b3dc1 Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceDarkThemeSnapshot[9].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[0].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[0].png new file mode 100644 index 00000000..add825e2 Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[0].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[10].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[10].png new file mode 100644 index 00000000..cb6ce09f Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[10].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[11].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[11].png new file mode 100644 index 00000000..e8d79e0a Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[11].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[12].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[12].png new file mode 100644 index 00000000..9a998ba5 Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[12].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[1].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[1].png new file mode 100644 index 00000000..a5c46a4b Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[1].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[2].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[2].png new file mode 100644 index 00000000..f6ce4d3a Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[2].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[3].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[3].png new file mode 100644 index 00000000..d370cb61 Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[3].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[4].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[4].png new file mode 100644 index 00000000..356b5e21 Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[4].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[5].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[5].png new file mode 100644 index 00000000..fe4fb4a2 Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[5].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[6].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[6].png new file mode 100644 index 00000000..6e1c452c Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[6].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[7].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[7].png new file mode 100644 index 00000000..7760eda4 Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[7].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[8].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[8].png new file mode 100644 index 00000000..b7bd3f61 Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[8].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[9].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[9].png new file mode 100644 index 00000000..d6a58447 Binary files /dev/null and b/core/src/test/snapshots/images/com.orange.ouds.core.component.contrastedsurface_OudsContrastedSurfaceTest_takeOudsContrastedSurfaceLightThemeSnapshot[9].png differ diff --git a/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsBorderKeyToken.kt b/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsBorderKeyToken.kt index 63899b9a..d7cdfa8b 100644 --- a/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsBorderKeyToken.kt +++ b/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsBorderKeyToken.kt @@ -12,7 +12,7 @@ package com.orange.ouds.theme.tokens -sealed interface OudsBorderKeyToken { +sealed interface OudsBorderKeyToken : OudsKeyToken { sealed interface Radius : OudsBorderKeyToken { data object Default : Radius data object Medium : Radius diff --git a/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsColorKeyToken.kt b/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsColorKeyToken.kt index 19482147..19acbd95 100644 --- a/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsColorKeyToken.kt +++ b/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsColorKeyToken.kt @@ -12,7 +12,7 @@ package com.orange.ouds.theme.tokens -sealed interface OudsColorKeyToken { +sealed interface OudsColorKeyToken : OudsKeyToken { sealed interface Opacity : OudsColorKeyToken { data object Lower : Opacity data object Lowest : Opacity diff --git a/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsElevationKeyToken.kt b/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsElevationKeyToken.kt index 403b8dd4..2ddcb1a6 100644 --- a/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsElevationKeyToken.kt +++ b/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsElevationKeyToken.kt @@ -12,7 +12,7 @@ package com.orange.ouds.theme.tokens -sealed interface OudsElevationKeyToken { +sealed interface OudsElevationKeyToken : OudsKeyToken { data object None : OudsElevationKeyToken data object Raised : OudsElevationKeyToken diff --git a/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsGridKeyToken.kt b/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsGridKeyToken.kt index d499d06d..a6e365f7 100644 --- a/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsGridKeyToken.kt +++ b/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsGridKeyToken.kt @@ -12,7 +12,7 @@ package com.orange.ouds.theme.tokens -sealed interface OudsGridKeyToken { +sealed interface OudsGridKeyToken : OudsKeyToken { data object ColumnGap : OudsGridKeyToken data object Margin : OudsGridKeyToken data object MaxWidth : OudsGridKeyToken diff --git a/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsKeyToken.kt b/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsKeyToken.kt new file mode 100644 index 00000000..5d7f4efb --- /dev/null +++ b/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsKeyToken.kt @@ -0,0 +1,22 @@ +/* + * Software Name: OUDS Android + * SPDX-FileCopyrightText: Copyright (c) Orange SA + * SPDX-License-Identifier: MIT + * + * This software is distributed under the MIT license, + * the text of which is available at https://opensource.org/license/MIT/ + * or see the "LICENSE" file for more details. + * + * Software description: Android library of reusable graphical components + */ + +package com.orange.ouds.theme.tokens + +sealed interface OudsKeyToken { + + val name: String + get() { + val packageName = this::class.java.`package`?.name.orEmpty() + return this::class.qualifiedName.orEmpty().removePrefix("$packageName.") + } +} diff --git a/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsOpacityKeyToken.kt b/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsOpacityKeyToken.kt index ef158204..b87f162c 100644 --- a/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsOpacityKeyToken.kt +++ b/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsOpacityKeyToken.kt @@ -12,7 +12,7 @@ package com.orange.ouds.theme.tokens -sealed interface OudsOpacityKeyToken { +sealed interface OudsOpacityKeyToken : OudsKeyToken { data object Invisible : OudsOpacityKeyToken data object Medium : OudsOpacityKeyToken data object Opaque : OudsOpacityKeyToken diff --git a/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsSizeKeyToken.kt b/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsSizeKeyToken.kt index 33950ef2..cdb2351c 100644 --- a/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsSizeKeyToken.kt +++ b/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsSizeKeyToken.kt @@ -12,7 +12,7 @@ package com.orange.ouds.theme.tokens -sealed interface OudsSizeKeyToken { +sealed interface OudsSizeKeyToken : OudsKeyToken { sealed interface Icon : OudsSizeKeyToken { sealed interface Decorative : Icon { data object ExtraExtraLarge : Decorative diff --git a/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsSpaceKeyToken.kt b/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsSpaceKeyToken.kt index 3e956455..4d1f564d 100644 --- a/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsSpaceKeyToken.kt +++ b/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsSpaceKeyToken.kt @@ -12,7 +12,7 @@ package com.orange.ouds.theme.tokens -sealed interface OudsSpaceKeyToken { +sealed interface OudsSpaceKeyToken : OudsKeyToken { sealed interface ColumnGap : OudsSpaceKeyToken { data object Medium : ColumnGap data object None : ColumnGap diff --git a/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsTypographyKeyToken.kt b/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsTypographyKeyToken.kt index 1ffbcdf1..b3ebe6e0 100644 --- a/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsTypographyKeyToken.kt +++ b/theme-contract/src/main/java/com/orange/ouds/theme/tokens/OudsTypographyKeyToken.kt @@ -12,7 +12,7 @@ package com.orange.ouds.theme.tokens -sealed interface OudsTypographyKeyToken { +sealed interface OudsTypographyKeyToken : OudsKeyToken { sealed interface Display : OudsTypographyKeyToken { data object Large : Display