diff --git a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/AreaBox.kt b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/AreaBox.kt index 10147f7..eca2be0 100644 --- a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/AreaBox.kt +++ b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/AreaBox.kt @@ -170,6 +170,16 @@ internal val LocalAreaBoxShape = compositionLocalOf { DefaultAreaBoxShape } internal val DefaultAreaBoxShape: Shape = DefaultShapes.primary +@Composable +@ReadOnlyComposable +internal fun withAreaBoxShape( + inBox: Shape = LocalAreaBoxShape.current, + outBox: Shape = LocalShapes.current.secondary +) = when (LocalInAreaBox.current) { + true -> inBox + else -> outBox +} + @Composable @ReadOnlyComposable private fun defaultAreaBoxStyle() = AreaBoxStyle( diff --git a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/Button.kt b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/Button.kt index 02a9025..93c17de 100644 --- a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/Button.kt +++ b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/Button.kt @@ -249,10 +249,7 @@ private fun defaultButtonStyle() = ButtonStyle( horizontal = LocalSizes.current.spacingPrimary, vertical = LocalSizes.current.spacingSecondary ), - shape = when (LocalInAreaBox.current) { - true -> LocalAreaBoxShape.current - else -> LocalShapes.current.secondary - }, + shape = withAreaBoxShape(), border = defaultButtonBorder() ) diff --git a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/Dropdown.kt b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/Dropdown.kt index e05d933..ca72887 100644 --- a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/Dropdown.kt +++ b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/Dropdown.kt @@ -567,10 +567,7 @@ private fun defaultDropdownMenuColors() = DropdownMenuColors( @ReadOnlyComposable private fun defaultDropdownListStyle() = DropdownListStyle( padding = PaddingValues(LocalSizes.current.spacingSecondary), - shape = when (LocalInAreaBox.current) { - true -> LocalAreaBoxShape.current - else -> LocalShapes.current.secondary - }, + shape = withAreaBoxShape(), endIconSize = LocalSizes.current.iconSizeTertiary, borderInactive = defaultDropdownListInactiveBorder(), borderActive = defaultDropdownListActiveBorder() diff --git a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/Tab.kt b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/Tab.kt index 7a127d9..af15894 100644 --- a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/Tab.kt +++ b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/Tab.kt @@ -442,10 +442,7 @@ private fun defaultTabStyle() = TabStyle( horizontal = LocalSizes.current.spacingPrimary, vertical = LocalSizes.current.spacingSecondary, ), - contentShape = when (LocalInAreaBox.current) { - true -> LocalAreaBoxShape.current - else -> LocalShapes.current.secondary - }, + contentShape = withAreaBoxShape(), indicatorWidth = Dp.Unspecified, indicatorHeight = DefaultTabIndicatorHeight, indicatorShape = LocalShapes.current.tertiary diff --git a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/TextField.kt b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/TextField.kt index f53274f..e415538 100644 --- a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/TextField.kt +++ b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/TextField.kt @@ -87,7 +87,6 @@ import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.compose.ui.window.PopupProperties import com.highcapable.flexiui.LocalColors -import com.highcapable.flexiui.LocalShapes import com.highcapable.flexiui.LocalSizes import com.highcapable.flexiui.extension.borderOrNot import com.highcapable.flexiui.extension.calculateEnd @@ -788,10 +787,7 @@ private fun defaultTextFieldColors() = TextFieldColors( @ReadOnlyComposable private fun defaultTextFieldStyle() = TextFieldStyle( padding = PaddingValues(LocalSizes.current.spacingSecondary), - shape = when (LocalInAreaBox.current) { - true -> LocalAreaBoxShape.current - else -> LocalShapes.current.secondary - }, + shape = withAreaBoxShape(), borderInactive = defaultTextFieldInactiveBorder(), borderActive = defaultTextFieldActiveBorder(), completionStyle = DropdownMenu.style