Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,22 @@ app/src/main/res/drawable-xxxhdpi/il_tokens_grid_min_width_dark.png
app/src/prod/res/drawable/ic_launcher_background.xml
app/src/prod/res/drawable/ic_launcher_foreground.xml

core/src/main/res/drawable/checkbox_indeterminate.xml
core/src/main/res/drawable/checkbox_selected.xml
core/src/main/res/drawable/chevron_left.xml
core/src/main/res/drawable/chip_tick.xml
core/src/main/res/drawable/radiobutton_selected.xml
core/src/main/res/drawable/switch_selected.xml

docs/assets/banner.png
docs/assets/logo-icon.svg

theme-contract/src/main/res/drawable/ic_checkbox_indeterminate.xml
theme-contract/src/main/res/drawable/ic_checkbox_selected.xml
theme-contract/src/main/res/drawable/ic_chevron_left.xml
theme-contract/src/main/res/drawable/ic_tick.xml
theme-contract/src/main/res/drawable/ic_radio_button_selected.xml
theme-contract/src/main/res/drawable/ic_switch_selected.xml

theme-sosh/src/main/res/drawable/sosh_checkbox_indeterminate.xml
theme-sosh/src/main/res/drawable/sosh_checkbox_selected.xml
theme-sosh/src/main/res/drawable/sosh_chevron_left.xml
theme-sosh/src/main/res/drawable/sosh_tick.xml
theme-sosh/src/main/res/drawable/sosh_radio_button_selected.xml
theme-sosh/src/main/res/drawable/sosh_switch_selected.xml
theme-sosh/src/main/res/font/sosh_black.ttf
theme-sosh/src/main/res/font/sosh_bold.ttf
theme-sosh/src/main/res/font/sosh_medium.ttf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ import com.orange.ouds.core.utilities.getPreviewEnumEntry
import com.orange.ouds.foundation.extensions.ifNotNull
import com.orange.ouds.foundation.extensions.orElse
import com.orange.ouds.foundation.utilities.BasicPreviewParameterProvider
import com.orange.ouds.theme.tokens.components.OudsButtonTokens
import kotlinx.parcelize.Parcelize

