diff --git a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt index ce27c2f813..2db073b6c4 100644 --- a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt +++ b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt @@ -163,6 +163,7 @@ internal fun createBridgeComponentStyling( val textFieldStyle = readTextFieldStyle(textFieldTextStyle) val menuStyle = readMenuStyle() + val defaultTabStyle = readDefaultTabStyle() return DefaultComponentStyling( checkboxStyle = readCheckboxStyle(), @@ -170,7 +171,8 @@ internal fun createBridgeComponentStyling( circularProgressStyle = readCircularProgressStyle(theme.isDark), defaultButtonStyle = readDefaultButtonStyle(), defaultDropdownStyle = readDefaultDropdownStyle(menuStyle, dropdownTextStyle), - defaultTabStyle = readDefaultTabStyle(), + toolWindowTabStyle = readDefaultTabStyle(), + customTabStyle = defaultTabStyle, dividerStyle = readDividerStyle(), editorTabStyle = readEditorTabStyle(), groupHeaderStyle = readGroupHeaderStyle(), diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/theme/IntUiTheme.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/theme/IntUiTheme.kt index 4fcecd1359..813523624f 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/theme/IntUiTheme.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/theme/IntUiTheme.kt @@ -116,7 +116,8 @@ public fun ComponentStyling.dark( circularProgressStyle = circularProgressStyle, defaultButtonStyle = defaultButtonStyle, defaultDropdownStyle = dropdownStyle, - defaultTabStyle = defaultTabStyle, + toolWindowTabStyle = defaultTabStyle, + customTabStyle = defaultTabStyle, dividerStyle = dividerStyle, editorTabStyle = editorTabStyle, groupHeaderStyle = groupHeaderStyle, @@ -168,7 +169,8 @@ public fun ComponentStyling.light( circularProgressStyle = circularProgressStyle, defaultButtonStyle = defaultButtonStyle, defaultDropdownStyle = dropdownStyle, - defaultTabStyle = defaultTabStyle, + toolWindowTabStyle = defaultTabStyle, + customTabStyle = defaultTabStyle, dividerStyle = dividerStyle, editorTabStyle = editorTabStyle, groupHeaderStyle = groupHeaderStyle, diff --git a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Tabs.kt b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Tabs.kt index 141cf0dbc8..73784ba632 100644 --- a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Tabs.kt +++ b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Tabs.kt @@ -2,11 +2,16 @@ package org.jetbrains.jewel.samples.standalone.view.component +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.CircleShape import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -54,12 +59,46 @@ fun CustomTabShowcase() { TabData.Custom( selected = index == selectedTabIndex, content = { - val textColor = when { - it.isHovered -> Color.Red - else -> Color.Unspecified + Row( + horizontalArrangement = Arrangement.spacedBy(2.dp), + verticalAlignment = Alignment.CenterVertically + ) { + val textColor = when { + it.isHovered -> Color.Red + else -> Color.Unspecified + + } + Text(text = "Custom tab $id") + Text(text = "($id)", color = textColor) + Box( + contentAlignment = Alignment.Center, + modifier = Modifier + .size(24.dp) + .background(color = Color.Yellow, shape = CircleShape) + .padding(2.dp) + ) { + Text(text = 'C'.toString()) + } + Box( + contentAlignment = Alignment.Center, + modifier = Modifier + .size(24.dp) + .background(color = Color.Green, shape = CircleShape) + .padding(2.dp) + ) { + Text(text = 'W'.toString()) + } + Box( + contentAlignment = Alignment.Center, + modifier = Modifier + .size(24.dp) + .background(color = Color.Magenta, shape = CircleShape) + .padding(2.dp) + ) { + Text(text = 'M'.toString()) + } } - Text(text = "Custom tab $id", color = textColor) }, onClose = { diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/DefaultComponentStyling.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/DefaultComponentStyling.kt index 55adc5e05c..8cafe15e0e 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/DefaultComponentStyling.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/DefaultComponentStyling.kt @@ -20,9 +20,9 @@ import org.jetbrains.jewel.ui.component.styling.LinkStyle import org.jetbrains.jewel.ui.component.styling.LocalCheckboxStyle import org.jetbrains.jewel.ui.component.styling.LocalChipStyle import org.jetbrains.jewel.ui.component.styling.LocalCircularProgressStyle +import org.jetbrains.jewel.ui.component.styling.LocalCustomTabStyle import org.jetbrains.jewel.ui.component.styling.LocalDefaultButtonStyle import org.jetbrains.jewel.ui.component.styling.LocalDefaultDropdownStyle -import org.jetbrains.jewel.ui.component.styling.LocalDefaultTabStyle import org.jetbrains.jewel.ui.component.styling.LocalDividerStyle import org.jetbrains.jewel.ui.component.styling.LocalEditorTabStyle import org.jetbrains.jewel.ui.component.styling.LocalGroupHeaderStyle @@ -37,6 +37,7 @@ import org.jetbrains.jewel.ui.component.styling.LocalScrollbarStyle import org.jetbrains.jewel.ui.component.styling.LocalSliderStyle import org.jetbrains.jewel.ui.component.styling.LocalTextAreaStyle import org.jetbrains.jewel.ui.component.styling.LocalTextFieldStyle +import org.jetbrains.jewel.ui.component.styling.LocalToolWindowTabStyle import org.jetbrains.jewel.ui.component.styling.LocalTooltipStyle import org.jetbrains.jewel.ui.component.styling.LocalUndecoratedDropdownStyle import org.jetbrains.jewel.ui.component.styling.MenuStyle @@ -56,9 +57,10 @@ public class DefaultComponentStyling( public val circularProgressStyle: CircularProgressStyle, public val defaultButtonStyle: ButtonStyle, public val defaultDropdownStyle: DropdownStyle, - public val defaultTabStyle: TabStyle, - public val dividerStyle: DividerStyle, + public val toolWindowTabStyle: TabStyle, public val editorTabStyle: TabStyle, + public val customTabStyle: TabStyle, + public val dividerStyle: DividerStyle, public val groupHeaderStyle: GroupHeaderStyle, public val horizontalProgressBarStyle: HorizontalProgressBarStyle, public val iconButtonStyle: IconButtonStyle, @@ -84,7 +86,8 @@ public class DefaultComponentStyling( LocalContextMenuRepresentation provides ContextMenuRepresentation, LocalDefaultButtonStyle provides defaultButtonStyle, LocalDefaultDropdownStyle provides defaultDropdownStyle, - LocalDefaultTabStyle provides defaultTabStyle, + LocalToolWindowTabStyle provides toolWindowTabStyle, + LocalCustomTabStyle provides toolWindowTabStyle, LocalDividerStyle provides dividerStyle, LocalEditorTabStyle provides editorTabStyle, LocalGroupHeaderStyle provides groupHeaderStyle, diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/TabStyling.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/TabStyling.kt index 95cf32f7bf..dcdf99b2ad 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/TabStyling.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/TabStyling.kt @@ -180,7 +180,7 @@ private fun TabState.chooseValueIgnoreCompat( else -> normal } -public val LocalDefaultTabStyle: ProvidableCompositionLocal = +public val LocalToolWindowTabStyle: ProvidableCompositionLocal = staticCompositionLocalOf { error("No LocalTabStyle provided. Have you forgotten the theme?") } diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/theme/JewelTheme.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/theme/JewelTheme.kt index ef4d887997..e207fbcac6 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/theme/JewelTheme.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/theme/JewelTheme.kt @@ -29,7 +29,6 @@ import org.jetbrains.jewel.ui.component.styling.LocalCircularProgressStyle import org.jetbrains.jewel.ui.component.styling.LocalCustomTabStyle import org.jetbrains.jewel.ui.component.styling.LocalDefaultButtonStyle import org.jetbrains.jewel.ui.component.styling.LocalDefaultDropdownStyle -import org.jetbrains.jewel.ui.component.styling.LocalDefaultTabStyle import org.jetbrains.jewel.ui.component.styling.LocalDividerStyle import org.jetbrains.jewel.ui.component.styling.LocalEditorTabStyle import org.jetbrains.jewel.ui.component.styling.LocalGroupHeaderStyle @@ -44,6 +43,7 @@ import org.jetbrains.jewel.ui.component.styling.LocalScrollbarStyle import org.jetbrains.jewel.ui.component.styling.LocalSliderStyle import org.jetbrains.jewel.ui.component.styling.LocalTextAreaStyle import org.jetbrains.jewel.ui.component.styling.LocalTextFieldStyle +import org.jetbrains.jewel.ui.component.styling.LocalToolWindowTabStyle import org.jetbrains.jewel.ui.component.styling.LocalTooltipStyle import org.jetbrains.jewel.ui.component.styling.MenuStyle import org.jetbrains.jewel.ui.component.styling.RadioButtonStyle @@ -146,7 +146,7 @@ public val JewelTheme.Companion.treeStyle: LazyTreeStyle public val JewelTheme.Companion.toolWindowTabStyle: TabStyle @Composable @ReadOnlyComposable - get() = LocalDefaultTabStyle.current + get() = LocalToolWindowTabStyle.current public val JewelTheme.Companion.editorTabStyle: TabStyle @Composable