diff --git a/core/src/main/java/com/orange/ouds/core/component/button/OudsButton.kt b/core/src/main/java/com/orange/ouds/core/component/button/OudsButton.kt index 780c59c5..949ac34d 100644 --- a/core/src/main/java/com/orange/ouds/core/component/button/OudsButton.kt +++ b/core/src/main/java/com/orange/ouds/core/component/button/OudsButton.kt @@ -199,6 +199,7 @@ private fun OudsButton( .widthIn(min = buttonTokens.sizeMinWidth.dp) .heightIn(min = buttonTokens.sizeMinHeight.dp, max = maxHeight) .border(hierarchy = hierarchy, state = state, shape = shape) + .outerBorder(state = state, shape = shape) .semantics { this.stateDescription = stateDescription }, @@ -272,17 +273,22 @@ private fun Modifier.border(hierarchy: OudsButton.Hierarchy, state: OudsButton.S val borderColor = borderColor(hierarchy = hierarchy, state = state) return if (borderWidth != null && borderColor != null) { - if (state != OudsButton.State.Focused) { - border(width = borderWidth, color = borderColor, shape = shape) - } else { - outerBorder( - width = borderWidth, - color = borderColor, - shape = shape, - insetWidth = OudsBorderKeyToken.Width.Focus.Inset.value, - insetColor = OudsColorKeyToken.Border.Focus.Inset.value - ) - } + border(width = borderWidth, color = borderColor, shape = shape) + } else { + this + } +} + +@Composable +private fun Modifier.outerBorder(state: OudsButton.State, shape: Shape): Modifier { + return if (state == OudsButton.State.Focused) { + outerBorder( + width = OudsBorderKeyToken.Width.Focus.value, + color = OudsColorKeyToken.Border.Focus.value, + shape = shape, + insetWidth = OudsBorderKeyToken.Width.Focus.Inset.value, + insetColor = OudsColorKeyToken.Border.Focus.Inset.value + ) } else { this } @@ -298,7 +304,7 @@ private fun borderWidth(hierarchy: OudsButton.Hierarchy, state: OudsButton.State OudsButton.State.Hovered, OudsButton.State.Pressed, OudsButton.State.Loading -> borderWidthDefaultInteraction - OudsButton.State.Focused -> OudsBorderKeyToken.Width.Focus + OudsButton.State.Focused -> OudsBorderKeyToken.Width.Focus.Inset OudsButton.State.Skeleton -> null } OudsButton.Hierarchy.Minimal -> when (state) { @@ -307,11 +313,11 @@ private fun borderWidth(hierarchy: OudsButton.Hierarchy, state: OudsButton.State OudsButton.State.Hovered, OudsButton.State.Pressed, OudsButton.State.Loading -> borderWidthMinimalInteraction - OudsButton.State.Focused -> OudsBorderKeyToken.Width.Focus + OudsButton.State.Focused -> OudsBorderKeyToken.Width.Focus.Inset OudsButton.State.Skeleton -> null } OudsButton.Hierarchy.Strong, - OudsButton.Hierarchy.Negative -> if (state == OudsButton.State.Focused) OudsBorderKeyToken.Width.Focus else null + OudsButton.Hierarchy.Negative -> if (state == OudsButton.State.Focused) OudsBorderKeyToken.Width.Focus.Inset else null }?.value } } @@ -326,7 +332,7 @@ private fun borderColor(hierarchy: OudsButton.Hierarchy, state: OudsButton.State OudsButton.State.Pressed -> colorBorderDefaultPressed OudsButton.State.Loading -> colorBorderDefaultLoading OudsButton.State.Disabled -> colorBorderDefaultDisabled - OudsButton.State.Focused -> OudsColorKeyToken.Border.Focus + OudsButton.State.Focused -> colorBorderDefaultFocus OudsButton.State.Skeleton -> null } OudsButton.Hierarchy.Minimal -> when (state) { @@ -335,11 +341,11 @@ private fun borderColor(hierarchy: OudsButton.Hierarchy, state: OudsButton.State OudsButton.State.Pressed -> colorBorderMinimalPressed OudsButton.State.Loading -> colorBorderMinimalLoading OudsButton.State.Disabled -> colorBorderMinimalDisabled - OudsButton.State.Focused -> OudsColorKeyToken.Border.Focus + OudsButton.State.Focused -> colorBorderMinimalFocus OudsButton.State.Skeleton -> null } OudsButton.Hierarchy.Strong, - OudsButton.Hierarchy.Negative -> if (state == OudsButton.State.Focused) OudsColorKeyToken.Border.Focus else null + OudsButton.Hierarchy.Negative -> null }?.value } } diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonDarkThemeSnapshot[0].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonDarkThemeSnapshot[0].png index 0aebaa90..7c603dab 100644 Binary files a/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonDarkThemeSnapshot[0].png and b/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonDarkThemeSnapshot[0].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonDarkThemeSnapshot[1].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonDarkThemeSnapshot[1].png index 27cfbeb9..d5c78b89 100644 Binary files a/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonDarkThemeSnapshot[1].png and b/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonDarkThemeSnapshot[1].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonDarkThemeSnapshot[2].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonDarkThemeSnapshot[2].png index ed89b093..360130f4 100644 Binary files a/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonDarkThemeSnapshot[2].png and b/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonDarkThemeSnapshot[2].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonLightThemeSnapshot[0].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonLightThemeSnapshot[0].png index 1b7c1ffa..1809bd36 100644 Binary files a/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonLightThemeSnapshot[0].png and b/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonLightThemeSnapshot[0].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonLightThemeSnapshot[1].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonLightThemeSnapshot[1].png index e4a55b37..ebac1257 100644 Binary files a/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonLightThemeSnapshot[1].png and b/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonLightThemeSnapshot[1].png differ diff --git a/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonLightThemeSnapshot[2].png b/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonLightThemeSnapshot[2].png index ba4360ff..24293661 100644 Binary files a/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonLightThemeSnapshot[2].png and b/core/src/test/snapshots/images/com.orange.ouds.core.component.button_OudsButtonTest_takeOudsButtonLightThemeSnapshot[2].png differ diff --git a/theme-contract/src/main/java/com/orange/ouds/theme/tokens/components/OudsButtonTokens.kt b/theme-contract/src/main/java/com/orange/ouds/theme/tokens/components/OudsButtonTokens.kt index c8a9f6c6..ad6421d4 100644 --- a/theme-contract/src/main/java/com/orange/ouds/theme/tokens/components/OudsButtonTokens.kt +++ b/theme-contract/src/main/java/com/orange/ouds/theme/tokens/components/OudsButtonTokens.kt @@ -69,9 +69,11 @@ open class OudsButtonTokens( val colorBorderDefaultPressed: OudsColorKeyToken = OudsColorKeyToken.Action.Primary.Pressed, val colorBorderDefaultDisabled: OudsColorKeyToken = OudsColorKeyToken.Action.Disabled, val colorBorderDefaultLoading: OudsColorKeyToken = OudsColorKeyToken.Action.Primary.Loading, + val colorBorderDefaultFocus: OudsColorKeyToken = OudsColorKeyToken.Action.Primary.Focus, val colorBorderMinimalEnabled: OudsColorKeyToken = OudsColorKeyToken.Transparent.Default, val colorBorderMinimalHover: OudsColorKeyToken = OudsColorKeyToken.Transparent.Default, val colorBorderMinimalPressed: OudsColorKeyToken = OudsColorKeyToken.Transparent.Default, val colorBorderMinimalDisabled: OudsColorKeyToken = OudsColorKeyToken.Transparent.Default, val colorBorderMinimalLoading: OudsColorKeyToken = OudsColorKeyToken.Transparent.Default, + val colorBorderMinimalFocus: OudsColorKeyToken = OudsColorKeyToken.Transparent.Default, ) \ No newline at end of file