diff --git a/platform/jewel/ide-laf-bridge/api-dump-unreviewed.txt b/platform/jewel/ide-laf-bridge/api-dump-unreviewed.txt index 71c709399d4f..e1a4cbaa6165 100644 --- a/platform/jewel/ide-laf-bridge/api-dump-unreviewed.txt +++ b/platform/jewel/ide-laf-bridge/api-dump-unreviewed.txt @@ -112,6 +112,9 @@ f:org.jetbrains.jewel.bridge.theme.BridgeSliderStylingKt f:org.jetbrains.jewel.bridge.theme.BridgeThemeColorPaletteKt - sf:getWindowsPopupBorder(org.jetbrains.jewel.foundation.theme.ThemeColorPalette):androidx.compose.ui.graphics.Color - sf:readFromLaF(org.jetbrains.jewel.foundation.theme.ThemeColorPalette$Companion):org.jetbrains.jewel.foundation.theme.ThemeColorPalette +f:org.jetbrains.jewel.bridge.theme.IntUiBridgeSplitButtonKt +- sf:readDefaultSplitButtonStyle():org.jetbrains.jewel.ui.component.styling.SplitButtonStyle +- sf:readOutlinedSplitButtonStyle():org.jetbrains.jewel.ui.component.styling.SplitButtonStyle f:org.jetbrains.jewel.bridge.theme.IntUiBridgeTextKt - sf:retrieveConsoleTextStyle():androidx.compose.ui.text.TextStyle - sf:retrieveDefaultTextStyle():androidx.compose.ui.text.TextStyle diff --git a/platform/jewel/ide-laf-bridge/api/ide-laf-bridge.api b/platform/jewel/ide-laf-bridge/api/ide-laf-bridge.api index 5b09ac9fe29f..e081b1896eb4 100644 --- a/platform/jewel/ide-laf-bridge/api/ide-laf-bridge.api +++ b/platform/jewel/ide-laf-bridge/api/ide-laf-bridge.api @@ -150,6 +150,11 @@ public final class org/jetbrains/jewel/bridge/theme/BridgeThemeColorPaletteKt { public static final fun readFromLaF (Lorg/jetbrains/jewel/foundation/theme/ThemeColorPalette$Companion;)Lorg/jetbrains/jewel/foundation/theme/ThemeColorPalette; } +public final class org/jetbrains/jewel/bridge/theme/IntUiBridgeSplitButtonKt { + public static final fun readDefaultSplitButtonStyle ()Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle; + public static final fun readOutlinedSplitButtonStyle ()Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle; +} + public final class org/jetbrains/jewel/bridge/theme/IntUiBridgeTextKt { public static final fun retrieveConsoleTextStyle ()Landroidx/compose/ui/text/TextStyle; public static final fun retrieveDefaultTextStyle ()Landroidx/compose/ui/text/TextStyle; diff --git a/platform/jewel/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt b/platform/jewel/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt index 3c69a313da44..86aeea5acb26 100644 --- a/platform/jewel/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt +++ b/platform/jewel/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt @@ -72,6 +72,7 @@ internal fun createBridgeComponentStyling(theme: ThemeDefinition): ComponentStyl defaultBannerStyle = readDefaultBannerStyle(), defaultButtonStyle = readDefaultButtonStyle(), defaultDropdownStyle = readDefaultDropdownStyle(menuStyle), + defaultSplitButtonStyle = readDefaultSplitButtonStyle(), defaultTabStyle = readDefaultTabStyle(), dividerStyle = readDividerStyle(), editorTabStyle = readEditorTabStyle(), @@ -83,6 +84,7 @@ internal fun createBridgeComponentStyling(theme: ThemeDefinition): ComponentStyl linkStyle = readLinkStyle(), menuStyle = menuStyle, outlinedButtonStyle = readOutlinedButtonStyle(), + outlinedSplitButtonStyle = readOutlinedSplitButtonStyle(), popupContainerStyle = readPopupContainerStyle(), radioButtonStyle = readRadioButtonStyle(), scrollbarStyle = readScrollbarStyle(theme.isDark), diff --git a/platform/jewel/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridgeSplitButton.kt b/platform/jewel/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridgeSplitButton.kt new file mode 100644 index 000000000000..2c9cba712b24 --- /dev/null +++ b/platform/jewel/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridgeSplitButton.kt @@ -0,0 +1,39 @@ +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the +// Apache 2.0 license. +package org.jetbrains.jewel.bridge.theme + +import androidx.compose.ui.unit.dp +import com.intellij.util.ui.JBUI +import org.jetbrains.jewel.bridge.isNewUiTheme +import org.jetbrains.jewel.bridge.retrieveColorOrUnspecified +import org.jetbrains.jewel.bridge.toComposeColor +import org.jetbrains.jewel.ui.component.styling.SplitButtonColors +import org.jetbrains.jewel.ui.component.styling.SplitButtonMetrics +import org.jetbrains.jewel.ui.component.styling.SplitButtonStyle + +private val dividerPadding: Int + get() = if (isNewUiTheme()) 4 else 1 + +public fun readOutlinedSplitButtonStyle(): SplitButtonStyle = + SplitButtonStyle( + button = readOutlinedButtonStyle(), + colors = + SplitButtonColors( + dividerColor = JBUI.CurrentTheme.Button.buttonOutlineColorStart(false).toComposeColor(), + dividerDisabledColor = JBUI.CurrentTheme.Button.disabledOutlineColor().toComposeColor(), + chevronColor = JBUI.CurrentTheme.Button.Split.Default.ICON_COLOR.toComposeColor(), + ), + metrics = SplitButtonMetrics(dividerMetrics = readDividerStyle().metrics, dividerPadding = dividerPadding.dp), + ) + +public fun readDefaultSplitButtonStyle(): SplitButtonStyle = + SplitButtonStyle( + button = readDefaultButtonStyle(), + colors = + SplitButtonColors( + dividerColor = retrieveColorOrUnspecified("Button.Split.default.separatorColor"), + dividerDisabledColor = JBUI.CurrentTheme.Button.disabledOutlineColor().toComposeColor(), + chevronColor = JBUI.CurrentTheme.Button.Split.Default.ICON_COLOR.toComposeColor(), + ), + metrics = SplitButtonMetrics(dividerMetrics = readDividerStyle().metrics, dividerPadding = dividerPadding.dp), + ) diff --git a/platform/jewel/int-ui/int-ui-standalone/api-dump-unreviewed.txt b/platform/jewel/int-ui/int-ui-standalone/api-dump-unreviewed.txt index c46aafd68c22..7e934156f481 100644 --- a/platform/jewel/int-ui/int-ui-standalone/api-dump-unreviewed.txt +++ b/platform/jewel/int-ui/int-ui-standalone/api-dump-unreviewed.txt @@ -135,6 +135,11 @@ f:org.jetbrains.jewel.intui.standalone.styling.IntUiDefaultSimpleListItemLazyTre - sf:INSTANCE:org.jetbrains.jewel.intui.standalone.styling.IntUiDefaultSimpleListItemLazyTreeStyleFactory - f:dark-69fazGs(J,J,J,J,J,J,J,androidx.compose.runtime.Composer,I,I):org.jetbrains.jewel.ui.component.styling.SimpleListItemColors - f:light-69fazGs(J,J,J,J,J,J,J,androidx.compose.runtime.Composer,I,I):org.jetbrains.jewel.ui.component.styling.SimpleListItemColors +f:org.jetbrains.jewel.intui.standalone.styling.IntUiDefaultSplitButtonStyleFactory +- sf:$stable:I +- sf:INSTANCE:org.jetbrains.jewel.intui.standalone.styling.IntUiDefaultSplitButtonStyleFactory +- f:dark-lHvuNTo(org.jetbrains.jewel.ui.component.styling.ButtonStyle,org.jetbrains.jewel.ui.component.styling.DividerMetrics,J,J,F,J,androidx.compose.runtime.Composer,I,I):org.jetbrains.jewel.ui.component.styling.SplitButtonStyle +- f:light-lHvuNTo(org.jetbrains.jewel.ui.component.styling.ButtonStyle,org.jetbrains.jewel.ui.component.styling.DividerMetrics,J,J,F,J,androidx.compose.runtime.Composer,I,I):org.jetbrains.jewel.ui.component.styling.SplitButtonStyle f:org.jetbrains.jewel.intui.standalone.styling.IntUiDefaultSuccessBannerStyleFactory - sf:$stable:I - sf:INSTANCE:org.jetbrains.jewel.intui.standalone.styling.IntUiDefaultSuccessBannerStyleFactory @@ -285,6 +290,11 @@ f:org.jetbrains.jewel.intui.standalone.styling.IntUiOutlinedButtonStyleFactory - sf:INSTANCE:org.jetbrains.jewel.intui.standalone.styling.IntUiOutlinedButtonStyleFactory - f:dark(org.jetbrains.jewel.ui.component.styling.ButtonColors,org.jetbrains.jewel.ui.component.styling.ButtonMetrics,org.jetbrains.jewel.foundation.Stroke$Alignment,androidx.compose.runtime.Composer,I,I):org.jetbrains.jewel.ui.component.styling.ButtonStyle - f:light(org.jetbrains.jewel.ui.component.styling.ButtonColors,org.jetbrains.jewel.ui.component.styling.ButtonMetrics,org.jetbrains.jewel.foundation.Stroke$Alignment,androidx.compose.runtime.Composer,I,I):org.jetbrains.jewel.ui.component.styling.ButtonStyle +f:org.jetbrains.jewel.intui.standalone.styling.IntUiOutlinedSplitButtonStyleFactory +- sf:$stable:I +- sf:INSTANCE:org.jetbrains.jewel.intui.standalone.styling.IntUiOutlinedSplitButtonStyleFactory +- f:dark-lHvuNTo(org.jetbrains.jewel.ui.component.styling.ButtonStyle,org.jetbrains.jewel.ui.component.styling.DividerMetrics,J,J,F,J,androidx.compose.runtime.Composer,I,I):org.jetbrains.jewel.ui.component.styling.SplitButtonStyle +- f:light-lHvuNTo(org.jetbrains.jewel.ui.component.styling.ButtonStyle,org.jetbrains.jewel.ui.component.styling.DividerMetrics,J,J,F,J,androidx.compose.runtime.Composer,I,I):org.jetbrains.jewel.ui.component.styling.SplitButtonStyle f:org.jetbrains.jewel.intui.standalone.styling.IntUiPopupContainerStylingKt - sf:dark(org.jetbrains.jewel.ui.component.styling.PopupContainerStyle$Companion,org.jetbrains.jewel.ui.component.styling.PopupContainerColors,org.jetbrains.jewel.ui.component.styling.PopupContainerMetrics,androidx.compose.runtime.Composer,I,I):org.jetbrains.jewel.ui.component.styling.PopupContainerStyle - sf:dark-GyCwops(org.jetbrains.jewel.ui.component.styling.PopupContainerColors$Companion,J,J,J,androidx.compose.runtime.Composer,I,I):org.jetbrains.jewel.ui.component.styling.PopupContainerColors @@ -365,6 +375,9 @@ f:org.jetbrains.jewel.intui.standalone.styling.IntUiSliderStylingKt - sf:defaults-nDjVmYc(org.jetbrains.jewel.ui.component.styling.SliderMetrics$Companion,F,J,F,F,F,F,androidx.compose.runtime.Composer,I,I):org.jetbrains.jewel.ui.component.styling.SliderMetrics - sf:light(org.jetbrains.jewel.ui.component.styling.SliderStyle$Companion,org.jetbrains.jewel.ui.component.styling.SliderColors,org.jetbrains.jewel.ui.component.styling.SliderMetrics,androidx.compose.ui.graphics.Shape,androidx.compose.runtime.Composer,I,I):org.jetbrains.jewel.ui.component.styling.SliderStyle - sf:light-8v1krLo(org.jetbrains.jewel.ui.component.styling.SliderColors$Companion,J,J,J,J,J,J,J,J,J,J,J,J,J,J,J,androidx.compose.runtime.Composer,I,I,I):org.jetbrains.jewel.ui.component.styling.SliderColors +f:org.jetbrains.jewel.intui.standalone.styling.IntUiSplitButtonStylingKt +- sf:getDefault(org.jetbrains.jewel.ui.component.styling.SplitButtonStyle$Companion):org.jetbrains.jewel.intui.standalone.styling.IntUiDefaultSplitButtonStyleFactory +- sf:getOutlined(org.jetbrains.jewel.ui.component.styling.SplitButtonStyle$Companion):org.jetbrains.jewel.intui.standalone.styling.IntUiOutlinedSplitButtonStyleFactory f:org.jetbrains.jewel.intui.standalone.styling.IntUiSuccessBannerColorFactory - sf:$stable:I - sf:INSTANCE:org.jetbrains.jewel.intui.standalone.styling.IntUiSuccessBannerColorFactory @@ -459,10 +472,10 @@ f:org.jetbrains.jewel.intui.standalone.theme.IntUiGlobalMetricsKt f:org.jetbrains.jewel.intui.standalone.theme.IntUiThemeKt - sf:IntUiTheme(org.jetbrains.jewel.foundation.theme.ThemeDefinition,org.jetbrains.jewel.ui.ComponentStyling,Z,kotlin.jvm.functions.Function2,androidx.compose.runtime.Composer,I,I):V - sf:IntUiTheme(Z,Z,kotlin.jvm.functions.Function2,androidx.compose.runtime.Composer,I,I):V -- sf:dark(org.jetbrains.jewel.ui.ComponentStyling,org.jetbrains.jewel.ui.component.styling.CheckboxStyle,org.jetbrains.jewel.ui.component.styling.ChipStyle,org.jetbrains.jewel.ui.component.styling.CircularProgressStyle,org.jetbrains.jewel.ui.component.styling.DefaultBannerStyles,org.jetbrains.jewel.ui.component.styling.ComboBoxStyle,org.jetbrains.jewel.ui.component.styling.ButtonStyle,org.jetbrains.jewel.ui.component.styling.TabStyle,org.jetbrains.jewel.ui.component.styling.DividerStyle,org.jetbrains.jewel.ui.component.styling.DropdownStyle,org.jetbrains.jewel.ui.component.styling.TabStyle,org.jetbrains.jewel.ui.component.styling.GroupHeaderStyle,org.jetbrains.jewel.ui.component.styling.HorizontalProgressBarStyle,org.jetbrains.jewel.ui.component.styling.IconButtonStyle,org.jetbrains.jewel.ui.component.styling.InlineBannerStyles,org.jetbrains.jewel.ui.component.styling.LazyTreeStyle,org.jetbrains.jewel.ui.component.styling.LinkStyle,org.jetbrains.jewel.ui.component.styling.MenuStyle,org.jetbrains.jewel.ui.component.styling.ButtonStyle,org.jetbrains.jewel.ui.component.styling.PopupContainerStyle,org.jetbrains.jewel.ui.component.styling.RadioButtonStyle,org.jetbrains.jewel.ui.component.styling.ScrollbarStyle,org.jetbrains.jewel.ui.component.styling.SegmentedControlButtonStyle,org.jetbrains.jewel.ui.component.styling.SegmentedControlStyle,org.jetbrains.jewel.ui.component.styling.SelectableLazyColumnStyle,org.jetbrains.jewel.ui.component.styling.SliderStyle,org.jetbrains.jewel.ui.component.styling.SimpleListItemStyle,org.jetbrains.jewel.ui.component.styling.TextAreaStyle,org.jetbrains.jewel.ui.component.styling.TextFieldStyle,org.jetbrains.jewel.ui.component.styling.TooltipStyle,org.jetbrains.jewel.ui.component.styling.DropdownStyle,androidx.compose.runtime.Composer,I,I,I,I,I):org.jetbrains.jewel.ui.ComponentStyling +- sf:dark(org.jetbrains.jewel.ui.ComponentStyling,org.jetbrains.jewel.ui.component.styling.CheckboxStyle,org.jetbrains.jewel.ui.component.styling.ChipStyle,org.jetbrains.jewel.ui.component.styling.CircularProgressStyle,org.jetbrains.jewel.ui.component.styling.DefaultBannerStyles,org.jetbrains.jewel.ui.component.styling.ComboBoxStyle,org.jetbrains.jewel.ui.component.styling.ButtonStyle,org.jetbrains.jewel.ui.component.styling.SplitButtonStyle,org.jetbrains.jewel.ui.component.styling.TabStyle,org.jetbrains.jewel.ui.component.styling.DividerStyle,org.jetbrains.jewel.ui.component.styling.DropdownStyle,org.jetbrains.jewel.ui.component.styling.TabStyle,org.jetbrains.jewel.ui.component.styling.GroupHeaderStyle,org.jetbrains.jewel.ui.component.styling.HorizontalProgressBarStyle,org.jetbrains.jewel.ui.component.styling.IconButtonStyle,org.jetbrains.jewel.ui.component.styling.InlineBannerStyles,org.jetbrains.jewel.ui.component.styling.LazyTreeStyle,org.jetbrains.jewel.ui.component.styling.LinkStyle,org.jetbrains.jewel.ui.component.styling.MenuStyle,org.jetbrains.jewel.ui.component.styling.ButtonStyle,org.jetbrains.jewel.ui.component.styling.PopupContainerStyle,org.jetbrains.jewel.ui.component.styling.SplitButtonStyle,org.jetbrains.jewel.ui.component.styling.RadioButtonStyle,org.jetbrains.jewel.ui.component.styling.ScrollbarStyle,org.jetbrains.jewel.ui.component.styling.SegmentedControlButtonStyle,org.jetbrains.jewel.ui.component.styling.SegmentedControlStyle,org.jetbrains.jewel.ui.component.styling.SelectableLazyColumnStyle,org.jetbrains.jewel.ui.component.styling.SliderStyle,org.jetbrains.jewel.ui.component.styling.SimpleListItemStyle,org.jetbrains.jewel.ui.component.styling.TextAreaStyle,org.jetbrains.jewel.ui.component.styling.TextFieldStyle,org.jetbrains.jewel.ui.component.styling.TooltipStyle,org.jetbrains.jewel.ui.component.styling.DropdownStyle,androidx.compose.runtime.Composer,I,I,I,I,I,I):org.jetbrains.jewel.ui.ComponentStyling - sf:darkThemeDefinition-VRxQTpk(org.jetbrains.jewel.foundation.theme.JewelTheme$Companion,org.jetbrains.jewel.foundation.GlobalColors,org.jetbrains.jewel.foundation.GlobalMetrics,org.jetbrains.jewel.foundation.theme.ThemeColorPalette,org.jetbrains.jewel.foundation.theme.ThemeIconData,androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.TextStyle,J,androidx.compose.runtime.Composer,I,I):org.jetbrains.jewel.foundation.theme.ThemeDefinition - sf:default(org.jetbrains.jewel.ui.ComponentStyling,androidx.compose.runtime.Composer,I):org.jetbrains.jewel.ui.ComponentStyling -- sf:light(org.jetbrains.jewel.ui.ComponentStyling,org.jetbrains.jewel.ui.component.styling.CheckboxStyle,org.jetbrains.jewel.ui.component.styling.ChipStyle,org.jetbrains.jewel.ui.component.styling.CircularProgressStyle,org.jetbrains.jewel.ui.component.styling.DefaultBannerStyles,org.jetbrains.jewel.ui.component.styling.ComboBoxStyle,org.jetbrains.jewel.ui.component.styling.ButtonStyle,org.jetbrains.jewel.ui.component.styling.TabStyle,org.jetbrains.jewel.ui.component.styling.DividerStyle,org.jetbrains.jewel.ui.component.styling.DropdownStyle,org.jetbrains.jewel.ui.component.styling.TabStyle,org.jetbrains.jewel.ui.component.styling.GroupHeaderStyle,org.jetbrains.jewel.ui.component.styling.HorizontalProgressBarStyle,org.jetbrains.jewel.ui.component.styling.IconButtonStyle,org.jetbrains.jewel.ui.component.styling.InlineBannerStyles,org.jetbrains.jewel.ui.component.styling.LazyTreeStyle,org.jetbrains.jewel.ui.component.styling.LinkStyle,org.jetbrains.jewel.ui.component.styling.MenuStyle,org.jetbrains.jewel.ui.component.styling.PopupContainerStyle,org.jetbrains.jewel.ui.component.styling.ButtonStyle,org.jetbrains.jewel.ui.component.styling.RadioButtonStyle,org.jetbrains.jewel.ui.component.styling.ScrollbarStyle,org.jetbrains.jewel.ui.component.styling.SegmentedControlButtonStyle,org.jetbrains.jewel.ui.component.styling.SegmentedControlStyle,org.jetbrains.jewel.ui.component.styling.SliderStyle,org.jetbrains.jewel.ui.component.styling.SelectableLazyColumnStyle,org.jetbrains.jewel.ui.component.styling.SimpleListItemStyle,org.jetbrains.jewel.ui.component.styling.TextAreaStyle,org.jetbrains.jewel.ui.component.styling.TextFieldStyle,org.jetbrains.jewel.ui.component.styling.TooltipStyle,org.jetbrains.jewel.ui.component.styling.DropdownStyle,androidx.compose.runtime.Composer,I,I,I,I,I):org.jetbrains.jewel.ui.ComponentStyling +- sf:light(org.jetbrains.jewel.ui.ComponentStyling,org.jetbrains.jewel.ui.component.styling.CheckboxStyle,org.jetbrains.jewel.ui.component.styling.ChipStyle,org.jetbrains.jewel.ui.component.styling.CircularProgressStyle,org.jetbrains.jewel.ui.component.styling.DefaultBannerStyles,org.jetbrains.jewel.ui.component.styling.ComboBoxStyle,org.jetbrains.jewel.ui.component.styling.ButtonStyle,org.jetbrains.jewel.ui.component.styling.SplitButtonStyle,org.jetbrains.jewel.ui.component.styling.TabStyle,org.jetbrains.jewel.ui.component.styling.DividerStyle,org.jetbrains.jewel.ui.component.styling.DropdownStyle,org.jetbrains.jewel.ui.component.styling.TabStyle,org.jetbrains.jewel.ui.component.styling.GroupHeaderStyle,org.jetbrains.jewel.ui.component.styling.HorizontalProgressBarStyle,org.jetbrains.jewel.ui.component.styling.IconButtonStyle,org.jetbrains.jewel.ui.component.styling.InlineBannerStyles,org.jetbrains.jewel.ui.component.styling.LazyTreeStyle,org.jetbrains.jewel.ui.component.styling.LinkStyle,org.jetbrains.jewel.ui.component.styling.MenuStyle,org.jetbrains.jewel.ui.component.styling.PopupContainerStyle,org.jetbrains.jewel.ui.component.styling.ButtonStyle,org.jetbrains.jewel.ui.component.styling.SplitButtonStyle,org.jetbrains.jewel.ui.component.styling.RadioButtonStyle,org.jetbrains.jewel.ui.component.styling.ScrollbarStyle,org.jetbrains.jewel.ui.component.styling.SegmentedControlButtonStyle,org.jetbrains.jewel.ui.component.styling.SegmentedControlStyle,org.jetbrains.jewel.ui.component.styling.SliderStyle,org.jetbrains.jewel.ui.component.styling.SelectableLazyColumnStyle,org.jetbrains.jewel.ui.component.styling.SimpleListItemStyle,org.jetbrains.jewel.ui.component.styling.TextAreaStyle,org.jetbrains.jewel.ui.component.styling.TextFieldStyle,org.jetbrains.jewel.ui.component.styling.TooltipStyle,org.jetbrains.jewel.ui.component.styling.DropdownStyle,androidx.compose.runtime.Composer,I,I,I,I,I,I):org.jetbrains.jewel.ui.ComponentStyling - sf:lightThemeDefinition-VRxQTpk(org.jetbrains.jewel.foundation.theme.JewelTheme$Companion,org.jetbrains.jewel.foundation.GlobalColors,org.jetbrains.jewel.foundation.GlobalMetrics,org.jetbrains.jewel.foundation.theme.ThemeColorPalette,org.jetbrains.jewel.foundation.theme.ThemeIconData,androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.TextStyle,androidx.compose.ui.text.TextStyle,J,androidx.compose.runtime.Composer,I,I):org.jetbrains.jewel.foundation.theme.ThemeDefinition f:org.jetbrains.jewel.intui.standalone.theme.TextStylesKt - sf:createDefaultTextStyle-8YS_zAE(org.jetbrains.jewel.foundation.theme.JewelTheme$Companion,androidx.compose.ui.graphics.Brush,F,J,androidx.compose.ui.text.font.FontWeight,androidx.compose.ui.text.font.FontStyle,androidx.compose.ui.text.font.FontSynthesis,androidx.compose.ui.text.font.FontFamily,java.lang.String,J,androidx.compose.ui.text.style.BaselineShift,androidx.compose.ui.text.style.TextGeometricTransform,androidx.compose.ui.text.intl.LocaleList,J,androidx.compose.ui.text.style.TextDecoration,androidx.compose.ui.graphics.Shadow,androidx.compose.ui.graphics.drawscope.DrawStyle,I,I,J,androidx.compose.ui.text.style.TextIndent,androidx.compose.ui.text.PlatformTextStyle,androidx.compose.ui.text.style.LineHeightStyle,I,I,androidx.compose.ui.text.style.TextMotion):androidx.compose.ui.text.TextStyle diff --git a/platform/jewel/int-ui/int-ui-standalone/api/int-ui-standalone.api b/platform/jewel/int-ui/int-ui-standalone/api/int-ui-standalone.api index 1a422925afe6..4b17de443382 100644 --- a/platform/jewel/int-ui/int-ui-standalone/api/int-ui-standalone.api +++ b/platform/jewel/int-ui/int-ui-standalone/api/int-ui-standalone.api @@ -178,6 +178,13 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUiDefaultSimp public final fun light-69fazGs (JJJJJJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/SimpleListItemColors; } +public final class org/jetbrains/jewel/intui/standalone/styling/IntUiDefaultSplitButtonStyleFactory { + public static final field $stable I + public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultSplitButtonStyleFactory; + public final fun dark-lHvuNTo (Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/DividerMetrics;JJFJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle; + public final fun light-lHvuNTo (Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/DividerMetrics;JJFJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle; +} + public final class org/jetbrains/jewel/intui/standalone/styling/IntUiDefaultSuccessBannerStyleFactory { public static final field $stable I public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultSuccessBannerStyleFactory; @@ -374,6 +381,13 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUiOutlinedBut public final fun light (Lorg/jetbrains/jewel/ui/component/styling/ButtonColors;Lorg/jetbrains/jewel/ui/component/styling/ButtonMetrics;Lorg/jetbrains/jewel/foundation/Stroke$Alignment;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle; } +public final class org/jetbrains/jewel/intui/standalone/styling/IntUiOutlinedSplitButtonStyleFactory { + public static final field $stable I + public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/styling/IntUiOutlinedSplitButtonStyleFactory; + public final fun dark-lHvuNTo (Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/DividerMetrics;JJFJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle; + public final fun light-lHvuNTo (Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/DividerMetrics;JJFJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle; +} + public final class org/jetbrains/jewel/intui/standalone/styling/IntUiPopupContainerStylingKt { public static final fun dark (Lorg/jetbrains/jewel/ui/component/styling/PopupContainerStyle$Companion;Lorg/jetbrains/jewel/ui/component/styling/PopupContainerColors;Lorg/jetbrains/jewel/ui/component/styling/PopupContainerMetrics;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/PopupContainerStyle; public static final fun dark-GyCwops (Lorg/jetbrains/jewel/ui/component/styling/PopupContainerColors$Companion;JJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/PopupContainerColors; @@ -470,6 +484,11 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUiSliderStyli public static final fun light-8v1krLo (Lorg/jetbrains/jewel/ui/component/styling/SliderColors$Companion;JJJJJJJJJJJJJJJLandroidx/compose/runtime/Composer;III)Lorg/jetbrains/jewel/ui/component/styling/SliderColors; } +public final class org/jetbrains/jewel/intui/standalone/styling/IntUiSplitButtonStylingKt { + public static final fun getDefault (Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultSplitButtonStyleFactory; + public static final fun getOutlined (Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiOutlinedSplitButtonStyleFactory; +} + public final class org/jetbrains/jewel/intui/standalone/styling/IntUiSuccessBannerColorFactory { public static final field $stable I public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/styling/IntUiSuccessBannerColorFactory; @@ -590,10 +609,10 @@ public final class org/jetbrains/jewel/intui/standalone/theme/IntUiGlobalMetrics public final class org/jetbrains/jewel/intui/standalone/theme/IntUiThemeKt { public static final fun IntUiTheme (Lorg/jetbrains/jewel/foundation/theme/ThemeDefinition;Lorg/jetbrains/jewel/ui/ComponentStyling;ZLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V public static final fun IntUiTheme (ZZLkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V - public static final fun dark (Lorg/jetbrains/jewel/ui/ComponentStyling;Lorg/jetbrains/jewel/ui/component/styling/CheckboxStyle;Lorg/jetbrains/jewel/ui/component/styling/ChipStyle;Lorg/jetbrains/jewel/ui/component/styling/CircularProgressStyle;Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyles;Lorg/jetbrains/jewel/ui/component/styling/ComboBoxStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/DividerStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderStyle;Lorg/jetbrains/jewel/ui/component/styling/HorizontalProgressBarStyle;Lorg/jetbrains/jewel/ui/component/styling/IconButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyles;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle;Lorg/jetbrains/jewel/ui/component/styling/LinkStyle;Lorg/jetbrains/jewel/ui/component/styling/MenuStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/PopupContainerStyle;Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;Lorg/jetbrains/jewel/ui/component/styling/SegmentedControlButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/SegmentedControlStyle;Lorg/jetbrains/jewel/ui/component/styling/SelectableLazyColumnStyle;Lorg/jetbrains/jewel/ui/component/styling/SliderStyle;Lorg/jetbrains/jewel/ui/component/styling/SimpleListItemStyle;Lorg/jetbrains/jewel/ui/component/styling/TextAreaStyle;Lorg/jetbrains/jewel/ui/component/styling/TextFieldStyle;Lorg/jetbrains/jewel/ui/component/styling/TooltipStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Landroidx/compose/runtime/Composer;IIIII)Lorg/jetbrains/jewel/ui/ComponentStyling; + public static final fun dark (Lorg/jetbrains/jewel/ui/ComponentStyling;Lorg/jetbrains/jewel/ui/component/styling/CheckboxStyle;Lorg/jetbrains/jewel/ui/component/styling/ChipStyle;Lorg/jetbrains/jewel/ui/component/styling/CircularProgressStyle;Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyles;Lorg/jetbrains/jewel/ui/component/styling/ComboBoxStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/DividerStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderStyle;Lorg/jetbrains/jewel/ui/component/styling/HorizontalProgressBarStyle;Lorg/jetbrains/jewel/ui/component/styling/IconButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyles;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle;Lorg/jetbrains/jewel/ui/component/styling/LinkStyle;Lorg/jetbrains/jewel/ui/component/styling/MenuStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/PopupContainerStyle;Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;Lorg/jetbrains/jewel/ui/component/styling/SegmentedControlButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/SegmentedControlStyle;Lorg/jetbrains/jewel/ui/component/styling/SelectableLazyColumnStyle;Lorg/jetbrains/jewel/ui/component/styling/SliderStyle;Lorg/jetbrains/jewel/ui/component/styling/SimpleListItemStyle;Lorg/jetbrains/jewel/ui/component/styling/TextAreaStyle;Lorg/jetbrains/jewel/ui/component/styling/TextFieldStyle;Lorg/jetbrains/jewel/ui/component/styling/TooltipStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Landroidx/compose/runtime/Composer;IIIIII)Lorg/jetbrains/jewel/ui/ComponentStyling; public static final fun darkThemeDefinition-VRxQTpk (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Lorg/jetbrains/jewel/foundation/GlobalColors;Lorg/jetbrains/jewel/foundation/GlobalMetrics;Lorg/jetbrains/jewel/foundation/theme/ThemeColorPalette;Lorg/jetbrains/jewel/foundation/theme/ThemeIconData;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;JLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/foundation/theme/ThemeDefinition; public static final fun default (Lorg/jetbrains/jewel/ui/ComponentStyling;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/ComponentStyling; - public static final fun light (Lorg/jetbrains/jewel/ui/ComponentStyling;Lorg/jetbrains/jewel/ui/component/styling/CheckboxStyle;Lorg/jetbrains/jewel/ui/component/styling/ChipStyle;Lorg/jetbrains/jewel/ui/component/styling/CircularProgressStyle;Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyles;Lorg/jetbrains/jewel/ui/component/styling/ComboBoxStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/DividerStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderStyle;Lorg/jetbrains/jewel/ui/component/styling/HorizontalProgressBarStyle;Lorg/jetbrains/jewel/ui/component/styling/IconButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyles;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle;Lorg/jetbrains/jewel/ui/component/styling/LinkStyle;Lorg/jetbrains/jewel/ui/component/styling/MenuStyle;Lorg/jetbrains/jewel/ui/component/styling/PopupContainerStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;Lorg/jetbrains/jewel/ui/component/styling/SegmentedControlButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/SegmentedControlStyle;Lorg/jetbrains/jewel/ui/component/styling/SliderStyle;Lorg/jetbrains/jewel/ui/component/styling/SelectableLazyColumnStyle;Lorg/jetbrains/jewel/ui/component/styling/SimpleListItemStyle;Lorg/jetbrains/jewel/ui/component/styling/TextAreaStyle;Lorg/jetbrains/jewel/ui/component/styling/TextFieldStyle;Lorg/jetbrains/jewel/ui/component/styling/TooltipStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Landroidx/compose/runtime/Composer;IIIII)Lorg/jetbrains/jewel/ui/ComponentStyling; + public static final fun light (Lorg/jetbrains/jewel/ui/ComponentStyling;Lorg/jetbrains/jewel/ui/component/styling/CheckboxStyle;Lorg/jetbrains/jewel/ui/component/styling/ChipStyle;Lorg/jetbrains/jewel/ui/component/styling/CircularProgressStyle;Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyles;Lorg/jetbrains/jewel/ui/component/styling/ComboBoxStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/DividerStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderStyle;Lorg/jetbrains/jewel/ui/component/styling/HorizontalProgressBarStyle;Lorg/jetbrains/jewel/ui/component/styling/IconButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyles;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle;Lorg/jetbrains/jewel/ui/component/styling/LinkStyle;Lorg/jetbrains/jewel/ui/component/styling/MenuStyle;Lorg/jetbrains/jewel/ui/component/styling/PopupContainerStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;Lorg/jetbrains/jewel/ui/component/styling/SegmentedControlButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/SegmentedControlStyle;Lorg/jetbrains/jewel/ui/component/styling/SliderStyle;Lorg/jetbrains/jewel/ui/component/styling/SelectableLazyColumnStyle;Lorg/jetbrains/jewel/ui/component/styling/SimpleListItemStyle;Lorg/jetbrains/jewel/ui/component/styling/TextAreaStyle;Lorg/jetbrains/jewel/ui/component/styling/TextFieldStyle;Lorg/jetbrains/jewel/ui/component/styling/TooltipStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Landroidx/compose/runtime/Composer;IIIIII)Lorg/jetbrains/jewel/ui/ComponentStyling; public static final fun lightThemeDefinition-VRxQTpk (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Lorg/jetbrains/jewel/foundation/GlobalColors;Lorg/jetbrains/jewel/foundation/GlobalMetrics;Lorg/jetbrains/jewel/foundation/theme/ThemeColorPalette;Lorg/jetbrains/jewel/foundation/theme/ThemeIconData;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;JLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/foundation/theme/ThemeDefinition; } diff --git a/platform/jewel/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiSplitButtonStyling.kt b/platform/jewel/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiSplitButtonStyling.kt new file mode 100644 index 000000000000..8e50b5f91ed9 --- /dev/null +++ b/platform/jewel/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiSplitButtonStyling.kt @@ -0,0 +1,84 @@ +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the +// Apache 2.0 license. +package org.jetbrains.jewel.intui.standalone.styling + +import androidx.compose.runtime.Composable +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import org.jetbrains.jewel.intui.core.theme.IntUiLightTheme +import org.jetbrains.jewel.ui.component.styling.ButtonStyle +import org.jetbrains.jewel.ui.component.styling.DividerMetrics +import org.jetbrains.jewel.ui.component.styling.SplitButtonColors +import org.jetbrains.jewel.ui.component.styling.SplitButtonMetrics +import org.jetbrains.jewel.ui.component.styling.SplitButtonStyle + +public val SplitButtonStyle.Companion.Default: IntUiDefaultSplitButtonStyleFactory + get() = IntUiDefaultSplitButtonStyleFactory + +public object IntUiDefaultSplitButtonStyleFactory { + @Composable + public fun light( + buttonStyle: ButtonStyle = ButtonStyle.Default.light(), + dividerMetrics: DividerMetrics = DividerMetrics.defaults(), + dividerColor: Color = IntUiLightTheme.colors.blue(8), + dividerDisabledColor: Color = IntUiLightTheme.colors.gray(12), + dividerPadding: Dp = 4.dp, + chevronColor: Color = Color.White, + ): SplitButtonStyle = + SplitButtonStyle( + button = buttonStyle, + metrics = SplitButtonMetrics(dividerMetrics, dividerPadding), + colors = SplitButtonColors(dividerColor, dividerDisabledColor, chevronColor), + ) + + @Composable + public fun dark( + buttonStyle: ButtonStyle = ButtonStyle.Default.dark(), + dividerMetrics: DividerMetrics = DividerMetrics.defaults(), + dividerColor: Color = IntUiLightTheme.colors.blue(9), + dividerDisabledColor: Color = IntUiLightTheme.colors.gray(5), + dividerPadding: Dp = 4.dp, + chevronColor: Color = Color.White, + ): SplitButtonStyle = + SplitButtonStyle( + button = buttonStyle, + metrics = SplitButtonMetrics(dividerMetrics, dividerPadding), + colors = SplitButtonColors(dividerColor, dividerDisabledColor, chevronColor), + ) +} + +public val SplitButtonStyle.Companion.Outlined: IntUiOutlinedSplitButtonStyleFactory + get() = IntUiOutlinedSplitButtonStyleFactory + +public object IntUiOutlinedSplitButtonStyleFactory { + @Composable + public fun light( + buttonStyle: ButtonStyle = ButtonStyle.Outlined.light(), + dividerMetrics: DividerMetrics = DividerMetrics.defaults(), + dividerColor: Color = IntUiLightTheme.colors.gray(9), + dividerDisabledColor: Color = IntUiLightTheme.colors.gray(12), + dividerPadding: Dp = 4.dp, + chevronColor: Color = Color.Unspecified, + ): SplitButtonStyle = + SplitButtonStyle( + button = buttonStyle, + metrics = SplitButtonMetrics(dividerMetrics, dividerPadding), + colors = SplitButtonColors(dividerColor, dividerDisabledColor, chevronColor), + ) + + @Composable + public fun dark( + buttonStyle: ButtonStyle = ButtonStyle.Outlined.dark(), + dividerMetrics: DividerMetrics = DividerMetrics.defaults(), + dividerColor: Color = IntUiLightTheme.colors.gray(5), + dividerDisabledColor: Color = IntUiLightTheme.colors.gray(5), + dividerPadding: Dp = 4.dp, + chevronColor: Color = Color.White, + ): SplitButtonStyle = + SplitButtonStyle( + button = buttonStyle, + metrics = SplitButtonMetrics(dividerMetrics, dividerPadding), + colors = SplitButtonColors(dividerColor, dividerDisabledColor, chevronColor), + ) +} diff --git a/platform/jewel/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/theme/IntUiTheme.kt b/platform/jewel/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/theme/IntUiTheme.kt index b79fa6574ddb..008113e2ccad 100644 --- a/platform/jewel/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/theme/IntUiTheme.kt +++ b/platform/jewel/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/theme/IntUiTheme.kt @@ -45,6 +45,7 @@ import org.jetbrains.jewel.ui.component.styling.SegmentedControlStyle import org.jetbrains.jewel.ui.component.styling.SelectableLazyColumnStyle import org.jetbrains.jewel.ui.component.styling.SimpleListItemStyle import org.jetbrains.jewel.ui.component.styling.SliderStyle +import org.jetbrains.jewel.ui.component.styling.SplitButtonStyle import org.jetbrains.jewel.ui.component.styling.TabStyle import org.jetbrains.jewel.ui.component.styling.TextAreaStyle import org.jetbrains.jewel.ui.component.styling.TextFieldStyle @@ -115,6 +116,7 @@ public fun ComponentStyling.dark( defaultBannerStyle: DefaultBannerStyles = DefaultBannerStyles.Default.dark(), comboBoxStyle: ComboBoxStyle = ComboBoxStyle.Default.dark(), defaultButtonStyle: ButtonStyle = ButtonStyle.Default.dark(), + defaultSplitButtonStyle: SplitButtonStyle = SplitButtonStyle.Default.dark(), defaultTabStyle: TabStyle = TabStyle.Default.dark(), dividerStyle: DividerStyle = DividerStyle.dark(), dropdownStyle: DropdownStyle = DropdownStyle.Default.dark(), @@ -128,6 +130,7 @@ public fun ComponentStyling.dark( menuStyle: MenuStyle = MenuStyle.dark(), outlinedButtonStyle: ButtonStyle = ButtonStyle.Outlined.dark(), popupContainerStyle: PopupContainerStyle = PopupContainerStyle.dark(), + outlinedSplitButtonStyle: SplitButtonStyle = SplitButtonStyle.Outlined.dark(), radioButtonStyle: RadioButtonStyle = RadioButtonStyle.dark(), scrollbarStyle: ScrollbarStyle = ScrollbarStyle.dark(), segmentedControlButtonStyle: SegmentedControlButtonStyle = SegmentedControlButtonStyle.dark(), @@ -149,6 +152,7 @@ public fun ComponentStyling.dark( comboBoxStyle = comboBoxStyle, defaultButtonStyle = defaultButtonStyle, defaultDropdownStyle = dropdownStyle, + defaultSplitButtonStyle = defaultSplitButtonStyle, defaultTabStyle = defaultTabStyle, dividerStyle = dividerStyle, editorTabStyle = editorTabStyle, @@ -161,6 +165,7 @@ public fun ComponentStyling.dark( menuStyle = menuStyle, outlinedButtonStyle = outlinedButtonStyle, popupContainerStyle = popupContainerStyle, + outlinedSplitButtonStyle = outlinedSplitButtonStyle, radioButtonStyle = radioButtonStyle, scrollbarStyle = scrollbarStyle, segmentedControlButtonStyle = segmentedControlButtonStyle, @@ -183,6 +188,7 @@ public fun ComponentStyling.light( defaultBannerStyle: DefaultBannerStyles = DefaultBannerStyles.Default.light(), comboBoxStyle: ComboBoxStyle = ComboBoxStyle.Default.light(), defaultButtonStyle: ButtonStyle = ButtonStyle.Default.light(), + defaultSplitButtonStyle: SplitButtonStyle = SplitButtonStyle.Default.light(), defaultTabStyle: TabStyle = TabStyle.Default.light(), dividerStyle: DividerStyle = DividerStyle.light(), dropdownStyle: DropdownStyle = DropdownStyle.Default.light(), @@ -196,6 +202,7 @@ public fun ComponentStyling.light( menuStyle: MenuStyle = MenuStyle.light(), popupContainerStyle: PopupContainerStyle = PopupContainerStyle.light(), outlinedButtonStyle: ButtonStyle = ButtonStyle.Outlined.light(), + outlinedSplitButtonStyle: SplitButtonStyle = SplitButtonStyle.Outlined.light(), radioButtonStyle: RadioButtonStyle = RadioButtonStyle.light(), scrollbarStyle: ScrollbarStyle = ScrollbarStyle.light(), segmentedControlButtonStyle: SegmentedControlButtonStyle = SegmentedControlButtonStyle.light(), @@ -217,6 +224,7 @@ public fun ComponentStyling.light( defaultBannerStyle = defaultBannerStyle, defaultButtonStyle = defaultButtonStyle, defaultDropdownStyle = dropdownStyle, + defaultSplitButtonStyle = defaultSplitButtonStyle, defaultTabStyle = defaultTabStyle, dividerStyle = dividerStyle, editorTabStyle = editorTabStyle, @@ -229,6 +237,7 @@ public fun ComponentStyling.light( menuStyle = menuStyle, outlinedButtonStyle = outlinedButtonStyle, popupContainerStyle = popupContainerStyle, + outlinedSplitButtonStyle = outlinedSplitButtonStyle, radioButtonStyle = radioButtonStyle, scrollbarStyle = scrollbarStyle, segmentedControlButtonStyle = segmentedControlButtonStyle, diff --git a/platform/jewel/samples/ide-plugin/src/main/kotlin/org/jetbrains/jewel/samples/ideplugin/SwingComparisonTabPanel.kt b/platform/jewel/samples/ide-plugin/src/main/kotlin/org/jetbrains/jewel/samples/ideplugin/SwingComparisonTabPanel.kt index dd63e8799ef4..59db7767527c 100644 --- a/platform/jewel/samples/ide-plugin/src/main/kotlin/org/jetbrains/jewel/samples/ideplugin/SwingComparisonTabPanel.kt +++ b/platform/jewel/samples/ide-plugin/src/main/kotlin/org/jetbrains/jewel/samples/ideplugin/SwingComparisonTabPanel.kt @@ -3,7 +3,6 @@ package org.jetbrains.jewel.samples.ideplugin import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.BoxWithConstraints import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row @@ -129,7 +128,7 @@ internal class SwingComparisonTabPanel : BorderLayoutPanel() { row("Long text (Swing)") { text(longText, maxLineLength = 100) } row("Long text (Compose)") { compose { - BoxWithConstraints { + Box { Text( longText, modifier = @@ -150,7 +149,7 @@ internal class SwingComparisonTabPanel : BorderLayoutPanel() { } row("Titles (Compose)") { compose { - BoxWithConstraints { + Box { val style = Typography.h1TextStyle() Text( "This will wrap over a couple rows", diff --git a/platform/jewel/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Buttons.kt b/platform/jewel/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Buttons.kt index 1c9dbc751154..9c8eb59db100 100644 --- a/platform/jewel/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Buttons.kt +++ b/platform/jewel/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Buttons.kt @@ -1,9 +1,13 @@ package org.jetbrains.jewel.samples.standalone.view.component import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row 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.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf @@ -12,21 +16,29 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp +import org.jetbrains.jewel.foundation.util.JewelLogger import org.jetbrains.jewel.ui.component.ActionButton import org.jetbrains.jewel.ui.component.DefaultButton +import org.jetbrains.jewel.ui.component.DefaultSplitButton import org.jetbrains.jewel.ui.component.Icon import org.jetbrains.jewel.ui.component.IconActionButton import org.jetbrains.jewel.ui.component.IconButton import org.jetbrains.jewel.ui.component.OutlinedButton +import org.jetbrains.jewel.ui.component.OutlinedSplitButton import org.jetbrains.jewel.ui.component.SelectableIconActionButton import org.jetbrains.jewel.ui.component.SelectableIconButton import org.jetbrains.jewel.ui.component.Text import org.jetbrains.jewel.ui.component.ToggleableIconActionButton import org.jetbrains.jewel.ui.component.ToggleableIconButton import org.jetbrains.jewel.ui.component.Typography +import org.jetbrains.jewel.ui.component.items +import org.jetbrains.jewel.ui.component.separator import org.jetbrains.jewel.ui.component.styling.LocalIconButtonStyle import org.jetbrains.jewel.ui.icons.AllIconsKeys +import org.jetbrains.jewel.ui.painter.badge.DotBadgeShape +import org.jetbrains.jewel.ui.painter.hints.Badge import org.jetbrains.jewel.ui.painter.hints.Selected import org.jetbrains.jewel.ui.painter.hints.Stroke @@ -40,6 +52,8 @@ fun Buttons() { IconActionButtons(selectedIndex == 2) { selectedIndex = 2 } ActionButtons() + + SplitButtons() } } @@ -158,3 +172,78 @@ private fun ActionButtons() { ActionButton(onClick = {}) { Text("Do something") } } } + +@Composable +private fun SplitButtons() { + val items = remember { listOf("This is", "---", "A menu", "---", "Item 3") } + var selected by remember { mutableStateOf(items.first()) } + + Row(Modifier.height(150.dp), horizontalArrangement = Arrangement.spacedBy(16.dp)) { + OutlinedSplitButton( + onClick = { JewelLogger.getInstance("Jewel").warn("Outlined split button clicked") }, + secondaryOnClick = { JewelLogger.getInstance("Jewel").warn("Outlined split button chevron clicked") }, + content = { Text("Split button") }, + menuContent = { + items.forEach { + if (it == "---") { + separator() + } else { + selectableItem( + selected = selected == it, + onClick = { + selected = it + JewelLogger.getInstance("Jewel").warn("Item clicked: $it") + }, + ) { + Text(it) + } + } + } + }, + ) + OutlinedSplitButton( + onClick = { JewelLogger.getInstance("Jewel").warn("Outlined split button clicked") }, + secondaryOnClick = { JewelLogger.getInstance("Jewel").warn("Outlined split button chevron clicked") }, + content = { Text("Split button") }, + popupContainer = { + Column(Modifier.padding(8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) { + Text("Generic popup content") + Box(Modifier.size(24.dp), contentAlignment = Alignment.Center) { + Icon( + key = AllIconsKeys.Nodes.ConfigFolder, + contentDescription = "taskGroup", + hint = Badge(Color.Red, DotBadgeShape.Default), + ) + } + } + }, + ) + OutlinedSplitButton( + enabled = false, + onClick = {}, + secondaryOnClick = {}, + content = { Text("Disabled button") }, + menuContent = {}, + ) + DefaultSplitButton( + onClick = { JewelLogger.getInstance("Jewel").warn("Outlined split button clicked") }, + secondaryOnClick = { JewelLogger.getInstance("Jewel").warn("Outlined split button chevron clicked") }, + content = { Text("Split button") }, + menuContent = { + items( + items = listOf("Item 1", "Item 2", "Item 3"), + isSelected = { false }, + onItemClick = { JewelLogger.getInstance("Jewel").warn("Item clicked: $it") }, + content = { Text(it) }, + ) + }, + ) + DefaultSplitButton( + enabled = false, + onClick = {}, + secondaryOnClick = {}, + content = { Text("Disabled button") }, + menuContent = {}, + ) + } +} diff --git a/platform/jewel/ui/api-dump-unreviewed.txt b/platform/jewel/ui/api-dump-unreviewed.txt index 6b9c42591d57..d9bd4d0dc23c 100644 --- a/platform/jewel/ui/api-dump-unreviewed.txt +++ b/platform/jewel/ui/api-dump-unreviewed.txt @@ -12,7 +12,7 @@ f:org.jetbrains.jewel.ui.ComponentStyling$Companion f:org.jetbrains.jewel.ui.DefaultComponentStyling - org.jetbrains.jewel.ui.ComponentStyling - sf:$stable:I -- (org.jetbrains.jewel.ui.component.styling.CheckboxStyle,org.jetbrains.jewel.ui.component.styling.ChipStyle,org.jetbrains.jewel.ui.component.styling.CircularProgressStyle,org.jetbrains.jewel.ui.component.styling.DefaultBannerStyles,org.jetbrains.jewel.ui.component.styling.ComboBoxStyle,org.jetbrains.jewel.ui.component.styling.ButtonStyle,org.jetbrains.jewel.ui.component.styling.DropdownStyle,org.jetbrains.jewel.ui.component.styling.TabStyle,org.jetbrains.jewel.ui.component.styling.DividerStyle,org.jetbrains.jewel.ui.component.styling.TabStyle,org.jetbrains.jewel.ui.component.styling.GroupHeaderStyle,org.jetbrains.jewel.ui.component.styling.HorizontalProgressBarStyle,org.jetbrains.jewel.ui.component.styling.IconButtonStyle,org.jetbrains.jewel.ui.component.styling.InlineBannerStyles,org.jetbrains.jewel.ui.component.styling.LazyTreeStyle,org.jetbrains.jewel.ui.component.styling.LinkStyle,org.jetbrains.jewel.ui.component.styling.MenuStyle,org.jetbrains.jewel.ui.component.styling.ButtonStyle,org.jetbrains.jewel.ui.component.styling.PopupContainerStyle,org.jetbrains.jewel.ui.component.styling.RadioButtonStyle,org.jetbrains.jewel.ui.component.styling.ScrollbarStyle,org.jetbrains.jewel.ui.component.styling.SegmentedControlButtonStyle,org.jetbrains.jewel.ui.component.styling.SegmentedControlStyle,org.jetbrains.jewel.ui.component.styling.SelectableLazyColumnStyle,org.jetbrains.jewel.ui.component.styling.SimpleListItemStyle,org.jetbrains.jewel.ui.component.styling.SliderStyle,org.jetbrains.jewel.ui.component.styling.TextAreaStyle,org.jetbrains.jewel.ui.component.styling.TextFieldStyle,org.jetbrains.jewel.ui.component.styling.TooltipStyle,org.jetbrains.jewel.ui.component.styling.DropdownStyle):V +- (org.jetbrains.jewel.ui.component.styling.CheckboxStyle,org.jetbrains.jewel.ui.component.styling.ChipStyle,org.jetbrains.jewel.ui.component.styling.CircularProgressStyle,org.jetbrains.jewel.ui.component.styling.DefaultBannerStyles,org.jetbrains.jewel.ui.component.styling.ComboBoxStyle,org.jetbrains.jewel.ui.component.styling.ButtonStyle,org.jetbrains.jewel.ui.component.styling.DropdownStyle,org.jetbrains.jewel.ui.component.styling.SplitButtonStyle,org.jetbrains.jewel.ui.component.styling.TabStyle,org.jetbrains.jewel.ui.component.styling.DividerStyle,org.jetbrains.jewel.ui.component.styling.TabStyle,org.jetbrains.jewel.ui.component.styling.GroupHeaderStyle,org.jetbrains.jewel.ui.component.styling.HorizontalProgressBarStyle,org.jetbrains.jewel.ui.component.styling.IconButtonStyle,org.jetbrains.jewel.ui.component.styling.InlineBannerStyles,org.jetbrains.jewel.ui.component.styling.LazyTreeStyle,org.jetbrains.jewel.ui.component.styling.LinkStyle,org.jetbrains.jewel.ui.component.styling.MenuStyle,org.jetbrains.jewel.ui.component.styling.ButtonStyle,org.jetbrains.jewel.ui.component.styling.PopupContainerStyle,org.jetbrains.jewel.ui.component.styling.SplitButtonStyle,org.jetbrains.jewel.ui.component.styling.RadioButtonStyle,org.jetbrains.jewel.ui.component.styling.ScrollbarStyle,org.jetbrains.jewel.ui.component.styling.SegmentedControlButtonStyle,org.jetbrains.jewel.ui.component.styling.SegmentedControlStyle,org.jetbrains.jewel.ui.component.styling.SelectableLazyColumnStyle,org.jetbrains.jewel.ui.component.styling.SimpleListItemStyle,org.jetbrains.jewel.ui.component.styling.SliderStyle,org.jetbrains.jewel.ui.component.styling.TextAreaStyle,org.jetbrains.jewel.ui.component.styling.TextFieldStyle,org.jetbrains.jewel.ui.component.styling.TooltipStyle,org.jetbrains.jewel.ui.component.styling.DropdownStyle):V - equals(java.lang.Object):Z - f:getCheckboxStyle():org.jetbrains.jewel.ui.component.styling.CheckboxStyle - f:getChipStyle():org.jetbrains.jewel.ui.component.styling.ChipStyle @@ -21,6 +21,7 @@ f:org.jetbrains.jewel.ui.DefaultComponentStyling - f:getDefaultBannerStyle():org.jetbrains.jewel.ui.component.styling.DefaultBannerStyles - f:getDefaultButtonStyle():org.jetbrains.jewel.ui.component.styling.ButtonStyle - f:getDefaultDropdownStyle():org.jetbrains.jewel.ui.component.styling.DropdownStyle +- f:getDefaultSplitButtonStyle():org.jetbrains.jewel.ui.component.styling.SplitButtonStyle - f:getDefaultTabStyle():org.jetbrains.jewel.ui.component.styling.TabStyle - f:getDividerStyle():org.jetbrains.jewel.ui.component.styling.DividerStyle - f:getEditorTabStyle():org.jetbrains.jewel.ui.component.styling.TabStyle @@ -32,6 +33,7 @@ f:org.jetbrains.jewel.ui.DefaultComponentStyling - f:getLinkStyle():org.jetbrains.jewel.ui.component.styling.LinkStyle - f:getMenuStyle():org.jetbrains.jewel.ui.component.styling.MenuStyle - f:getOutlinedButtonStyle():org.jetbrains.jewel.ui.component.styling.ButtonStyle +- f:getOutlinedSplitButtonStyle():org.jetbrains.jewel.ui.component.styling.SplitButtonStyle - f:getPopupContainerStyle():org.jetbrains.jewel.ui.component.styling.PopupContainerStyle - f:getRadioButtonStyle():org.jetbrains.jewel.ui.component.styling.RadioButtonStyle - f:getScrollbarStyle():org.jetbrains.jewel.ui.component.styling.ScrollbarStyle @@ -79,8 +81,12 @@ f:org.jetbrains.jewel.ui.component.BannerKt - sf:SuccessDefaultBanner(java.lang.String,androidx.compose.ui.Modifier,kotlin.jvm.functions.Function2,kotlin.jvm.functions.Function3,org.jetbrains.jewel.ui.component.styling.DefaultBannerStyle,androidx.compose.ui.text.TextStyle,androidx.compose.runtime.Composer,I,I):V - sf:WarningDefaultBanner(java.lang.String,androidx.compose.ui.Modifier,kotlin.jvm.functions.Function2,kotlin.jvm.functions.Function3,org.jetbrains.jewel.ui.component.styling.DefaultBannerStyle,androidx.compose.ui.text.TextStyle,androidx.compose.runtime.Composer,I,I):V f:org.jetbrains.jewel.ui.component.ButtonKt -- sf:DefaultButton(kotlin.jvm.functions.Function0,androidx.compose.ui.Modifier,Z,androidx.compose.foundation.interaction.MutableInteractionSource,org.jetbrains.jewel.ui.component.styling.ButtonStyle,androidx.compose.ui.text.TextStyle,kotlin.jvm.functions.Function3,androidx.compose.runtime.Composer,I,I):V -- sf:OutlinedButton(kotlin.jvm.functions.Function0,androidx.compose.ui.Modifier,Z,androidx.compose.foundation.interaction.MutableInteractionSource,org.jetbrains.jewel.ui.component.styling.ButtonStyle,androidx.compose.ui.text.TextStyle,kotlin.jvm.functions.Function3,androidx.compose.runtime.Composer,I,I):V +- sf:DefaultButton(kotlin.jvm.functions.Function0,androidx.compose.ui.Modifier,Z,androidx.compose.foundation.interaction.MutableInteractionSource,org.jetbrains.jewel.ui.component.styling.ButtonStyle,androidx.compose.ui.text.TextStyle,kotlin.jvm.functions.Function2,androidx.compose.runtime.Composer,I,I):V +- sf:DefaultSplitButton(kotlin.jvm.functions.Function0,kotlin.jvm.functions.Function0,androidx.compose.ui.Modifier,Z,androidx.compose.foundation.interaction.MutableInteractionSource,org.jetbrains.jewel.ui.component.styling.SplitButtonStyle,androidx.compose.ui.text.TextStyle,org.jetbrains.jewel.ui.component.styling.MenuStyle,kotlin.jvm.functions.Function2,kotlin.jvm.functions.Function1,androidx.compose.runtime.Composer,I,I):V +- sf:DefaultSplitButton(kotlin.jvm.functions.Function0,kotlin.jvm.functions.Function0,androidx.compose.ui.Modifier,Z,androidx.compose.foundation.interaction.MutableInteractionSource,org.jetbrains.jewel.ui.component.styling.SplitButtonStyle,androidx.compose.ui.text.TextStyle,org.jetbrains.jewel.ui.component.styling.MenuStyle,kotlin.jvm.functions.Function2,kotlin.jvm.functions.Function2,androidx.compose.runtime.Composer,I,I):V +- sf:OutlinedButton(kotlin.jvm.functions.Function0,androidx.compose.ui.Modifier,Z,androidx.compose.foundation.interaction.MutableInteractionSource,org.jetbrains.jewel.ui.component.styling.ButtonStyle,androidx.compose.ui.text.TextStyle,kotlin.jvm.functions.Function2,androidx.compose.runtime.Composer,I,I):V +- sf:OutlinedSplitButton(kotlin.jvm.functions.Function0,kotlin.jvm.functions.Function0,androidx.compose.ui.Modifier,Z,androidx.compose.foundation.interaction.MutableInteractionSource,org.jetbrains.jewel.ui.component.styling.SplitButtonStyle,androidx.compose.ui.text.TextStyle,org.jetbrains.jewel.ui.component.styling.MenuStyle,kotlin.jvm.functions.Function2,kotlin.jvm.functions.Function1,androidx.compose.runtime.Composer,I,I):V +- sf:OutlinedSplitButton(kotlin.jvm.functions.Function0,kotlin.jvm.functions.Function0,androidx.compose.ui.Modifier,Z,androidx.compose.foundation.interaction.MutableInteractionSource,org.jetbrains.jewel.ui.component.styling.SplitButtonStyle,androidx.compose.ui.text.TextStyle,org.jetbrains.jewel.ui.component.styling.MenuStyle,kotlin.jvm.functions.Function2,kotlin.jvm.functions.Function2,androidx.compose.runtime.Composer,I,I):V f:org.jetbrains.jewel.ui.component.ButtonState - org.jetbrains.jewel.foundation.state.FocusableComponentState - sf:Companion:org.jetbrains.jewel.ui.component.ButtonState$Companion @@ -1848,6 +1854,36 @@ f:org.jetbrains.jewel.ui.component.styling.SliderStyle f:org.jetbrains.jewel.ui.component.styling.SliderStyle$Companion f:org.jetbrains.jewel.ui.component.styling.SliderStylingKt - sf:getLocalSliderStyle():androidx.compose.runtime.ProvidableCompositionLocal +f:org.jetbrains.jewel.ui.component.styling.SplitButtonColors +- sf:$stable:I +- sf:Companion:org.jetbrains.jewel.ui.component.styling.SplitButtonColors$Companion +- equals(java.lang.Object):Z +- f:getChevronColor-0d7_KjU():J +- f:getDividerColor-0d7_KjU():J +- f:getDividerDisabledColor-0d7_KjU():J +- hashCode():I +f:org.jetbrains.jewel.ui.component.styling.SplitButtonColors$Companion +f:org.jetbrains.jewel.ui.component.styling.SplitButtonMetrics +- sf:$stable:I +- sf:Companion:org.jetbrains.jewel.ui.component.styling.SplitButtonMetrics$Companion +- equals(java.lang.Object):Z +- f:getDividerMetrics():org.jetbrains.jewel.ui.component.styling.DividerMetrics +- f:getDividerPadding-D9Ej5fM():F +- hashCode():I +f:org.jetbrains.jewel.ui.component.styling.SplitButtonMetrics$Companion +f:org.jetbrains.jewel.ui.component.styling.SplitButtonStyle +- sf:$stable:I +- sf:Companion:org.jetbrains.jewel.ui.component.styling.SplitButtonStyle$Companion +- (org.jetbrains.jewel.ui.component.styling.ButtonStyle,org.jetbrains.jewel.ui.component.styling.SplitButtonColors,org.jetbrains.jewel.ui.component.styling.SplitButtonMetrics):V +- equals(java.lang.Object):Z +- f:getButton():org.jetbrains.jewel.ui.component.styling.ButtonStyle +- f:getColors():org.jetbrains.jewel.ui.component.styling.SplitButtonColors +- f:getMetrics():org.jetbrains.jewel.ui.component.styling.SplitButtonMetrics +- hashCode():I +f:org.jetbrains.jewel.ui.component.styling.SplitButtonStyle$Companion +f:org.jetbrains.jewel.ui.component.styling.SplitButtonStylingKt +- sf:getLocalDefaultSplitButtonStyle():androidx.compose.runtime.ProvidableCompositionLocal +- sf:getLocalOutlinedSplitButtonStyle():androidx.compose.runtime.ProvidableCompositionLocal f:org.jetbrains.jewel.ui.component.styling.SubmenuMetrics - sf:$stable:I - sf:Companion:org.jetbrains.jewel.ui.component.styling.SubmenuMetrics$Companion @@ -3710,6 +3746,7 @@ f:org.jetbrains.jewel.ui.theme.JewelThemeKt - sf:getComboBoxStyle(org.jetbrains.jewel.foundation.theme.JewelTheme$Companion,androidx.compose.runtime.Composer,I):org.jetbrains.jewel.ui.component.styling.ComboBoxStyle - sf:getDefaultBannerStyle(org.jetbrains.jewel.foundation.theme.JewelTheme$Companion,androidx.compose.runtime.Composer,I):org.jetbrains.jewel.ui.component.styling.DefaultBannerStyles - sf:getDefaultButtonStyle(org.jetbrains.jewel.foundation.theme.JewelTheme$Companion,androidx.compose.runtime.Composer,I):org.jetbrains.jewel.ui.component.styling.ButtonStyle +- sf:getDefaultSplitButtonStyle(org.jetbrains.jewel.foundation.theme.JewelTheme$Companion,androidx.compose.runtime.Composer,I):org.jetbrains.jewel.ui.component.styling.SplitButtonStyle - sf:getDefaultTabStyle(org.jetbrains.jewel.foundation.theme.JewelTheme$Companion,androidx.compose.runtime.Composer,I):org.jetbrains.jewel.ui.component.styling.TabStyle - sf:getDividerStyle(org.jetbrains.jewel.foundation.theme.JewelTheme$Companion,androidx.compose.runtime.Composer,I):org.jetbrains.jewel.ui.component.styling.DividerStyle - sf:getDropdownStyle(org.jetbrains.jewel.foundation.theme.JewelTheme$Companion,androidx.compose.runtime.Composer,I):org.jetbrains.jewel.ui.component.styling.DropdownStyle @@ -3722,6 +3759,7 @@ f:org.jetbrains.jewel.ui.theme.JewelThemeKt - sf:getLinkStyle(org.jetbrains.jewel.foundation.theme.JewelTheme$Companion,androidx.compose.runtime.Composer,I):org.jetbrains.jewel.ui.component.styling.LinkStyle - sf:getMenuStyle(org.jetbrains.jewel.foundation.theme.JewelTheme$Companion,androidx.compose.runtime.Composer,I):org.jetbrains.jewel.ui.component.styling.MenuStyle - sf:getOutlinedButtonStyle(org.jetbrains.jewel.foundation.theme.JewelTheme$Companion,androidx.compose.runtime.Composer,I):org.jetbrains.jewel.ui.component.styling.ButtonStyle +- sf:getOutlinedSplitButtonStyle(org.jetbrains.jewel.foundation.theme.JewelTheme$Companion,androidx.compose.runtime.Composer,I):org.jetbrains.jewel.ui.component.styling.SplitButtonStyle - sf:getPopupContainerStyle(org.jetbrains.jewel.foundation.theme.JewelTheme$Companion,androidx.compose.runtime.Composer,I):org.jetbrains.jewel.ui.component.styling.PopupContainerStyle - sf:getRadioButtonStyle(org.jetbrains.jewel.foundation.theme.JewelTheme$Companion,androidx.compose.runtime.Composer,I):org.jetbrains.jewel.ui.component.styling.RadioButtonStyle - sf:getScrollbarStyle(org.jetbrains.jewel.foundation.theme.JewelTheme$Companion,androidx.compose.runtime.Composer,I):org.jetbrains.jewel.ui.component.styling.ScrollbarStyle diff --git a/platform/jewel/ui/api/ui.api b/platform/jewel/ui/api/ui.api index c0cae818dd0b..5b66ac3c4e49 100644 --- a/platform/jewel/ui/api/ui.api +++ b/platform/jewel/ui/api/ui.api @@ -25,7 +25,7 @@ public final class org/jetbrains/jewel/ui/ComponentStyling$DefaultImpls { public final class org/jetbrains/jewel/ui/DefaultComponentStyling : org/jetbrains/jewel/ui/ComponentStyling { public static final field $stable I - public fun (Lorg/jetbrains/jewel/ui/component/styling/CheckboxStyle;Lorg/jetbrains/jewel/ui/component/styling/ChipStyle;Lorg/jetbrains/jewel/ui/component/styling/CircularProgressStyle;Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyles;Lorg/jetbrains/jewel/ui/component/styling/ComboBoxStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/DividerStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderStyle;Lorg/jetbrains/jewel/ui/component/styling/HorizontalProgressBarStyle;Lorg/jetbrains/jewel/ui/component/styling/IconButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyles;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle;Lorg/jetbrains/jewel/ui/component/styling/LinkStyle;Lorg/jetbrains/jewel/ui/component/styling/MenuStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/PopupContainerStyle;Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;Lorg/jetbrains/jewel/ui/component/styling/SegmentedControlButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/SegmentedControlStyle;Lorg/jetbrains/jewel/ui/component/styling/SelectableLazyColumnStyle;Lorg/jetbrains/jewel/ui/component/styling/SimpleListItemStyle;Lorg/jetbrains/jewel/ui/component/styling/SliderStyle;Lorg/jetbrains/jewel/ui/component/styling/TextAreaStyle;Lorg/jetbrains/jewel/ui/component/styling/TextFieldStyle;Lorg/jetbrains/jewel/ui/component/styling/TooltipStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;)V + public fun (Lorg/jetbrains/jewel/ui/component/styling/CheckboxStyle;Lorg/jetbrains/jewel/ui/component/styling/ChipStyle;Lorg/jetbrains/jewel/ui/component/styling/CircularProgressStyle;Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyles;Lorg/jetbrains/jewel/ui/component/styling/ComboBoxStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/DividerStyle;Lorg/jetbrains/jewel/ui/component/styling/TabStyle;Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderStyle;Lorg/jetbrains/jewel/ui/component/styling/HorizontalProgressBarStyle;Lorg/jetbrains/jewel/ui/component/styling/IconButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyles;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle;Lorg/jetbrains/jewel/ui/component/styling/LinkStyle;Lorg/jetbrains/jewel/ui/component/styling/MenuStyle;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/PopupContainerStyle;Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;Lorg/jetbrains/jewel/ui/component/styling/SegmentedControlButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/SegmentedControlStyle;Lorg/jetbrains/jewel/ui/component/styling/SelectableLazyColumnStyle;Lorg/jetbrains/jewel/ui/component/styling/SimpleListItemStyle;Lorg/jetbrains/jewel/ui/component/styling/SliderStyle;Lorg/jetbrains/jewel/ui/component/styling/TextAreaStyle;Lorg/jetbrains/jewel/ui/component/styling/TextFieldStyle;Lorg/jetbrains/jewel/ui/component/styling/TooltipStyle;Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle;)V public fun equals (Ljava/lang/Object;)Z public final fun getCheckboxStyle ()Lorg/jetbrains/jewel/ui/component/styling/CheckboxStyle; public final fun getChipStyle ()Lorg/jetbrains/jewel/ui/component/styling/ChipStyle; @@ -34,6 +34,7 @@ public final class org/jetbrains/jewel/ui/DefaultComponentStyling : org/jetbrain public final fun getDefaultBannerStyle ()Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyles; public final fun getDefaultButtonStyle ()Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle; public final fun getDefaultDropdownStyle ()Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle; + public final fun getDefaultSplitButtonStyle ()Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle; public final fun getDefaultTabStyle ()Lorg/jetbrains/jewel/ui/component/styling/TabStyle; public final fun getDividerStyle ()Lorg/jetbrains/jewel/ui/component/styling/DividerStyle; public final fun getEditorTabStyle ()Lorg/jetbrains/jewel/ui/component/styling/TabStyle; @@ -45,6 +46,7 @@ public final class org/jetbrains/jewel/ui/DefaultComponentStyling : org/jetbrain public final fun getLinkStyle ()Lorg/jetbrains/jewel/ui/component/styling/LinkStyle; public final fun getMenuStyle ()Lorg/jetbrains/jewel/ui/component/styling/MenuStyle; public final fun getOutlinedButtonStyle ()Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle; + public final fun getOutlinedSplitButtonStyle ()Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle; public final fun getPopupContainerStyle ()Lorg/jetbrains/jewel/ui/component/styling/PopupContainerStyle; public final fun getRadioButtonStyle ()Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle; public final fun getScrollbarStyle ()Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle; @@ -111,8 +113,12 @@ public final class org/jetbrains/jewel/ui/component/BannerKt { } public final class org/jetbrains/jewel/ui/component/ButtonKt { - public static final fun DefaultButton (Lkotlin/jvm/functions/Function0;Landroidx/compose/ui/Modifier;ZLandroidx/compose/foundation/interaction/MutableInteractionSource;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Landroidx/compose/ui/text/TextStyle;Lkotlin/jvm/functions/Function3;Landroidx/compose/runtime/Composer;II)V - public static final fun OutlinedButton (Lkotlin/jvm/functions/Function0;Landroidx/compose/ui/Modifier;ZLandroidx/compose/foundation/interaction/MutableInteractionSource;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Landroidx/compose/ui/text/TextStyle;Lkotlin/jvm/functions/Function3;Landroidx/compose/runtime/Composer;II)V + public static final fun DefaultButton (Lkotlin/jvm/functions/Function0;Landroidx/compose/ui/Modifier;ZLandroidx/compose/foundation/interaction/MutableInteractionSource;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Landroidx/compose/ui/text/TextStyle;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V + public static final fun DefaultSplitButton (Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Landroidx/compose/ui/Modifier;ZLandroidx/compose/foundation/interaction/MutableInteractionSource;Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle;Landroidx/compose/ui/text/TextStyle;Lorg/jetbrains/jewel/ui/component/styling/MenuStyle;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;II)V + public static final fun DefaultSplitButton (Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Landroidx/compose/ui/Modifier;ZLandroidx/compose/foundation/interaction/MutableInteractionSource;Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle;Landroidx/compose/ui/text/TextStyle;Lorg/jetbrains/jewel/ui/component/styling/MenuStyle;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V + public static final fun OutlinedButton (Lkotlin/jvm/functions/Function0;Landroidx/compose/ui/Modifier;ZLandroidx/compose/foundation/interaction/MutableInteractionSource;Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Landroidx/compose/ui/text/TextStyle;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V + public static final fun OutlinedSplitButton (Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Landroidx/compose/ui/Modifier;ZLandroidx/compose/foundation/interaction/MutableInteractionSource;Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle;Landroidx/compose/ui/text/TextStyle;Lorg/jetbrains/jewel/ui/component/styling/MenuStyle;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;Landroidx/compose/runtime/Composer;II)V + public static final fun OutlinedSplitButton (Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Landroidx/compose/ui/Modifier;ZLandroidx/compose/foundation/interaction/MutableInteractionSource;Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle;Landroidx/compose/ui/text/TextStyle;Lorg/jetbrains/jewel/ui/component/styling/MenuStyle;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V } public final class org/jetbrains/jewel/ui/component/ButtonState : org/jetbrains/jewel/foundation/state/FocusableComponentState { @@ -2575,6 +2581,55 @@ public final class org/jetbrains/jewel/ui/component/styling/SliderStylingKt { public static final fun getLocalSliderStyle ()Landroidx/compose/runtime/ProvidableCompositionLocal; } +public final class org/jetbrains/jewel/ui/component/styling/SplitButtonColors { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/SplitButtonColors$Companion; + public synthetic fun (JJJLkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getChevronColor-0d7_KjU ()J + public final fun getDividerColor-0d7_KjU ()J + public final fun getDividerDisabledColor-0d7_KjU ()J + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class org/jetbrains/jewel/ui/component/styling/SplitButtonColors$Companion { +} + +public final class org/jetbrains/jewel/ui/component/styling/SplitButtonMetrics { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/SplitButtonMetrics$Companion; + public synthetic fun (Lorg/jetbrains/jewel/ui/component/styling/DividerMetrics;FLkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getDividerMetrics ()Lorg/jetbrains/jewel/ui/component/styling/DividerMetrics; + public final fun getDividerPadding-D9Ej5fM ()F + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class org/jetbrains/jewel/ui/component/styling/SplitButtonMetrics$Companion { +} + +public final class org/jetbrains/jewel/ui/component/styling/SplitButtonStyle { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle$Companion; + public fun (Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/SplitButtonColors;Lorg/jetbrains/jewel/ui/component/styling/SplitButtonMetrics;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getButton ()Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle; + public final fun getColors ()Lorg/jetbrains/jewel/ui/component/styling/SplitButtonColors; + public final fun getMetrics ()Lorg/jetbrains/jewel/ui/component/styling/SplitButtonMetrics; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class org/jetbrains/jewel/ui/component/styling/SplitButtonStyle$Companion { +} + +public final class org/jetbrains/jewel/ui/component/styling/SplitButtonStylingKt { + public static final fun getLocalDefaultSplitButtonStyle ()Landroidx/compose/runtime/ProvidableCompositionLocal; + public static final fun getLocalOutlinedSplitButtonStyle ()Landroidx/compose/runtime/ProvidableCompositionLocal; +} + public final class org/jetbrains/jewel/ui/component/styling/SubmenuMetrics { public static final field $stable I public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/SubmenuMetrics$Companion; @@ -4767,6 +4822,7 @@ public final class org/jetbrains/jewel/ui/theme/JewelThemeKt { public static final fun getComboBoxStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/ComboBoxStyle; public static final fun getDefaultBannerStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyles; public static final fun getDefaultButtonStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle; + public static final fun getDefaultSplitButtonStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle; public static final fun getDefaultTabStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/TabStyle; public static final fun getDividerStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/DividerStyle; public static final fun getDropdownStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle; @@ -4779,6 +4835,7 @@ public final class org/jetbrains/jewel/ui/theme/JewelThemeKt { public static final fun getLinkStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/LinkStyle; public static final fun getMenuStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/MenuStyle; public static final fun getOutlinedButtonStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/ButtonStyle; + public static final fun getOutlinedSplitButtonStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/SplitButtonStyle; public static final fun getPopupContainerStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/PopupContainerStyle; public static final fun getRadioButtonStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/RadioButtonStyle; public static final fun getScrollbarStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle; diff --git a/platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/DefaultComponentStyling.kt b/platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/DefaultComponentStyling.kt index e10c948f18c1..28f11ca9b745 100644 --- a/platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/DefaultComponentStyling.kt +++ b/platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/DefaultComponentStyling.kt @@ -27,6 +27,7 @@ import org.jetbrains.jewel.ui.component.styling.LocalDefaultBannerStyle import org.jetbrains.jewel.ui.component.styling.LocalDefaultButtonStyle import org.jetbrains.jewel.ui.component.styling.LocalDefaultComboBoxStyle import org.jetbrains.jewel.ui.component.styling.LocalDefaultDropdownStyle +import org.jetbrains.jewel.ui.component.styling.LocalDefaultSplitButtonStyle import org.jetbrains.jewel.ui.component.styling.LocalDefaultTabStyle import org.jetbrains.jewel.ui.component.styling.LocalDividerStyle import org.jetbrains.jewel.ui.component.styling.LocalEditorTabStyle @@ -38,6 +39,7 @@ import org.jetbrains.jewel.ui.component.styling.LocalLazyTreeStyle import org.jetbrains.jewel.ui.component.styling.LocalLinkStyle import org.jetbrains.jewel.ui.component.styling.LocalMenuStyle import org.jetbrains.jewel.ui.component.styling.LocalOutlinedButtonStyle +import org.jetbrains.jewel.ui.component.styling.LocalOutlinedSplitButtonStyle import org.jetbrains.jewel.ui.component.styling.LocalPopupContainerStyle import org.jetbrains.jewel.ui.component.styling.LocalRadioButtonStyle import org.jetbrains.jewel.ui.component.styling.LocalScrollbarStyle @@ -59,6 +61,7 @@ import org.jetbrains.jewel.ui.component.styling.SegmentedControlStyle import org.jetbrains.jewel.ui.component.styling.SelectableLazyColumnStyle import org.jetbrains.jewel.ui.component.styling.SimpleListItemStyle import org.jetbrains.jewel.ui.component.styling.SliderStyle +import org.jetbrains.jewel.ui.component.styling.SplitButtonStyle import org.jetbrains.jewel.ui.component.styling.TabStyle import org.jetbrains.jewel.ui.component.styling.TextAreaStyle import org.jetbrains.jewel.ui.component.styling.TextFieldStyle @@ -74,6 +77,7 @@ public class DefaultComponentStyling( public val comboBoxStyle: ComboBoxStyle, public val defaultButtonStyle: ButtonStyle, public val defaultDropdownStyle: DropdownStyle, + public val defaultSplitButtonStyle: SplitButtonStyle, public val defaultTabStyle: TabStyle, public val dividerStyle: DividerStyle, public val editorTabStyle: TabStyle, @@ -86,6 +90,7 @@ public class DefaultComponentStyling( public val menuStyle: MenuStyle, public val outlinedButtonStyle: ButtonStyle, public val popupContainerStyle: PopupContainerStyle, + public val outlinedSplitButtonStyle: SplitButtonStyle, public val radioButtonStyle: RadioButtonStyle, public val scrollbarStyle: ScrollbarStyle, public val segmentedControlButtonStyle: SegmentedControlButtonStyle, @@ -108,6 +113,7 @@ public class DefaultComponentStyling( LocalDefaultBannerStyle provides defaultBannerStyle, LocalDefaultComboBoxStyle provides comboBoxStyle, LocalDefaultButtonStyle provides defaultButtonStyle, + LocalDefaultSplitButtonStyle provides defaultSplitButtonStyle, LocalDefaultDropdownStyle provides defaultDropdownStyle, LocalDefaultTabStyle provides defaultTabStyle, LocalDividerStyle provides dividerStyle, @@ -121,6 +127,7 @@ public class DefaultComponentStyling( LocalMenuStyle provides menuStyle, LocalOutlinedButtonStyle provides outlinedButtonStyle, LocalPopupContainerStyle provides popupContainerStyle, + LocalOutlinedSplitButtonStyle provides outlinedSplitButtonStyle, LocalRadioButtonStyle provides radioButtonStyle, LocalScrollbarStyle provides scrollbarStyle, LocalSegmentedControlButtonStyle provides segmentedControlButtonStyle, diff --git a/platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Button.kt b/platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Button.kt index ea472dd61ea7..bdef14c9cc08 100644 --- a/platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Button.kt +++ b/platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Button.kt @@ -2,6 +2,7 @@ package org.jetbrains.jewel.ui.component import androidx.compose.foundation.background import androidx.compose.foundation.clickable +import androidx.compose.foundation.focusable import androidx.compose.foundation.interaction.FocusInteraction import androidx.compose.foundation.interaction.HoverInteraction import androidx.compose.foundation.interaction.MutableInteractionSource @@ -9,9 +10,13 @@ import androidx.compose.foundation.interaction.PressInteraction import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.defaultMinSize +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.onClick import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider @@ -23,9 +28,22 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.focus.FocusRequester +import androidx.compose.ui.focus.focusProperties +import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.focus.onFocusChanged import androidx.compose.ui.graphics.takeOrElse +import androidx.compose.ui.input.key.Key +import androidx.compose.ui.input.key.KeyEventType +import androidx.compose.ui.input.key.key +import androidx.compose.ui.input.key.onPreviewKeyEvent +import androidx.compose.ui.input.key.type +import androidx.compose.ui.layout.onSizeChanged +import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.semantics.Role import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.unit.Dp +import kotlinx.coroutines.flow.collect import org.jetbrains.jewel.foundation.Stroke import org.jetbrains.jewel.foundation.modifier.border import org.jetbrains.jewel.foundation.state.CommonStateBitMask.Active @@ -37,11 +55,43 @@ import org.jetbrains.jewel.foundation.state.FocusableComponentState import org.jetbrains.jewel.foundation.theme.JewelTheme import org.jetbrains.jewel.foundation.theme.LocalContentColor import org.jetbrains.jewel.foundation.theme.LocalTextStyle +import org.jetbrains.jewel.ui.Orientation import org.jetbrains.jewel.ui.component.styling.ButtonStyle +import org.jetbrains.jewel.ui.component.styling.MenuStyle +import org.jetbrains.jewel.ui.component.styling.SplitButtonStyle import org.jetbrains.jewel.ui.focusOutline +import org.jetbrains.jewel.ui.icons.AllIconsKeys +import org.jetbrains.jewel.ui.painter.hints.Stroke as PainterHintStroke import org.jetbrains.jewel.ui.theme.defaultButtonStyle +import org.jetbrains.jewel.ui.theme.defaultSplitButtonStyle +import org.jetbrains.jewel.ui.theme.menuStyle import org.jetbrains.jewel.ui.theme.outlinedButtonStyle +import org.jetbrains.jewel.ui.theme.outlinedSplitButtonStyle +import org.jetbrains.jewel.ui.util.thenIf +/** + * A button that follows the default visual styling with customizable content and behavior. + * + * Provides a clickable component that follows the standard button interactions including hover, press, and focus + * states. The button adapts its appearance based on the enabled/disabled state and supports custom styling. + * + * **Guidelines:** [on IJP SDK webhelp](https://plugins.jetbrains.com/docs/intellij/button.html) + * + * **Usage example:** + * [`Buttons.kt`](https://github.com/JetBrains/intellij-community/blob/master/platform/jewel/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Buttons.kt) + * + * **Swing equivalent:** [`JButton`](https://docs.oracle.com/javase/tutorial/uiswing/components/button.html) + * + * @param onClick Will be called when the user clicks the button + * @param modifier Modifier to be applied to the button + * @param enabled Controls the enabled state of the button. When false, the button will not be clickable + * @param interactionSource An optional [MutableInteractionSource] for observing and emitting [Interaction]s for this + * button. Use this to observe state changes or customize interaction handling + * @param style The visual styling configuration for the button including colors, metrics and layout parameters + * @param textStyle The typography style to be applied to the button's text content + * @param content The content to be displayed inside the button + * @see javax.swing.JButton + */ @Composable public fun DefaultButton( onClick: () -> Unit, @@ -50,12 +100,14 @@ public fun DefaultButton( interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, style: ButtonStyle = JewelTheme.defaultButtonStyle, textStyle: TextStyle = JewelTheme.defaultTextStyle, - content: @Composable RowScope.() -> Unit, + content: @Composable () -> Unit, ) { ButtonImpl( onClick = onClick, modifier = modifier, enabled = enabled, + forceFocused = false, + onStateChange = {}, interactionSource = interactionSource, style = style, textStyle = textStyle, @@ -63,6 +115,29 @@ public fun DefaultButton( ) } +/** + * A button with an outlined visual style and customizable appearance. + * + * Similar to [DefaultButton] but with a different visual treatment that emphasizes the button boundary. Useful for + * secondary actions or when you want to reduce visual weight. + * + * **Guidelines:** [on IJP SDK webhelp](https://plugins.jetbrains.com/docs/intellij/button.html) + * + * **Usage example:** + * [`Buttons.kt`](https://github.com/JetBrains/intellij-community/blob/master/platform/jewel/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Buttons.kt) + * + * **Swing equivalent:** [`JButton`](https://docs.oracle.com/javase/tutorial/uiswing/components/button.html) + * + * @param onClick Will be called when the user clicks the button + * @param modifier Modifier to be applied to the button + * @param enabled Controls the enabled state of the button. When false, the button will not be clickable + * @param interactionSource An optional [MutableInteractionSource] for observing and emitting [Interaction]s for this + * button. Use this to observe state changes or customize interaction handling + * @param style The visual styling configuration for the button including colors, metrics and layout parameters + * @param textStyle The typography style to be applied to the button's text content + * @param content The content to be displayed inside the button + * @see javax.swing.JButton + */ @Composable public fun OutlinedButton( onClick: () -> Unit, @@ -71,12 +146,14 @@ public fun OutlinedButton( interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, style: ButtonStyle = JewelTheme.outlinedButtonStyle, textStyle: TextStyle = JewelTheme.defaultTextStyle, - content: @Composable RowScope.() -> Unit, + content: @Composable () -> Unit, ) { ButtonImpl( onClick = onClick, modifier = modifier, enabled = enabled, + forceFocused = false, + onStateChange = {}, interactionSource = interactionSource, style = style, textStyle = textStyle, @@ -84,32 +161,405 @@ public fun OutlinedButton( ) } +/** + * A split button combining a primary action with a dropdown menu, using an outlined visual style. + * + * Similar to [DefaultSplitButton] but with an outlined visual treatment. Provides two interactive areas: the main + * button area for the primary action and a chevron section that opens a dropdown menu. + * + * **Guidelines:** [on IJP SDK webhelp](https://plugins.jetbrains.com/docs/intellij/split-button.html) + * + * **Usage example:** + * [`Buttons.kt`](https://github.com/JetBrains/intellij-community/blob/master/platform/jewel/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Buttons.kt) + * + * **Swing equivalent:** + * [`JBOptionButton`](https://github.com/JetBrains/intellij-community/tree/idea/243.22562.145/platform/platform-api/src/com/intellij/ui/components/JBOptionButton.kt) + * + * @param onClick Will be called when the user clicks the main button area + * @param secondaryOnClick Will be called when the user clicks the dropdown/chevron section + * @param modifier Modifier to be applied to the button + * @param enabled Controls the enabled state of the button. When false, the button will not be clickable + * @param interactionSource An optional [MutableInteractionSource] for observing and emitting [Interaction]s for this + * button + * @param style The visual styling configuration for the split button including colors, metrics and layout parameters + * @param textStyle The typography style to be applied to the button's text content + * @param menuStyle The visual styling configuration for the dropdown menu + * @param content The content to be displayed in the main button area + * @param menuContent The content builder for defining menu items in the dropdown + * @see com.intellij.ui.components.JBOptionButton + */ +@Composable +public fun OutlinedSplitButton( + onClick: () -> Unit, + secondaryOnClick: () -> Unit, + modifier: Modifier = Modifier, + enabled: Boolean = true, + interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, + style: SplitButtonStyle = JewelTheme.outlinedSplitButtonStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, + menuStyle: MenuStyle = JewelTheme.menuStyle, + content: @Composable () -> Unit, + menuContent: MenuScope.() -> Unit, +) { + SplitButtonImpl( + onClick = onClick, + secondaryOnClick = secondaryOnClick, + modifier = modifier, + enabled = enabled, + interactionSource = interactionSource, + style = style, + textStyle = textStyle, + menuStyle = menuStyle, + isDefault = false, + content = content, + secondaryContentMenu = menuContent, + ) +} + +/** + * A split button combining a primary action with a dropdown menu, using an outlined visual style. + * + * Similar to [DefaultSplitButton] but with an outlined visual treatment. Provides two interactive areas: the main + * button area for the primary action and a chevron section that opens a dropdown menu. + * + * **Guidelines:** [on IJP SDK webhelp](https://plugins.jetbrains.com/docs/intellij/split-button.html) + * + * **Usage example:** + * [`Buttons.kt`](https://github.com/JetBrains/intellij-community/blob/master/platform/jewel/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Buttons.kt) + * + * **Swing equivalent:** + * [`JBOptionButton`](https://github.com/JetBrains/intellij-community/tree/idea/243.22562.145/platform/platform-api/src/com/intellij/ui/components/JBOptionButton.kt) + * + * @param onClick Will be called when the user clicks the main button area + * @param secondaryOnClick Will be called when the user clicks the dropdown/chevron section + * @param modifier Modifier to be applied to the button + * @param enabled Controls the enabled state of the button. When false, the button will not be clickable + * @param interactionSource An optional [MutableInteractionSource] for observing and emitting [Interaction]s for this + * button + * @param style The visual styling configuration for the split button including colors, metrics and layout parameters + * @param textStyle The typography style to be applied to the button's text content + * @param menuStyle The visual styling configuration for the dropdown menu + * @param content The content to be displayed in the main button area + * @param popupContainer A generic container for the popup content + * @see com.intellij.ui.components.JBOptionButton + */ +@Composable +public fun OutlinedSplitButton( + onClick: () -> Unit, + secondaryOnClick: () -> Unit, + modifier: Modifier = Modifier, + enabled: Boolean = true, + interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, + style: SplitButtonStyle = JewelTheme.outlinedSplitButtonStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, + menuStyle: MenuStyle = JewelTheme.menuStyle, + content: @Composable () -> Unit, + popupContainer: @Composable () -> Unit, +) { + SplitButtonImpl( + onClick = onClick, + secondaryOnClick = secondaryOnClick, + modifier = modifier, + enabled = enabled, + interactionSource = interactionSource, + style = style, + textStyle = textStyle, + menuStyle = menuStyle, + isDefault = false, + content = content, + secondaryContent = popupContainer, + ) +} + +/** + * A split button combining a primary action with a dropdown menu, using the default visual style. + * + * Provides two interactive areas: the main button area for the primary action and a chevron section that opens a + * dropdown menu with additional options. + * + * **Guidelines:** [on IJP SDK webhelp](https://plugins.jetbrains.com/docs/intellij/split-button.html) + * + * **Usage example:** + * [`Buttons.kt`](https://github.com/JetBrains/intellij-community/blob/master/platform/jewel/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Buttons.kt) + * + * **Swing equivalent:** + * [`JBOptionButton`](https://github.com/JetBrains/intellij-community/tree/idea/243.22562.145/platform/platform-api/src/com/intellij/ui/components/JBOptionButton.kt) + * + * @param onClick Will be called when the user clicks the main button area + * @param secondaryOnClick Will be called when the user clicks the dropdown/chevron section + * @param modifier Modifier to be applied to the button + * @param enabled Controls the enabled state of the button. When false, the button will not be clickable + * @param interactionSource An optional [MutableInteractionSource] for observing and emitting [Interaction]s for this + * button + * @param style The visual styling configuration for the split button including colors, metrics and layout parameters + * @param textStyle The typography style to be applied to the button's text content + * @param menuStyle The visual styling configuration for the dropdown menu + * @param content The content to be displayed in the main button area + * @param menuContent The content builder for defining menu items in the dropdown + * @see com.intellij.ui.components.JBOptionButton + */ +@Composable +public fun DefaultSplitButton( + onClick: () -> Unit, + secondaryOnClick: () -> Unit, + modifier: Modifier = Modifier, + enabled: Boolean = true, + interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, + style: SplitButtonStyle = JewelTheme.defaultSplitButtonStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, + menuStyle: MenuStyle = JewelTheme.menuStyle, + content: @Composable () -> Unit, + menuContent: MenuScope.() -> Unit, +) { + SplitButtonImpl( + onClick = onClick, + secondaryOnClick = secondaryOnClick, + modifier = modifier, + enabled = enabled, + interactionSource = interactionSource, + style = style, + textStyle = textStyle, + menuStyle = menuStyle, + isDefault = true, + content = content, + secondaryContentMenu = menuContent, + ) +} + +/** + * A split button combining a primary action with a dropdown menu, using the default visual style. + * + * Provides two interactive areas: the main button area for the primary action and a chevron section that opens a + * dropdown menu with additional options. + * + * **Guidelines:** [on IJP SDK webhelp](https://plugins.jetbrains.com/docs/intellij/split-button.html) + * + * **Usage example:** + * [`Buttons.kt`](https://github.com/JetBrains/intellij-community/blob/master/platform/jewel/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Buttons.kt) + * + * **Swing equivalent:** + * [`JBOptionButton`](https://github.com/JetBrains/intellij-community/tree/idea/243.22562.145/platform/platform-api/src/com/intellij/ui/components/JBOptionButton.kt) + * + * @param onClick Will be called when the user clicks the main button area + * @param secondaryOnClick Will be called when the user clicks the dropdown/chevron section + * @param modifier Modifier to be applied to the button + * @param enabled Controls the enabled state of the button. When false, the button will not be clickable + * @param interactionSource An optional [MutableInteractionSource] for observing and emitting [Interaction]s for this + * button + * @param style The visual styling configuration for the split button including colors, metrics and layout parameters + * @param textStyle The typography style to be applied to the button's text content + * @param menuStyle The visual styling configuration for the dropdown menu + * @param content The content to be displayed in the main button area + * @param popupContainer A generic container for the popup content + * @see com.intellij.ui.components.JBOptionButton + */ +@Composable +public fun DefaultSplitButton( + onClick: () -> Unit, + secondaryOnClick: () -> Unit, + modifier: Modifier = Modifier, + enabled: Boolean = true, + interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, + style: SplitButtonStyle = JewelTheme.defaultSplitButtonStyle, + textStyle: TextStyle = JewelTheme.defaultTextStyle, + menuStyle: MenuStyle = JewelTheme.menuStyle, + content: @Composable () -> Unit, + popupContainer: @Composable () -> Unit, +) { + SplitButtonImpl( + onClick = onClick, + secondaryOnClick = secondaryOnClick, + modifier = modifier, + enabled = enabled, + interactionSource = interactionSource, + style = style, + textStyle = textStyle, + menuStyle = menuStyle, + isDefault = true, + content = content, + secondaryContent = popupContainer, + ) +} + +@Composable +private fun SplitButtonImpl( + onClick: () -> Unit, + secondaryOnClick: () -> Unit, + modifier: Modifier, + enabled: Boolean, + interactionSource: MutableInteractionSource, + style: SplitButtonStyle, + textStyle: TextStyle, + menuStyle: MenuStyle, + isDefault: Boolean, + content: @Composable () -> Unit, + secondaryContent: @Composable (() -> Unit)? = null, + secondaryContentMenu: (MenuScope.() -> Unit)? = null, +) { + val density = LocalDensity.current + var popupVisible by remember { mutableStateOf(false) } + + var buttonWidth by remember { mutableStateOf(Dp.Unspecified) } + var buttonState by remember(interactionSource) { mutableStateOf(ButtonState.of(enabled = enabled)) } + val focusRequester = remember { FocusRequester() } + + Box( + modifier + .onSizeChanged { buttonWidth = with(density) { it.width.toDp() } } + .onFocusChanged { + if (!it.isFocused) { + popupVisible = false + } + } + .thenIf(enabled) { + onPreviewKeyEvent { keyEvent -> + if (keyEvent.type != KeyEventType.KeyDown) return@onPreviewKeyEvent false + when { + keyEvent.key == Key.DirectionDown -> { + popupVisible = true + true + } + + else -> false + } + } + } + ) { + ButtonImpl( + onClick = { if (enabled) onClick() }, + modifier = Modifier.focusRequester(focusRequester), + enabled = enabled, + forceFocused = popupVisible, + onStateChange = { state -> buttonState = state }, + interactionSource = interactionSource, + style = style.button, + textStyle = textStyle, + content = content, + secondaryContent = { + SplitButtonChevron( + style = style, + enabled = enabled, + isDefault = isDefault, + onChevronClicked = { + secondaryOnClick() + popupVisible = !popupVisible + if (!buttonState.isFocused) focusRequester.requestFocus() + }, + ) + }, + ) + + if (popupVisible && enabled) { + if (secondaryContentMenu != null) { + PopupMenu( + modifier = Modifier.width(buttonWidth).onClick { popupVisible = false }, + onDismissRequest = { + popupVisible = false + true + }, + horizontalAlignment = Alignment.Start, + style = menuStyle, + content = secondaryContentMenu, + ) + } + if (secondaryContent != null) { + PopupContainer( + modifier = Modifier.width(buttonWidth).onClick { popupVisible = false }, + onDismissRequest = { popupVisible = false }, + horizontalAlignment = Alignment.Start, + content = secondaryContent, + ) + } + } + } +} + +@Composable +private fun SplitButtonChevron( + style: SplitButtonStyle, + enabled: Boolean, + isDefault: Boolean, + onChevronClicked: () -> Unit, +) { + Box( + Modifier.size(style.button.metrics.minSize.height) + .focusable(false) + .focusProperties { canFocus = false } + .clickable( + enabled = enabled, + onClick = onChevronClicked, + interactionSource = remember { MutableInteractionSource() }, + indication = null, + ) + ) { + Divider( + orientation = Orientation.Vertical, + thickness = style.metrics.dividerMetrics.thickness, + modifier = + Modifier.fillMaxHeight().padding(vertical = style.metrics.dividerPadding).align(Alignment.CenterStart), + color = if (enabled) style.colors.dividerColor else style.colors.dividerDisabledColor, + ) + Icon( + key = AllIconsKeys.General.ChevronDown, + contentDescription = "Chevron", + modifier = Modifier.align(Alignment.Center), + hints = + if (isDefault && enabled) { + arrayOf(PainterHintStroke(style.colors.chevronColor)) + } else { + emptyArray() + }, + ) + } +} + @Composable private fun ButtonImpl( onClick: () -> Unit, modifier: Modifier, enabled: Boolean, + forceFocused: Boolean, + onStateChange: (ButtonState) -> Unit, interactionSource: MutableInteractionSource, style: ButtonStyle, textStyle: TextStyle, - content: @Composable (RowScope.() -> Unit), + content: @Composable () -> Unit, + secondaryContent: @Composable (() -> Unit)? = null, ) { - var buttonState by remember(interactionSource) { mutableStateOf(ButtonState.of(enabled = enabled)) } + var buttonState by + remember(interactionSource) { mutableStateOf(ButtonState.of(enabled = enabled, focused = forceFocused)) } remember(enabled) { buttonState = buttonState.copy(enabled = enabled) } + // This helps with managing and keeping the button focus state in sync + // when the Composable is used for the SplitButton variant. + // This variant is the only one that overrides the default focus state + // according to the popup visibility. + var actuallyFocused by remember { mutableStateOf(false) } + remember(forceFocused) { buttonState = buttonState.copy(focused = if (forceFocused) true else actuallyFocused) } LaunchedEffect(interactionSource) { interactionSource.interactions.collect { interaction -> - when (interaction) { - is PressInteraction.Press -> buttonState = buttonState.copy(pressed = true) - is PressInteraction.Cancel, - is PressInteraction.Release -> buttonState = buttonState.copy(pressed = false) + buttonState = + when (interaction) { + is PressInteraction.Press -> buttonState.copy(pressed = true) + is PressInteraction.Cancel, + is PressInteraction.Release -> buttonState.copy(pressed = false) - is HoverInteraction.Enter -> buttonState = buttonState.copy(hovered = true) - is HoverInteraction.Exit -> buttonState = buttonState.copy(hovered = false) - is FocusInteraction.Focus -> buttonState = buttonState.copy(focused = true) - is FocusInteraction.Unfocus -> buttonState = buttonState.copy(focused = false) - } + is HoverInteraction.Enter -> buttonState.copy(hovered = true) + is HoverInteraction.Exit -> buttonState.copy(hovered = false) + is FocusInteraction.Focus -> { + actuallyFocused = true + buttonState.copy(focused = true) + } + + is FocusInteraction.Unfocus -> { + actuallyFocused = false + buttonState.copy(focused = forceFocused) + } + + else -> buttonState + } + onStateChange(buttonState) } } @@ -144,12 +594,13 @@ private fun ButtonImpl( LocalTextStyle provides textStyle.copy(color = contentColor.takeOrElse { textStyle.color }), ) { Row( - Modifier.defaultMinSize(style.metrics.minSize.width, style.metrics.minSize.height) - .padding(style.metrics.padding), + Modifier.defaultMinSize(style.metrics.minSize.width).height(style.metrics.minSize.height), horizontalArrangement = Arrangement.Center, verticalAlignment = Alignment.CenterVertically, - content = content, - ) + ) { + Box(Modifier.padding(style.metrics.padding)) { content() } + secondaryContent?.invoke() + } } } } diff --git a/platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/SplitButtonStyling.kt b/platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/SplitButtonStyling.kt new file mode 100644 index 000000000000..fd998c307425 --- /dev/null +++ b/platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/SplitButtonStyling.kt @@ -0,0 +1,43 @@ +package org.jetbrains.jewel.ui.component.styling + +import androidx.compose.runtime.Immutable +import androidx.compose.runtime.ProvidableCompositionLocal +import androidx.compose.runtime.Stable +import androidx.compose.runtime.staticCompositionLocalOf +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.Dp +import org.jetbrains.jewel.foundation.GenerateDataFunctions + +@Stable +@GenerateDataFunctions +public class SplitButtonStyle( + public val button: ButtonStyle, + public val colors: SplitButtonColors, + public val metrics: SplitButtonMetrics, +) { + public companion object +} + +@Immutable +@GenerateDataFunctions +public class SplitButtonColors( + public val dividerColor: Color, + public val dividerDisabledColor: Color, + public val chevronColor: Color, +) { + public companion object +} + +@Stable +@GenerateDataFunctions +public class SplitButtonMetrics(public val dividerMetrics: DividerMetrics, public val dividerPadding: Dp) { + public companion object +} + +public val LocalDefaultSplitButtonStyle: ProvidableCompositionLocal = staticCompositionLocalOf { + error("No default SplitButtonStyle provided. Have you forgotten the theme?") +} + +public val LocalOutlinedSplitButtonStyle: ProvidableCompositionLocal = staticCompositionLocalOf { + error("No outlined SplitButtonStyle provided. Have you forgotten the theme?") +} diff --git a/platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/theme/JewelTheme.kt b/platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/theme/JewelTheme.kt index 348aebe9c424..47c036758180 100644 --- a/platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/theme/JewelTheme.kt +++ b/platform/jewel/ui/src/main/kotlin/org/jetbrains/jewel/ui/theme/JewelTheme.kt @@ -31,6 +31,7 @@ import org.jetbrains.jewel.ui.component.styling.LocalDefaultBannerStyle import org.jetbrains.jewel.ui.component.styling.LocalDefaultButtonStyle import org.jetbrains.jewel.ui.component.styling.LocalDefaultComboBoxStyle import org.jetbrains.jewel.ui.component.styling.LocalDefaultDropdownStyle +import org.jetbrains.jewel.ui.component.styling.LocalDefaultSplitButtonStyle import org.jetbrains.jewel.ui.component.styling.LocalDefaultTabStyle import org.jetbrains.jewel.ui.component.styling.LocalDividerStyle import org.jetbrains.jewel.ui.component.styling.LocalEditorTabStyle @@ -42,6 +43,7 @@ import org.jetbrains.jewel.ui.component.styling.LocalLazyTreeStyle import org.jetbrains.jewel.ui.component.styling.LocalLinkStyle import org.jetbrains.jewel.ui.component.styling.LocalMenuStyle import org.jetbrains.jewel.ui.component.styling.LocalOutlinedButtonStyle +import org.jetbrains.jewel.ui.component.styling.LocalOutlinedSplitButtonStyle import org.jetbrains.jewel.ui.component.styling.LocalPopupContainerStyle import org.jetbrains.jewel.ui.component.styling.LocalRadioButtonStyle import org.jetbrains.jewel.ui.component.styling.LocalScrollbarStyle @@ -62,6 +64,7 @@ import org.jetbrains.jewel.ui.component.styling.SegmentedControlStyle import org.jetbrains.jewel.ui.component.styling.SelectableLazyColumnStyle import org.jetbrains.jewel.ui.component.styling.SimpleListItemStyle import org.jetbrains.jewel.ui.component.styling.SliderStyle +import org.jetbrains.jewel.ui.component.styling.SplitButtonStyle import org.jetbrains.jewel.ui.component.styling.TabStyle import org.jetbrains.jewel.ui.component.styling.TextAreaStyle import org.jetbrains.jewel.ui.component.styling.TextFieldStyle @@ -86,6 +89,12 @@ public val JewelTheme.Companion.defaultButtonStyle: ButtonStyle public val JewelTheme.Companion.outlinedButtonStyle: ButtonStyle @Composable @ReadOnlyComposable get() = LocalOutlinedButtonStyle.current +public val JewelTheme.Companion.defaultSplitButtonStyle: SplitButtonStyle + @Composable @ReadOnlyComposable get() = LocalDefaultSplitButtonStyle.current + +public val JewelTheme.Companion.outlinedSplitButtonStyle: SplitButtonStyle + @Composable @ReadOnlyComposable get() = LocalOutlinedSplitButtonStyle.current + public val JewelTheme.Companion.checkboxStyle: CheckboxStyle @Composable @ReadOnlyComposable get() = LocalCheckboxStyle.current