/**
Expand All @@ -84,7 +83,7 @@ import kotlinx.parcelize.Parcelize
* Other layouts are available for this component: *text + icon* and *icon only*.
*
* Note that in the case it is placed in an [OudsColoredBox], its monochrome variant is automatically displayed.
* Some tokens associated with these specific colors can be customized and are identified with the `Mono` suffix (for instance [OudsButtonTokens.colorBgDefaultEnabledMono]).
* The tokens associated with these specific colors can be customized by overriding [OudsButtonMonoTokens].
*
* @param label Label displayed in the button which describes the button action. Use action verbs or phrases to tell the user what will happen next.
* @param onClick Callback invoked when the button is clicked.
Expand Down Expand Up @@ -134,7 +133,7 @@ fun OudsButton(
* Other layouts are available for this component: *text only* and *text + icon*.
*
* Note that in the case it is placed in an [OudsColoredBox], its monochrome variant is automatically displayed.
* Some tokens associated with these specific colors can be customized and are identified with the `Mono` suffix (for instance [OudsButtonTokens.colorBgDefaultEnabledMono]).
* The tokens associated with these specific colors can be customized by overriding [OudsButtonMonoTokens].
*
* @param icon Icon displayed in the button. Use an icon to add additional affordance where the icon has a clear and well-established meaning.
* @param onClick Callback invoked when the button is clicked.
Expand Down Expand Up @@ -185,7 +184,7 @@ fun OudsButton(
* Other layouts are available for this component: *text only* and *icon only*.
*
* Note that in the case it is placed in an [OudsColoredBox], its monochrome variant is automatically displayed.
* Some tokens associated with these specific colors can be customized and are identified with the `Mono` suffix (for instance [OudsButtonTokens.colorBgDefaultEnabledMono]).
* The tokens associated with these specific colors can be customized by overriding [OudsButtonMonoTokens].
*
* @param icon Icon displayed in the button. Use an icon to add additional affordance where the icon has a clear and well-established meaning.
* @param label Label displayed in the button which describes the button action. Use action verbs or phrases to tell the user what will happen next.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import androidx.compose.ui.state.ToggleableState
import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.Dp
import com.orange.ouds.core.R
import com.orange.ouds.core.component.common.outerBorder
import com.orange.ouds.core.extensions.collectInteractionStateAsState
import com.orange.ouds.core.theme.LocalHighContrastModeEnabled
Expand Down Expand Up @@ -188,9 +187,9 @@ internal fun OudsCheckboxIndicator(
.indicatorBorder(state = state, selected = selected, error = error, shape = shape)
) {
val indicatorResource = when (value) {
ToggleableState.On -> R.drawable.checkbox_selected
ToggleableState.On -> OudsTheme.drawableResources.checkboxSelected
ToggleableState.Off -> null
ToggleableState.Indeterminate -> R.drawable.checkbox_indeterminate
ToggleableState.Indeterminate -> OudsTheme.drawableResources.checkboxIndeterminate
}

indicatorResource?.let { resource ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.orange.ouds.core.R
import com.orange.ouds.core.component.common.outerBorder
import com.orange.ouds.core.component.content.OudsComponentContent
import com.orange.ouds.core.component.content.OudsComponentIcon
Expand Down Expand Up @@ -140,7 +139,7 @@ internal fun OudsChip(
if (selected) {
tickColor.value?.let { tickColor ->
Icon(
painter = painterResource(id = R.drawable.chip_tick),
painter = painterResource(id = OudsTheme.drawableResources.tick),
tint = tickColor,
contentDescription = null
)
Expand Down
10 changes: 4 additions & 6 deletions core/src/main/java/com/orange/ouds/core/component/OudsLink.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.orange.ouds.core.R
import com.orange.ouds.core.component.OudsLink.Icon.ExtraParameters
import com.orange.ouds.core.component.common.outerBorder
import com.orange.ouds.core.component.content.OudsComponentContent
Expand All @@ -62,7 +61,6 @@ import com.orange.ouds.core.utilities.PreviewEnumEntries
import com.orange.ouds.core.utilities.getPreviewEnumEntry
import com.orange.ouds.foundation.extensions.orElse
import com.orange.ouds.foundation.utilities.BasicPreviewParameterProvider
import com.orange.ouds.theme.tokens.components.OudsLinkTokens

/**
* <a href="https://unified-design-system.orange.com/472794e18/p/31c33b-link" class="external" target="_blank">**OUDS Link design guidelines**</a>
Expand All @@ -73,7 +71,7 @@ import com.orange.ouds.theme.tokens.components.OudsLinkTokens
* If you need a navigation link, you can use the other API available for this component which display a text with a *back* or *next* chevron.
*
* Note that in the case it is placed in an [OudsColoredBox], its monochrome variant is automatically displayed.
* Some tokens associated with these specific colors can be customized and are identified with the `Mono` suffix (for instance [OudsLinkTokens.colorContentEnabledMono]).
* The tokens associated with this variant can be customized by overriding [OudsLinkMonoTokens].
*
* @sample com.orange.ouds.core.component.samples.OudsLinkSample
*
Expand Down Expand Up @@ -110,7 +108,7 @@ fun OudsLink(
* An OUDS link which displays an [arrow] before ([OudsLink.Arrow.Back]) or after ([OudsLink.Arrow.Next]) a label.
*
* In the case it is used in an [OudsColoredBox], its monochrome variant is automatically displayed.
* The tokens associated with this variant can be customized and are identified with the `Mono` suffix (for instance [OudsLinkTokens.colorContentEnabledMono]).
* The tokens associated with this variant can be customized by overriding [OudsLinkMonoTokens].
*
* @sample com.orange.ouds.core.component.samples.OudsLinkWithArrowSample
*
Expand Down Expand Up @@ -233,7 +231,7 @@ private fun OudsLink(
verticalAlignment = Alignment.CenterVertically
) {
if (icon != null || arrow == OudsLink.Arrow.Back) {
icon.orElse { OudsLink.Icon(painterResource(R.drawable.chevron_left)) }.Content(
icon.orElse { OudsLink.Icon(painterResource(OudsTheme.drawableResources.chevronLeft)) }.Content(
modifier = Modifier.size(iconSize),
extraParameters = ExtraParameters(tint = iconTint)
)
Expand All @@ -245,7 +243,7 @@ private fun OudsLink(
style = textStyle
)
if (arrow == OudsLink.Arrow.Next) {
OudsLink.Icon(painterResource(R.drawable.chevron_left)).Content(
OudsLink.Icon(painterResource(OudsTheme.drawableResources.chevronLeft)).Content(
modifier = Modifier
.size(iconSize)
.rotate(180f)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import androidx.compose.ui.semantics.Role
import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.Dp
import com.orange.ouds.core.R
import com.orange.ouds.core.component.common.outerBorder
import com.orange.ouds.core.extensions.collectInteractionStateAsState
import com.orange.ouds.core.theme.LocalHighContrastModeEnabled
Expand Down Expand Up @@ -128,7 +127,7 @@ internal fun OudsRadioButtonIndicator(state: OudsControl.State, selected: Boolea
if (selected) {
Icon(
modifier = Modifier.fillMaxSize(),
painter = painterResource(R.drawable.radiobutton_selected),
painter = painterResource(OudsTheme.drawableResources.radioButtonSelected),
tint = indicatorColor(state = state, selected = true, error = error),
contentDescription = null
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import androidx.compose.ui.semantics.Role
import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import com.orange.ouds.core.R
import com.orange.ouds.core.component.common.outerBorder
import com.orange.ouds.core.extensions.collectInteractionStateAsState
import com.orange.ouds.core.theme.OudsTheme
Expand Down Expand Up @@ -161,7 +160,7 @@ internal fun OudsSwitchIndicator(state: OudsControl.State, checked: Boolean, mod
modifier = Modifier
.alpha(switchTokens.opacityCheck.value)
.alpha(checkAlpha),
painter = painterResource(id = R.drawable.switch_selected),
painter = painterResource(id = OudsTheme.drawableResources.switchSelected),
contentDescription = null,
tint = checkColor
)
Expand Down
8 changes: 8 additions & 0 deletions core/src/main/java/com/orange/ouds/core/theme/OudsTheme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.compose.runtime.compositionLocalOf
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.platform.LocalContext
import com.orange.ouds.core.extensions.isHighContrastModeEnabled
import com.orange.ouds.theme.OudsDrawableResources
import com.orange.ouds.theme.OudsThemeContract
import com.orange.ouds.theme.tokens.components.OudsComponentsTokens

Expand All @@ -44,6 +45,7 @@ internal val LocalSizes = staticCompositionLocalOf<OudsSizes> { missingCompositi
internal val LocalSpaces = staticCompositionLocalOf<OudsSpaces> { missingCompositionLocalError("LocalSpaces") }
internal val LocalComponentsTokens = staticCompositionLocalOf<OudsComponentsTokens> { missingCompositionLocalError("LocalComponentsTokens") }
internal val LocalColorMode = staticCompositionLocalOf<OudsColorMode?> { null }
internal val LocalDrawableResources = staticCompositionLocalOf<OudsDrawableResources> { missingCompositionLocalError("LocalDrawableResources") }

/**
* Object that stores tokens values for the current theme.
Expand Down Expand Up @@ -103,6 +105,11 @@ object OudsTheme {
@Composable
@ReadOnlyComposable
get() = LocalComponentsTokens.current

internal val drawableResources: OudsDrawableResources
@Composable
@ReadOnlyComposable
get() = LocalDrawableResources.current
}

/**
Expand Down Expand Up @@ -141,6 +148,7 @@ fun OudsTheme(
LocalSizes provides sizeTokens.getSizes(windowWidthSizeClass),
LocalSpaces provides spaceTokens.getSpaces(windowWidthSizeClass),
LocalComponentsTokens provides componentsTokens,
LocalDrawableResources provides drawableResources
) {
MaterialTheme(
colorScheme = materialColorScheme,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* 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

import androidx.annotation.DrawableRes
import com.orange.ouds.foundation.InternalOudsApi

@InternalOudsApi
open class OudsDrawableResources {
open val checkboxIndeterminate: Int
@DrawableRes get() = R.drawable.ic_checkbox_indeterminate
open val checkboxSelected: Int
@DrawableRes get() = R.drawable.ic_checkbox_selected
open val chevronLeft: Int
@DrawableRes get() = R.drawable.ic_chevron_left
open val radioButtonSelected: Int
@DrawableRes get() = R.drawable.ic_radio_button_selected
open val switchSelected: Int
@DrawableRes get() = R.drawable.ic_switch_selected
open val tick: Int
@DrawableRes get() = R.drawable.ic_tick
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,19 @@ interface OudsThemeContract : Parcelable {
val spaceTokens: OudsSpaceSemanticTokens

/**
* Customization of the OUDS components if needed
* Allows customization of OUDS components.
*/
val componentsTokens: OudsComponentsTokens
get() = OudsComponentsTokens()

/**
* Allows customization of drawable resources used by OUDS components.
* OUDS includes a set of default drawable resources. You can replace these with your own drawable resources by overriding this property in your theme.
*
* Caution:
* To avoid resource conflicts, Android recommends using a prefix or other consistent naming scheme that is unique to the module (or is unique across all project modules).
* So, we strongly recommend that you prefix your resources with the name of your theme. For example, if your theme is called "LoremIpsum" you might name your resources as lorem_ipsum_checkbox_selected, lorem_ipsum_tick, etc.
*/
val drawableResources: OudsDrawableResources
get() = OudsDrawableResources()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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.sosh

import com.orange.ouds.theme.OudsDrawableResources

class SoshDrawableResources : OudsDrawableResources() {
override val checkboxIndeterminate
get() = R.drawable.sosh_checkbox_indeterminate
override val checkboxSelected: Int
get() = R.drawable.sosh_checkbox_selected
override val chevronLeft: Int
get() = R.drawable.sosh_chevron_left
override val tick: Int
get() = R.drawable.sosh_tick
override val radioButtonSelected: Int
get() = R.drawable.sosh_radio_button_selected
override val switchSelected: Int
get() = R.drawable.sosh_switch_selected
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package com.orange.ouds.theme.sosh
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import com.orange.ouds.theme.OudsDrawableResources
import com.orange.ouds.theme.OudsThemeContract
import com.orange.ouds.theme.sosh.tokens.material.SoshMaterialColorTokens
import com.orange.ouds.theme.sosh.tokens.semantic.SoshBorderSemanticTokens
Expand Down Expand Up @@ -79,4 +80,7 @@ class SoshTheme : OudsThemeContract {

override val spaceTokens: OudsSpaceSemanticTokens
get() = SoshSpaceSemanticTokens()

override val drawableResources: OudsDrawableResources
get() = SoshDrawableResources()
}
14 changes: 14 additions & 0 deletions theme-sosh/src/main/res/drawable/sosh_checkbox_indeterminate.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="64"
android:viewportHeight="64">
<group>
<clip-path
android:pathData="M0,0.008h64v64h-64z"/>
<path
android:pathData="M54.4,0.008C59.702,0.008 64,4.306 64,9.608V54.408C64,59.71 59.702,64.008 54.4,64.008H9.6C4.298,64.008 0,59.71 0,54.408V9.608C0,4.306 4.298,0.008 9.6,0.008H54.4ZM48,28.808H16C14.233,28.808 12.8,30.24 12.8,32.008C12.8,33.775 14.233,35.208 16,35.208H48C49.767,35.208 51.2,33.775 51.2,32.008C51.2,30.24 49.767,28.808 48,28.808Z"
android:fillColor="#000000"
android:fillType="evenOdd"/>
</group>
</vector>
14 changes: 14 additions & 0 deletions theme-sosh/src/main/res/drawable/sosh_checkbox_selected.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="64"
android:viewportHeight="64">
<group>
<clip-path
android:pathData="M0,0h64v64h-64z"/>
<path
android:pathData="M54.4,0C59.702,0 64,4.298 64,9.6V54.4C64,59.702 59.702,64 54.4,64H9.6C4.298,64 0,59.702 0,54.4V9.6C0,4.298 4.298,0 9.6,0H54.4ZM45.939,16.92L25.577,39.48L17.998,31.094C17.023,30.055 14.983,29.663 13.695,31.118C12.418,32.568 12.621,34.901 13.593,35.934L23.413,46.824C23.902,47.344 24.978,48 25.618,48C26.258,48 27.197,47.435 27.686,46.915L50.404,21.794C51.376,20.757 51.59,18.357 50.292,16.944C48.973,15.507 46.914,15.884 45.939,16.92Z"
android:fillColor="#000000"
android:fillType="evenOdd"/>
</group>
</vector>
10 changes: 10 additions & 0 deletions theme-sosh/src/main/res/drawable/sosh_chevron_left.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="64"
android:viewportHeight="64">
<path
android:pathData="M42.381,44.858C42.341,44.818 42.431,44.898 42.381,44.858L27.581,31.778L42.381,18.948C44.03,17.308 43.731,15.248 42.381,13.848C42.341,13.798 42.431,13.888 42.381,13.848C40.871,12.418 38.521,12.498 36.951,13.868L19.061,29.368C17.591,30.648 17.711,32.798 19.061,34.188C19.131,34.248 36.951,49.878 36.951,49.878C38.861,51.788 41.071,51.408 42.381,50.128C43.691,48.848 44.121,46.558 42.381,44.858Z"
android:fillColor="#000000"
android:fillType="evenOdd"/>
</vector>
14 changes: 14 additions & 0 deletions theme-sosh/src/main/res/drawable/sosh_radio_button_selected.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="64dp"
android:viewportWidth="64"
android:viewportHeight="64">
<group>
<clip-path
android:pathData="M0.002,-0.008h64v64h-64z"/>
<path
android:pathData="M32.002,-0.008C49.602,-0.008 64.002,14.392 64.002,31.992C64.002,49.592 49.602,63.992 32.002,63.992C14.402,63.992 0.002,49.592 0.002,31.992C0.002,14.392 14.402,-0.008 32.002,-0.008ZM32.002,19.192C24.834,19.192 19.202,24.824 19.202,31.992C19.202,39.16 24.834,44.792 32.002,44.792C39.17,44.792 44.802,39.16 44.802,31.992C44.802,24.824 39.17,19.192 32.002,19.192Z"
android:fillColor="#000000"
android:fillType="evenOdd"/>
</group>
</vector>
Loading
Loading