diff --git a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt index 996bcc1e1..3c69a313d 100644 --- a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt +++ b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridge.kt @@ -78,6 +78,7 @@ internal fun createBridgeComponentStyling(theme: ThemeDefinition): ComponentStyl groupHeaderStyle = readGroupHeaderStyle(), horizontalProgressBarStyle = readHorizontalProgressBarStyle(), iconButtonStyle = readIconButtonStyle(), + inlineBannerStyle = readInlineBannerStyle(), lazyTreeStyle = readLazyTreeStyle(), linkStyle = readLinkStyle(), menuStyle = menuStyle, diff --git a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridgeBanner.kt b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridgeBanner.kt index b5354a7c6..c2bec3f9a 100644 --- a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridgeBanner.kt +++ b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/theme/IntUiBridgeBanner.kt @@ -8,6 +8,8 @@ import org.jetbrains.jewel.ui.component.styling.BannerColors import org.jetbrains.jewel.ui.component.styling.BannerMetrics import org.jetbrains.jewel.ui.component.styling.DefaultBannerStyle import org.jetbrains.jewel.ui.component.styling.DefaultBannerStyles +import org.jetbrains.jewel.ui.component.styling.InlineBannerStyle +import org.jetbrains.jewel.ui.component.styling.InlineBannerStyles internal fun readDefaultBannerStyle(): DefaultBannerStyles = DefaultBannerStyles( @@ -48,3 +50,43 @@ internal fun readDefaultBannerStyle(): DefaultBannerStyles = metrics = BannerMetrics(borderWidth = DarculaUIUtil.LW.dp), ), ) + +internal fun readInlineBannerStyle(): InlineBannerStyles = + InlineBannerStyles( + information = + InlineBannerStyle( + colors = + BannerColors( + background = JBUI.CurrentTheme.Banner.INFO_BACKGROUND.toComposeColor(), + border = JBUI.CurrentTheme.Banner.INFO_BORDER_COLOR.toComposeColor(), + ), + metrics = BannerMetrics(borderWidth = DarculaUIUtil.LW.dp), + ), + success = + InlineBannerStyle( + colors = + BannerColors( + background = JBUI.CurrentTheme.Banner.SUCCESS_BACKGROUND.toComposeColor(), + border = JBUI.CurrentTheme.Banner.SUCCESS_BORDER_COLOR.toComposeColor(), + ), + metrics = BannerMetrics(borderWidth = DarculaUIUtil.LW.dp), + ), + warning = + InlineBannerStyle( + colors = + BannerColors( + background = JBUI.CurrentTheme.Banner.WARNING_BACKGROUND.toComposeColor(), + border = JBUI.CurrentTheme.Banner.WARNING_BORDER_COLOR.toComposeColor(), + ), + metrics = BannerMetrics(borderWidth = DarculaUIUtil.LW.dp), + ), + error = + InlineBannerStyle( + colors = + BannerColors( + background = JBUI.CurrentTheme.Banner.ERROR_BACKGROUND.toComposeColor(), + border = JBUI.CurrentTheme.Banner.ERROR_BORDER_COLOR.toComposeColor(), + ), + metrics = BannerMetrics(borderWidth = DarculaUIUtil.LW.dp), + ), + ) diff --git a/int-ui/int-ui-standalone/api/int-ui-standalone.api b/int-ui/int-ui-standalone/api/int-ui-standalone.api index fcd91a722..1a422925a 100644 --- a/int-ui/int-ui-standalone/api/int-ui-standalone.api +++ b/int-ui/int-ui-standalone/api/int-ui-standalone.api @@ -42,14 +42,19 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUIBannerStyli public static final fun default-3ABfNKs (Lorg/jetbrains/jewel/ui/component/styling/BannerMetrics$Companion;F)Lorg/jetbrains/jewel/ui/component/styling/BannerMetrics; public static synthetic fun default-3ABfNKs$default (Lorg/jetbrains/jewel/ui/component/styling/BannerMetrics$Companion;FILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/BannerMetrics; public static final fun getDefault (Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyles$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultBannerStylesFactory; - public static final fun getError (Lorg/jetbrains/jewel/ui/component/styling/BannerColors$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultErrorBannerColorFactory; + public static final fun getDefault (Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyles$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiInlineBannerStylesFactory; + public static final fun getError (Lorg/jetbrains/jewel/ui/component/styling/BannerColors$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiErrorBannerColorFactory; public static final fun getError (Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyle$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultErrorBannerStyleFactory; - public static final fun getInformation (Lorg/jetbrains/jewel/ui/component/styling/BannerColors$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultInformationBannerColorFactory; + public static final fun getError (Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiInlineErrorBannerStyleFactory; + public static final fun getInformation (Lorg/jetbrains/jewel/ui/component/styling/BannerColors$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiInformationBannerColorFactory; public static final fun getInformation (Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyle$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultInformationBannerStyleFactory; - public static final fun getSuccess (Lorg/jetbrains/jewel/ui/component/styling/BannerColors$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultSuccessBannerColorFactory; + public static final fun getInformation (Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiInlineInformationBannerStyleFactory; + public static final fun getSuccess (Lorg/jetbrains/jewel/ui/component/styling/BannerColors$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiSuccessBannerColorFactory; public static final fun getSuccess (Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyle$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultSuccessBannerStyleFactory; - public static final fun getWarning (Lorg/jetbrains/jewel/ui/component/styling/BannerColors$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultWarningBannerColorFactory; + public static final fun getSuccess (Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiInlineSuccessBannerStyleFactory; + public static final fun getWarning (Lorg/jetbrains/jewel/ui/component/styling/BannerColors$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiWarningBannerColorFactory; public static final fun getWarning (Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyle$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultWarningBannerStyleFactory; + public static final fun getWarning (Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle$Companion;)Lorg/jetbrains/jewel/intui/standalone/styling/IntUiInlineWarningBannerStyleFactory; } public final class org/jetbrains/jewel/intui/standalone/styling/IntUiButtonStylingKt { @@ -152,13 +157,6 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUiDefaultDrop public final fun light (Lorg/jetbrains/jewel/ui/component/styling/DropdownColors;Lorg/jetbrains/jewel/ui/component/styling/DropdownMetrics;Lorg/jetbrains/jewel/ui/component/styling/DropdownIcons;Lorg/jetbrains/jewel/ui/component/styling/MenuStyle;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle; } -public final class org/jetbrains/jewel/intui/standalone/styling/IntUiDefaultErrorBannerColorFactory { - public static final field $stable I - public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultErrorBannerColorFactory; - public final fun dark-dgg9oW8 (JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/BannerColors; - public final fun light-dgg9oW8 (JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/BannerColors; -} - public final class org/jetbrains/jewel/intui/standalone/styling/IntUiDefaultErrorBannerStyleFactory { public static final field $stable I public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultErrorBannerStyleFactory; @@ -166,13 +164,6 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUiDefaultErro public final fun light (Lorg/jetbrains/jewel/ui/component/styling/BannerColors;Lorg/jetbrains/jewel/ui/component/styling/BannerMetrics;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyle; } -public final class org/jetbrains/jewel/intui/standalone/styling/IntUiDefaultInformationBannerColorFactory { - public static final field $stable I - public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultInformationBannerColorFactory; - public final fun dark-dgg9oW8 (JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/BannerColors; - public final fun light-dgg9oW8 (JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/BannerColors; -} - public final class org/jetbrains/jewel/intui/standalone/styling/IntUiDefaultInformationBannerStyleFactory { public static final field $stable I public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultInformationBannerStyleFactory; @@ -187,13 +178,6 @@ 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/IntUiDefaultSuccessBannerColorFactory { - public static final field $stable I - public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultSuccessBannerColorFactory; - public final fun dark-dgg9oW8 (JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/BannerColors; - public final fun light-dgg9oW8 (JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/BannerColors; -} - 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; @@ -218,13 +202,6 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUiDefaultTabS public static synthetic fun light$default (Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultTabStyleFactory;Lorg/jetbrains/jewel/ui/component/styling/TabColors;Lorg/jetbrains/jewel/ui/component/styling/TabMetrics;Lorg/jetbrains/jewel/ui/component/styling/TabIcons;Lorg/jetbrains/jewel/ui/component/styling/TabContentAlpha;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;ILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/TabStyle; } -public final class org/jetbrains/jewel/intui/standalone/styling/IntUiDefaultWarningBannerColorFactory { - public static final field $stable I - public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultWarningBannerColorFactory; - public final fun dark-dgg9oW8 (JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/BannerColors; - public final fun light-dgg9oW8 (JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/BannerColors; -} - public final class org/jetbrains/jewel/intui/standalone/styling/IntUiDefaultWarningBannerStyleFactory { public static final field $stable I public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/styling/IntUiDefaultWarningBannerStyleFactory; @@ -266,6 +243,13 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUiEditorTabSt public final fun light (Lorg/jetbrains/jewel/ui/component/styling/TabColors;Lorg/jetbrains/jewel/ui/component/styling/TabMetrics;Lorg/jetbrains/jewel/ui/component/styling/TabIcons;Lorg/jetbrains/jewel/ui/component/styling/TabContentAlpha;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/TabStyle; } +public final class org/jetbrains/jewel/intui/standalone/styling/IntUiErrorBannerColorFactory { + public static final field $stable I + public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/styling/IntUiErrorBannerColorFactory; + public final fun dark-dgg9oW8 (JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/BannerColors; + public final fun light-dgg9oW8 (JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/BannerColors; +} + public final class org/jetbrains/jewel/intui/standalone/styling/IntUiGroupHeaderStylingKt { public static final fun dark (Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderStyle$Companion;Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderColors;Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderMetrics;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderStyle; public static final fun dark-iJQMabo (Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderColors$Companion;JLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderColors; @@ -293,6 +277,48 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUiIconButtonS public static final fun light-8v1krLo (Lorg/jetbrains/jewel/ui/component/styling/IconButtonColors$Companion;JJJJJJJJJJJJJJJLandroidx/compose/runtime/Composer;III)Lorg/jetbrains/jewel/ui/component/styling/IconButtonColors; } +public final class org/jetbrains/jewel/intui/standalone/styling/IntUiInformationBannerColorFactory { + public static final field $stable I + public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/styling/IntUiInformationBannerColorFactory; + public final fun dark-dgg9oW8 (JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/BannerColors; + public final fun light-dgg9oW8 (JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/BannerColors; +} + +public final class org/jetbrains/jewel/intui/standalone/styling/IntUiInlineBannerStylesFactory { + public static final field $stable I + public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/styling/IntUiInlineBannerStylesFactory; + public final fun dark (Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle;Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle;Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle;Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyles; + public final fun light (Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle;Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle;Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle;Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyles; +} + +public final class org/jetbrains/jewel/intui/standalone/styling/IntUiInlineErrorBannerStyleFactory { + public static final field $stable I + public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/styling/IntUiInlineErrorBannerStyleFactory; + public final fun dark (Lorg/jetbrains/jewel/ui/component/styling/BannerColors;Lorg/jetbrains/jewel/ui/component/styling/BannerMetrics;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle; + public final fun light (Lorg/jetbrains/jewel/ui/component/styling/BannerColors;Lorg/jetbrains/jewel/ui/component/styling/BannerMetrics;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle; +} + +public final class org/jetbrains/jewel/intui/standalone/styling/IntUiInlineInformationBannerStyleFactory { + public static final field $stable I + public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/styling/IntUiInlineInformationBannerStyleFactory; + public final fun dark (Lorg/jetbrains/jewel/ui/component/styling/BannerColors;Lorg/jetbrains/jewel/ui/component/styling/BannerMetrics;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle; + public final fun light (Lorg/jetbrains/jewel/ui/component/styling/BannerColors;Lorg/jetbrains/jewel/ui/component/styling/BannerMetrics;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle; +} + +public final class org/jetbrains/jewel/intui/standalone/styling/IntUiInlineSuccessBannerStyleFactory { + public static final field $stable I + public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/styling/IntUiInlineSuccessBannerStyleFactory; + public final fun dark (Lorg/jetbrains/jewel/ui/component/styling/BannerColors;Lorg/jetbrains/jewel/ui/component/styling/BannerMetrics;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle; + public final fun light (Lorg/jetbrains/jewel/ui/component/styling/BannerColors;Lorg/jetbrains/jewel/ui/component/styling/BannerMetrics;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle; +} + +public final class org/jetbrains/jewel/intui/standalone/styling/IntUiInlineWarningBannerStyleFactory { + public static final field $stable I + public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/styling/IntUiInlineWarningBannerStyleFactory; + public final fun dark (Lorg/jetbrains/jewel/ui/component/styling/BannerColors;Lorg/jetbrains/jewel/ui/component/styling/BannerMetrics;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle; + public final fun light (Lorg/jetbrains/jewel/ui/component/styling/BannerColors;Lorg/jetbrains/jewel/ui/component/styling/BannerMetrics;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle; +} + public final class org/jetbrains/jewel/intui/standalone/styling/IntUiLazyTreeStylingKt { public static final fun dark (Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle$Companion;Lorg/jetbrains/jewel/ui/component/styling/SimpleListItemColors;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeMetrics;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeIcons;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle; public static final fun defaults (Lorg/jetbrains/jewel/ui/component/styling/LazyTreeIcons$Companion;Lorg/jetbrains/jewel/ui/icon/IconKey;Lorg/jetbrains/jewel/ui/icon/IconKey;Lorg/jetbrains/jewel/ui/icon/IconKey;Lorg/jetbrains/jewel/ui/icon/IconKey;)Lorg/jetbrains/jewel/ui/component/styling/LazyTreeIcons; @@ -444,6 +470,13 @@ 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/IntUiSuccessBannerColorFactory { + public static final field $stable I + public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/styling/IntUiSuccessBannerColorFactory; + public final fun dark-dgg9oW8 (JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/BannerColors; + public final fun light-dgg9oW8 (JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/BannerColors; +} + public final class org/jetbrains/jewel/intui/standalone/styling/IntUiTabStripScrollbarStylingKt { public static final fun tabStrip-ziNgDLE (Lorg/jetbrains/jewel/ui/component/styling/ScrollbarVisibility$AlwaysVisible$Companion;FLandroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/layout/PaddingValues;)Lorg/jetbrains/jewel/ui/component/styling/ScrollbarVisibility$AlwaysVisible; public static synthetic fun tabStrip-ziNgDLE$default (Lorg/jetbrains/jewel/ui/component/styling/ScrollbarVisibility$AlwaysVisible$Companion;FLandroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/layout/PaddingValues;ILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/ScrollbarVisibility$AlwaysVisible; @@ -531,6 +564,13 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUiUndecorated public final fun light (Lorg/jetbrains/jewel/ui/component/styling/DropdownColors;Lorg/jetbrains/jewel/ui/component/styling/DropdownMetrics;Lorg/jetbrains/jewel/ui/component/styling/DropdownIcons;Lorg/jetbrains/jewel/ui/component/styling/MenuStyle;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/DropdownStyle; } +public final class org/jetbrains/jewel/intui/standalone/styling/IntUiWarningBannerColorFactory { + public static final field $stable I + public static final field INSTANCE Lorg/jetbrains/jewel/intui/standalone/styling/IntUiWarningBannerColorFactory; + public final fun dark-dgg9oW8 (JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/BannerColors; + public final fun light-dgg9oW8 (JJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/BannerColors; +} + public final class org/jetbrains/jewel/intui/standalone/theme/IntUiGlobalColorsKt { public static final fun dark-GyCwops (Lorg/jetbrains/jewel/foundation/BorderColors$Companion;JJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/foundation/BorderColors; public static final fun dark-Hformbs (Lorg/jetbrains/jewel/foundation/OutlineColors$Companion;JJJJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/foundation/OutlineColors; @@ -550,10 +590,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/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;IIII)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/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 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/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;IIII)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 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/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUIBannerStyling.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUIBannerStyling.kt index 4758dd830..84450e4e7 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUIBannerStyling.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUIBannerStyling.kt @@ -10,6 +10,8 @@ import org.jetbrains.jewel.ui.component.styling.BannerColors import org.jetbrains.jewel.ui.component.styling.BannerMetrics import org.jetbrains.jewel.ui.component.styling.DefaultBannerStyle import org.jetbrains.jewel.ui.component.styling.DefaultBannerStyles +import org.jetbrains.jewel.ui.component.styling.InlineBannerStyle +import org.jetbrains.jewel.ui.component.styling.InlineBannerStyles public val DefaultBannerStyles.Companion.Default: IntUiDefaultBannerStylesFactory get() = IntUiDefaultBannerStylesFactory @@ -34,8 +36,6 @@ public object IntUiDefaultBannerStylesFactory { DefaultBannerStyles(information = information, success = success, warning = warning, error = error) } -public fun BannerMetrics.Companion.default(borderWidth: Dp = 1.dp): BannerMetrics = BannerMetrics(borderWidth) - // region Information Banner public val DefaultBannerStyle.Companion.Information: IntUiDefaultInformationBannerStyleFactory get() = IntUiDefaultInformationBannerStyleFactory @@ -54,10 +54,10 @@ public object IntUiDefaultInformationBannerStyleFactory { ): DefaultBannerStyle = DefaultBannerStyle(colors = colors, metrics = metrics) } -public val BannerColors.Companion.Information: IntUiDefaultInformationBannerColorFactory - get() = IntUiDefaultInformationBannerColorFactory +public val BannerColors.Companion.Information: IntUiInformationBannerColorFactory + get() = IntUiInformationBannerColorFactory -public object IntUiDefaultInformationBannerColorFactory { +public object IntUiInformationBannerColorFactory { @Composable public fun light( background: Color = IntUiLightTheme.colors.blue(13), @@ -91,10 +91,7 @@ public object IntUiDefaultSuccessBannerStyleFactory { ): DefaultBannerStyle = DefaultBannerStyle(colors = colors, metrics = metrics) } -public val BannerColors.Companion.Success: IntUiDefaultSuccessBannerColorFactory - get() = IntUiDefaultSuccessBannerColorFactory - -public object IntUiDefaultSuccessBannerColorFactory { +public object IntUiSuccessBannerColorFactory { @Composable public fun light( background: Color = IntUiLightTheme.colors.green(11), @@ -128,10 +125,10 @@ public object IntUiDefaultWarningBannerStyleFactory { ): DefaultBannerStyle = DefaultBannerStyle(colors = colors, metrics = metrics) } -public val BannerColors.Companion.Warning: IntUiDefaultWarningBannerColorFactory - get() = IntUiDefaultWarningBannerColorFactory +public val BannerColors.Companion.Warning: IntUiWarningBannerColorFactory + get() = IntUiWarningBannerColorFactory -public object IntUiDefaultWarningBannerColorFactory { +public object IntUiWarningBannerColorFactory { @Composable public fun light( background: Color = IntUiLightTheme.colors.yellow(10), @@ -165,10 +162,10 @@ public object IntUiDefaultErrorBannerStyleFactory { ): DefaultBannerStyle = DefaultBannerStyle(colors = colors, metrics = metrics) } -public val BannerColors.Companion.Error: IntUiDefaultErrorBannerColorFactory - get() = IntUiDefaultErrorBannerColorFactory +public val BannerColors.Companion.Error: IntUiErrorBannerColorFactory + get() = IntUiErrorBannerColorFactory -public object IntUiDefaultErrorBannerColorFactory { +public object IntUiErrorBannerColorFactory { @Composable public fun light( background: Color = IntUiLightTheme.colors.red(12), @@ -181,4 +178,112 @@ public object IntUiDefaultErrorBannerColorFactory { border: Color = IntUiDarkTheme.colors.red(3), ): BannerColors = BannerColors(background = background, border = border) } + +// endregion + +public val InlineBannerStyles.Companion.Default: IntUiInlineBannerStylesFactory + get() = IntUiInlineBannerStylesFactory + +public object IntUiInlineBannerStylesFactory { + @Composable + public fun light( + information: InlineBannerStyle = InlineBannerStyle.Information.light(), + success: InlineBannerStyle = InlineBannerStyle.Success.light(), + warning: InlineBannerStyle = InlineBannerStyle.Warning.light(), + error: InlineBannerStyle = InlineBannerStyle.Error.light(), + ): InlineBannerStyles = + InlineBannerStyles(information = information, success = success, warning = warning, error = error) + + @Composable + public fun dark( + information: InlineBannerStyle = InlineBannerStyle.Information.dark(), + success: InlineBannerStyle = InlineBannerStyle.Success.dark(), + warning: InlineBannerStyle = InlineBannerStyle.Warning.dark(), + error: InlineBannerStyle = InlineBannerStyle.Error.dark(), + ): InlineBannerStyles = + InlineBannerStyles(information = information, success = success, warning = warning, error = error) +} + +public fun BannerMetrics.Companion.default(borderWidth: Dp = 1.dp): BannerMetrics = BannerMetrics(borderWidth) + +// region Inline Information Banner +public val InlineBannerStyle.Companion.Information: IntUiInlineInformationBannerStyleFactory + get() = IntUiInlineInformationBannerStyleFactory + +public object IntUiInlineInformationBannerStyleFactory { + @Composable + public fun light( + colors: BannerColors = BannerColors.Information.light(), + metrics: BannerMetrics = BannerMetrics.default(), + ): InlineBannerStyle = InlineBannerStyle(colors = colors, metrics = metrics) + + @Composable + public fun dark( + colors: BannerColors = BannerColors.Information.dark(), + metrics: BannerMetrics = BannerMetrics.default(), + ): InlineBannerStyle = InlineBannerStyle(colors = colors, metrics = metrics) +} + +// endregion + +// region Inline Success Banner +public val InlineBannerStyle.Companion.Success: IntUiInlineSuccessBannerStyleFactory + get() = IntUiInlineSuccessBannerStyleFactory + +public object IntUiInlineSuccessBannerStyleFactory { + @Composable + public fun light( + colors: BannerColors = BannerColors.Success.light(), + metrics: BannerMetrics = BannerMetrics.default(), + ): InlineBannerStyle = InlineBannerStyle(colors = colors, metrics = metrics) + + @Composable + public fun dark( + colors: BannerColors = BannerColors.Success.dark(), + metrics: BannerMetrics = BannerMetrics.default(), + ): InlineBannerStyle = InlineBannerStyle(colors = colors, metrics = metrics) +} + +public val BannerColors.Companion.Success: IntUiSuccessBannerColorFactory + get() = IntUiSuccessBannerColorFactory + +// endregion + +// region Inline Warning Banner +public val InlineBannerStyle.Companion.Warning: IntUiInlineWarningBannerStyleFactory + get() = IntUiInlineWarningBannerStyleFactory + +public object IntUiInlineWarningBannerStyleFactory { + @Composable + public fun light( + colors: BannerColors = BannerColors.Warning.light(), + metrics: BannerMetrics = BannerMetrics.default(), + ): InlineBannerStyle = InlineBannerStyle(colors = colors, metrics = metrics) + + @Composable + public fun dark( + colors: BannerColors = BannerColors.Warning.dark(), + metrics: BannerMetrics = BannerMetrics.default(), + ): InlineBannerStyle = InlineBannerStyle(colors = colors, metrics = metrics) +} + +// endregion + +// region Inline Error Banner +public val InlineBannerStyle.Companion.Error: IntUiInlineErrorBannerStyleFactory + get() = IntUiInlineErrorBannerStyleFactory + +public object IntUiInlineErrorBannerStyleFactory { + @Composable + public fun light( + colors: BannerColors = BannerColors.Error.light(), + metrics: BannerMetrics = BannerMetrics.default(), + ): InlineBannerStyle = InlineBannerStyle(colors = colors, metrics = metrics) + + @Composable + public fun dark( + colors: BannerColors = BannerColors.Error.dark(), + metrics: BannerMetrics = BannerMetrics.default(), + ): InlineBannerStyle = InlineBannerStyle(colors = colors, metrics = metrics) +} // endregion diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/theme/IntUiTheme.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/theme/IntUiTheme.kt index 138117fcd..b79fa6574 100644 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/theme/IntUiTheme.kt +++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/theme/IntUiTheme.kt @@ -33,6 +33,7 @@ import org.jetbrains.jewel.ui.component.styling.DropdownStyle import org.jetbrains.jewel.ui.component.styling.GroupHeaderStyle import org.jetbrains.jewel.ui.component.styling.HorizontalProgressBarStyle import org.jetbrains.jewel.ui.component.styling.IconButtonStyle +import org.jetbrains.jewel.ui.component.styling.InlineBannerStyles import org.jetbrains.jewel.ui.component.styling.LazyTreeStyle import org.jetbrains.jewel.ui.component.styling.LinkStyle import org.jetbrains.jewel.ui.component.styling.MenuStyle @@ -121,6 +122,7 @@ public fun ComponentStyling.dark( groupHeaderStyle: GroupHeaderStyle = GroupHeaderStyle.dark(), horizontalProgressBarStyle: HorizontalProgressBarStyle = HorizontalProgressBarStyle.dark(), iconButtonStyle: IconButtonStyle = IconButtonStyle.dark(), + inlineBannerStyle: InlineBannerStyles = InlineBannerStyles.Default.dark(), lazyTreeStyle: LazyTreeStyle = LazyTreeStyle.dark(), linkStyle: LinkStyle = LinkStyle.dark(), menuStyle: MenuStyle = MenuStyle.dark(), @@ -153,6 +155,7 @@ public fun ComponentStyling.dark( groupHeaderStyle = groupHeaderStyle, horizontalProgressBarStyle = horizontalProgressBarStyle, iconButtonStyle = iconButtonStyle, + inlineBannerStyle = inlineBannerStyle, lazyTreeStyle = lazyTreeStyle, linkStyle = linkStyle, menuStyle = menuStyle, @@ -187,6 +190,7 @@ public fun ComponentStyling.light( groupHeaderStyle: GroupHeaderStyle = GroupHeaderStyle.light(), horizontalProgressBarStyle: HorizontalProgressBarStyle = HorizontalProgressBarStyle.light(), iconButtonStyle: IconButtonStyle = IconButtonStyle.light(), + inlineBannerStyle: InlineBannerStyles = InlineBannerStyles.Default.light(), lazyTreeStyle: LazyTreeStyle = LazyTreeStyle.light(), linkStyle: LinkStyle = LinkStyle.light(), menuStyle: MenuStyle = MenuStyle.light(), @@ -219,6 +223,7 @@ public fun ComponentStyling.light( groupHeaderStyle = groupHeaderStyle, horizontalProgressBarStyle = horizontalProgressBarStyle, iconButtonStyle = iconButtonStyle, + inlineBannerStyle = inlineBannerStyle, lazyTreeStyle = lazyTreeStyle, linkStyle = linkStyle, menuStyle = menuStyle, diff --git a/samples/ide-plugin/src/main/kotlin/org/jetbrains/jewel/samples/ideplugin/ComponentShowcaseTab.kt b/samples/ide-plugin/src/main/kotlin/org/jetbrains/jewel/samples/ideplugin/ComponentShowcaseTab.kt index b4eb64937..1c9d19360 100644 --- a/samples/ide-plugin/src/main/kotlin/org/jetbrains/jewel/samples/ideplugin/ComponentShowcaseTab.kt +++ b/samples/ide-plugin/src/main/kotlin/org/jetbrains/jewel/samples/ideplugin/ComponentShowcaseTab.kt @@ -1,3 +1,5 @@ +@file:OptIn(ExperimentalLayoutApi::class) + package org.jetbrains.jewel.samples.ideplugin import androidx.compose.foundation.background @@ -5,6 +7,7 @@ import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.Spacer @@ -53,22 +56,27 @@ import org.jetbrains.jewel.ui.component.CircularProgressIndicatorBig import org.jetbrains.jewel.ui.component.DefaultButton import org.jetbrains.jewel.ui.component.Divider import org.jetbrains.jewel.ui.component.Dropdown -import org.jetbrains.jewel.ui.component.ErrorBanner +import org.jetbrains.jewel.ui.component.ErrorDefaultBanner +import org.jetbrains.jewel.ui.component.ErrorInlineBanner 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.InformationBanner +import org.jetbrains.jewel.ui.component.InformationDefaultBanner +import org.jetbrains.jewel.ui.component.InformationInlineBanner import org.jetbrains.jewel.ui.component.LazyTree +import org.jetbrains.jewel.ui.component.Link import org.jetbrains.jewel.ui.component.OutlinedButton import org.jetbrains.jewel.ui.component.RadioButtonRow import org.jetbrains.jewel.ui.component.Slider -import org.jetbrains.jewel.ui.component.SuccessBanner +import org.jetbrains.jewel.ui.component.SuccessDefaultBanner +import org.jetbrains.jewel.ui.component.SuccessInlineBanner import org.jetbrains.jewel.ui.component.Text import org.jetbrains.jewel.ui.component.TextField import org.jetbrains.jewel.ui.component.Tooltip import org.jetbrains.jewel.ui.component.Typography import org.jetbrains.jewel.ui.component.VerticallyScrollableContainer -import org.jetbrains.jewel.ui.component.WarningBanner +import org.jetbrains.jewel.ui.component.WarningDefaultBanner +import org.jetbrains.jewel.ui.component.WarningInlineBanner import org.jetbrains.jewel.ui.component.separator import org.jetbrains.jewel.ui.icons.AllIconsKeys import org.jetbrains.jewel.ui.painter.badge.DotBadgeShape @@ -76,6 +84,7 @@ import org.jetbrains.jewel.ui.painter.hints.Badge import org.jetbrains.jewel.ui.painter.hints.Size import org.jetbrains.jewel.ui.painter.hints.Stroke import org.jetbrains.jewel.ui.theme.colorPalette +import org.jetbrains.jewel.ui.theme.inlineBannerStyle @Composable internal fun ComponentShowcaseTab(project: Project) { @@ -213,14 +222,62 @@ private fun RowScope.ColumnOne() { Slider(sliderValue, { sliderValue = it }, steps = 5) var bannerStyle by remember { mutableIntStateOf(0) } - Column { + var clickLabel by remember { mutableStateOf("") } + + Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { OutlinedButton({ bannerStyle = (bannerStyle + 1) % 4 }) { Text("Give me a new banner!") } Spacer(modifier = Modifier.height(8.dp)) + Text(text = "Clicked action: $clickLabel") when (bannerStyle) { - 1 -> ErrorBanner("This is an error banner in Compose") - 0 -> SuccessBanner("This is a success banner in Compose") - 2 -> WarningBanner("This is a warning banner in Compose") - else -> InformationBanner("This is an information banner in Compose") + 1 -> { + ErrorDefaultBanner("This is an error banner in Compose") + ErrorInlineBanner( + style = JewelTheme.inlineBannerStyle.error, + text = + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt", + actionIcons = { + IconButton(onClick = { clickLabel = "Error Inline Action Icon clicked" }) { + Icon(AllIconsKeys.General.Close, null) + } + }, + ) + } + + 0 -> { + SuccessDefaultBanner("This is a success banner in Compose") + SuccessInlineBanner( + style = JewelTheme.inlineBannerStyle.success, + text = + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor" + + " incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, " + + "quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. " + + "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu " + + "fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa " + + "qui officia deserunt mollit anim id est laborum.", + actions = { + Link("Action A", onClick = { clickLabel = "Success Inline Action A clicked" }) + Link("Action B", onClick = { clickLabel = "Success Inline Action B clicked" }) + }, + actionIcons = { + IconButton(onClick = { clickLabel = "Error Close Icon clicked" }) { + Icon(AllIconsKeys.General.Close, null) + } + IconButton(onClick = { clickLabel = "Error Gear Icon clicked" }) { + Icon(AllIconsKeys.General.Gear, null) + } + }, + ) + } + + 2 -> { + WarningDefaultBanner("This is a warning banner in Compose") + WarningInlineBanner("This is a warning banner in Compose") + } + + else -> { + InformationDefaultBanner("This is an information banner in Compose") + InformationInlineBanner("This is an information banner in Compose") + } } } } diff --git a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Banners.kt b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Banners.kt index f649c01a7..8adcf0575 100644 --- a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Banners.kt +++ b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/view/component/Banners.kt @@ -2,50 +2,205 @@ package org.jetbrains.jewel.samples.standalone.view.component import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import org.jetbrains.jewel.foundation.theme.JewelTheme -import org.jetbrains.jewel.ui.component.ErrorBanner +import org.jetbrains.jewel.ui.component.ErrorDefaultBanner +import org.jetbrains.jewel.ui.component.ErrorInlineBanner import org.jetbrains.jewel.ui.component.GroupHeader -import org.jetbrains.jewel.ui.component.InformationBanner -import org.jetbrains.jewel.ui.component.SuccessBanner +import org.jetbrains.jewel.ui.component.Icon +import org.jetbrains.jewel.ui.component.IconButton +import org.jetbrains.jewel.ui.component.InformationDefaultBanner +import org.jetbrains.jewel.ui.component.InformationInlineBanner +import org.jetbrains.jewel.ui.component.Link +import org.jetbrains.jewel.ui.component.SuccessDefaultBanner +import org.jetbrains.jewel.ui.component.SuccessInlineBanner import org.jetbrains.jewel.ui.component.Text -import org.jetbrains.jewel.ui.component.WarningBanner +import org.jetbrains.jewel.ui.component.VerticallyScrollableContainer +import org.jetbrains.jewel.ui.component.WarningDefaultBanner +import org.jetbrains.jewel.ui.component.WarningInlineBanner +import org.jetbrains.jewel.ui.component.scrollbarContentSafePadding +import org.jetbrains.jewel.ui.icons.AllIconsKeys import org.jetbrains.jewel.ui.theme.defaultBannerStyle +import org.jetbrains.jewel.ui.theme.inlineBannerStyle +private const val LONG_IPSUM = + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor" + + " incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, " + + "quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. " + + "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu " + + "fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa " + + "qui officia deserunt mollit anim id est laborum." + +@ExperimentalLayoutApi @Composable internal fun Banners() { - Column(Modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(8.dp)) { - GroupHeader("Default banner (aka editor banners)") + Column { + var clickLabel by remember { mutableStateOf("") } + Text(text = "Clicked action: $clickLabel") + Spacer(Modifier.height(8.dp)) + + VerticallyScrollableContainer { + Column( + Modifier.fillMaxWidth().padding(end = scrollbarContentSafePadding()), + verticalArrangement = Arrangement.spacedBy(8.dp), + ) { + GroupHeader("Default banner (aka editor banners)") + + InformationDefaultBanner( + style = JewelTheme.defaultBannerStyle.information, + text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt", + actions = { + Link("Action A", onClick = { clickLabel = "Info default no icon Action A clicked" }) + Link("Action B", onClick = { clickLabel = "Info default no icon Action B clicked" }) + }, + ) + + InformationDefaultBanner( + style = JewelTheme.defaultBannerStyle.information, + text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt", + icon = null, + actions = { + Link("Action A", onClick = { clickLabel = "Info default no icon Action A clicked" }) + Link("Action B", onClick = { clickLabel = "Info default no icon Action B clicked" }) + }, + ) + + InformationDefaultBanner(style = JewelTheme.defaultBannerStyle.information, text = LONG_IPSUM) + + InformationDefaultBanner( + style = JewelTheme.defaultBannerStyle.information, + text = LONG_IPSUM, + icon = null, + ) + + InformationDefaultBanner( + style = JewelTheme.defaultBannerStyle.information, + text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt", + ) + + SuccessDefaultBanner( + style = JewelTheme.defaultBannerStyle.success, + text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt", + ) + + WarningDefaultBanner( + style = JewelTheme.defaultBannerStyle.warning, + text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt", + ) + + ErrorDefaultBanner( + style = JewelTheme.defaultBannerStyle.error, + text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt", + ) - InformationBanner( - style = JewelTheme.defaultBannerStyle.information, - text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt", - ) + Spacer(Modifier.height(8.dp)) - SuccessBanner( - style = JewelTheme.defaultBannerStyle.success, - text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt", - ) + GroupHeader("Inline banner") - WarningBanner( - style = JewelTheme.defaultBannerStyle.warning, - text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt", - ) + InformationInlineBanner( + icon = null, + style = JewelTheme.inlineBannerStyle.information, + text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt", + ) - ErrorBanner( - style = JewelTheme.defaultBannerStyle.error, - text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt", - ) + InformationInlineBanner( + icon = null, + style = JewelTheme.inlineBannerStyle.information, + text = LONG_IPSUM, + actionIcons = { + IconButton(onClick = { clickLabel = "Info inline no icon Action Icon clicked" }) { + Icon(AllIconsKeys.General.Close, null) + } + }, + ) - Spacer(Modifier.height(0.dp)) // The column's arrangement will add 8+8 dps of spacing + InformationInlineBanner( + icon = null, + style = JewelTheme.inlineBannerStyle.information, + text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt", + actions = { + Link("Action A", onClick = { clickLabel = "Info inline no icon Action A clicked" }) + Link("Action B", onClick = { clickLabel = "Info inline no icon Action B clicked" }) + }, + ) - GroupHeader("Inline banner") + InformationInlineBanner( + icon = null, + style = JewelTheme.inlineBannerStyle.information, + text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt", + actionIcons = { + IconButton(onClick = { clickLabel = "Info inline no icon Action Icon clicked" }) { + Icon(AllIconsKeys.General.Close, null) + } + }, + actions = { + Link("Action A", onClick = { clickLabel = "Info inline no icon Action A clicked" }) + Link("Action B", onClick = { clickLabel = "Info inline no icon Action B clicked" }) + }, + ) - Text("Coming soon...", color = JewelTheme.globalColors.text.disabled) + InformationInlineBanner( + style = JewelTheme.inlineBannerStyle.information, + text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt", + ) + ErrorInlineBanner( + style = JewelTheme.inlineBannerStyle.error, + text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt", + actionIcons = { + IconButton(onClick = { clickLabel = "Error Inline Action Icon clicked" }) { + Icon(AllIconsKeys.General.Close, null) + } + }, + ) + InformationInlineBanner( + style = JewelTheme.inlineBannerStyle.information, + text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt", + actions = { + Link("Action A", onClick = { clickLabel = "Information Inline Action A clicked" }) + Link("Action B", onClick = { clickLabel = "Information Inline Action B clicked" }) + }, + ) + SuccessInlineBanner( + style = JewelTheme.inlineBannerStyle.success, + text = LONG_IPSUM, + actions = { + Link("Action A", onClick = { clickLabel = "Success Inline Action A clicked" }) + Link("Action B", onClick = { clickLabel = "Success Inline Action B clicked" }) + }, + actionIcons = { + IconButton(onClick = { clickLabel = "Error Close Icon clicked" }) { + Icon(AllIconsKeys.General.Close, null) + } + IconButton(onClick = { clickLabel = "Error Gear Icon clicked" }) { + Icon(AllIconsKeys.General.Gear, null) + } + }, + ) + WarningInlineBanner( + style = JewelTheme.inlineBannerStyle.warning, + text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt", + actions = { Link("Action A", onClick = { clickLabel = "Warning Inline Action A clicked" }) }, + actionIcons = { + IconButton(onClick = { clickLabel = "Error Close Icon clicked" }) { + Icon(AllIconsKeys.General.Close, null) + } + IconButton(onClick = { clickLabel = "Error Gear Icon clicked" }) { + Icon(AllIconsKeys.General.Gear, null) + } + }, + ) + } + } } } diff --git a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/viewmodel/ComponentsViewModel.kt b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/viewmodel/ComponentsViewModel.kt index 733d43c4a..fce0aba74 100644 --- a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/viewmodel/ComponentsViewModel.kt +++ b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/viewmodel/ComponentsViewModel.kt @@ -1,6 +1,7 @@ package org.jetbrains.jewel.samples.standalone.viewmodel import SplitLayouts +import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateListOf import androidx.compose.runtime.mutableStateOf @@ -31,6 +32,7 @@ object ComponentsViewModel { private var verticalSplitState by mutableStateOf(SplitLayoutState(0.5f)) private var innerSplitState by mutableStateOf(SplitLayoutState(0.5f)) + @OptIn(ExperimentalLayoutApi::class) val views: SnapshotStateList = mutableStateListOf( ViewInfo(title = "Buttons", iconKey = StandaloneSampleIcons.Components.button, content = { Buttons() }), diff --git a/ui/api/ui.api b/ui/api/ui.api index 31d18b523..0c7bd5576 100644 --- a/ui/api/ui.api +++ b/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/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/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 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; @@ -40,6 +40,7 @@ public final class org/jetbrains/jewel/ui/DefaultComponentStyling : org/jetbrain public final fun getGroupHeaderStyle ()Lorg/jetbrains/jewel/ui/component/styling/GroupHeaderStyle; public final fun getHorizontalProgressBarStyle ()Lorg/jetbrains/jewel/ui/component/styling/HorizontalProgressBarStyle; public final fun getIconButtonStyle ()Lorg/jetbrains/jewel/ui/component/styling/IconButtonStyle; + public final fun getInlineBannerStyle ()Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyles; public final fun getLazyTreeStyle ()Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle; public final fun getLinkStyle ()Lorg/jetbrains/jewel/ui/component/styling/LinkStyle; public final fun getMenuStyle ()Lorg/jetbrains/jewel/ui/component/styling/MenuStyle; @@ -102,13 +103,6 @@ public final class org/jetbrains/jewel/ui/component/ActionButtonKt { public static final fun ActionButton (Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function2;Landroidx/compose/ui/Modifier;ZZLorg/jetbrains/jewel/ui/component/styling/IconButtonStyle;Landroidx/compose/foundation/layout/PaddingValues;Lorg/jetbrains/jewel/ui/component/styling/TooltipStyle;Landroidx/compose/foundation/TooltipPlacement;Landroidx/compose/foundation/interaction/MutableInteractionSource;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;III)V } -public final class org/jetbrains/jewel/ui/component/BannerKt { - public static final fun ErrorBanner (Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/runtime/Composer;II)V - public static final fun InformationBanner (Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/runtime/Composer;II)V - public static final fun SuccessBanner (Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/runtime/Composer;II)V - public static final fun WarningBanner (Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/runtime/Composer;II)V -} - 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 @@ -281,8 +275,21 @@ public final class org/jetbrains/jewel/ui/component/ComboBoxState$Companion { public static synthetic fun of-b6bHBqw$default (Lorg/jetbrains/jewel/ui/component/ComboBoxState$Companion;ZZZZZILjava/lang/Object;)J } -public final class org/jetbrains/jewel/ui/component/ComposableSingletons$BannerKt { - public static final field INSTANCE Lorg/jetbrains/jewel/ui/component/ComposableSingletons$BannerKt; +public final class org/jetbrains/jewel/ui/component/ComposableSingletons$DefaultBannerKt { + public static final field INSTANCE Lorg/jetbrains/jewel/ui/component/ComposableSingletons$DefaultBannerKt; + public static field lambda-1 Lkotlin/jvm/functions/Function2; + public static field lambda-2 Lkotlin/jvm/functions/Function2; + public static field lambda-3 Lkotlin/jvm/functions/Function2; + public static field lambda-4 Lkotlin/jvm/functions/Function2; + public fun ()V + public final fun getLambda-1$ui ()Lkotlin/jvm/functions/Function2; + public final fun getLambda-2$ui ()Lkotlin/jvm/functions/Function2; + public final fun getLambda-3$ui ()Lkotlin/jvm/functions/Function2; + public final fun getLambda-4$ui ()Lkotlin/jvm/functions/Function2; +} + +public final class org/jetbrains/jewel/ui/component/ComposableSingletons$InlineBannerKt { + public static final field INSTANCE Lorg/jetbrains/jewel/ui/component/ComposableSingletons$InlineBannerKt; public static field lambda-1 Lkotlin/jvm/functions/Function2; public static field lambda-2 Lkotlin/jvm/functions/Function2; public static field lambda-3 Lkotlin/jvm/functions/Function2; @@ -318,6 +325,13 @@ public final class org/jetbrains/jewel/ui/component/ContextSubmenu : androidx/co public final fun getSubmenu ()Lkotlin/jvm/functions/Function0; } +public final class org/jetbrains/jewel/ui/component/DefaultBannerKt { + public static final fun ErrorDefaultBanner (Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/runtime/Composer;II)V + public static final fun InformationDefaultBanner (Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/runtime/Composer;II)V + public static final fun SuccessDefaultBanner (Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/runtime/Composer;II)V + public static final fun WarningDefaultBanner (Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lorg/jetbrains/jewel/ui/component/styling/DefaultBannerStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/runtime/Composer;II)V +} + public final class org/jetbrains/jewel/ui/component/DividerKt { public static final fun Divider-RLL6an4 (Lorg/jetbrains/jewel/ui/Orientation;Landroidx/compose/ui/Modifier;JFFLorg/jetbrains/jewel/ui/component/styling/DividerStyle;Landroidx/compose/runtime/Composer;II)V } @@ -440,6 +454,13 @@ public final class org/jetbrains/jewel/ui/component/IconKt { public static final fun painterResource (Ljava/lang/String;Landroidx/compose/runtime/Composer;I)Landroidx/compose/ui/graphics/painter/Painter; } +public final class org/jetbrains/jewel/ui/component/InlineBannerKt { + public static final fun ErrorInlineBanner (Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/runtime/Composer;II)V + public static final fun InformationInlineBanner (Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/runtime/Composer;II)V + public static final fun SuccessInlineBanner (Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/runtime/Composer;II)V + public static final fun WarningInlineBanner (Ljava/lang/String;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/runtime/Composer;II)V +} + public final class org/jetbrains/jewel/ui/component/InputFieldState : org/jetbrains/jewel/foundation/state/FocusableComponentState { public static final field Companion Lorg/jetbrains/jewel/ui/component/InputFieldState$Companion; public static final synthetic fun box-impl (J)Lorg/jetbrains/jewel/ui/component/InputFieldState; @@ -1110,6 +1131,7 @@ public final class org/jetbrains/jewel/ui/component/styling/BannerMetrics$Compan public final class org/jetbrains/jewel/ui/component/styling/BannerStylingKt { public static final fun getLocalDefaultBannerStyle ()Landroidx/compose/runtime/ProvidableCompositionLocal; + public static final fun getLocalInlineBannerStyle ()Landroidx/compose/runtime/ProvidableCompositionLocal; } public final class org/jetbrains/jewel/ui/component/styling/ButtonColors { @@ -1743,6 +1765,36 @@ public final class org/jetbrains/jewel/ui/component/styling/IconButtonStylingKt public static final fun getLocalIconButtonStyle ()Landroidx/compose/runtime/ProvidableCompositionLocal; } +public final class org/jetbrains/jewel/ui/component/styling/InlineBannerStyle { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle$Companion; + public fun (Lorg/jetbrains/jewel/ui/component/styling/BannerColors;Lorg/jetbrains/jewel/ui/component/styling/BannerMetrics;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getColors ()Lorg/jetbrains/jewel/ui/component/styling/BannerColors; + public final fun getMetrics ()Lorg/jetbrains/jewel/ui/component/styling/BannerMetrics; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class org/jetbrains/jewel/ui/component/styling/InlineBannerStyle$Companion { +} + +public final class org/jetbrains/jewel/ui/component/styling/InlineBannerStyles { + public static final field $stable I + public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyles$Companion; + public fun (Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle;Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle;Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle;Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle;)V + public fun equals (Ljava/lang/Object;)Z + public final fun getError ()Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle; + public final fun getInformation ()Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle; + public final fun getSuccess ()Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle; + public final fun getWarning ()Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyle; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class org/jetbrains/jewel/ui/component/styling/InlineBannerStyles$Companion { +} + public abstract interface class org/jetbrains/jewel/ui/component/styling/InputFieldColors { public abstract fun backgroundFor-xB6EZ8U (JLandroidx/compose/runtime/Composer;I)Landroidx/compose/runtime/State; public abstract fun borderFor-xB6EZ8U (JLandroidx/compose/runtime/Composer;I)Landroidx/compose/runtime/State; @@ -4723,6 +4775,7 @@ public final class org/jetbrains/jewel/ui/theme/JewelThemeKt { public static final fun getHorizontalProgressBarStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/HorizontalProgressBarStyle; public static final fun getIconButtonStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/IconButtonStyle; public static final fun getIconData (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/foundation/theme/ThemeIconData; + public static final fun getInlineBannerStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/InlineBannerStyles; 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; diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/DefaultComponentStyling.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/DefaultComponentStyling.kt index 1cbbe9659..e10c948f1 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/DefaultComponentStyling.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/DefaultComponentStyling.kt @@ -17,6 +17,7 @@ import org.jetbrains.jewel.ui.component.styling.DropdownStyle import org.jetbrains.jewel.ui.component.styling.GroupHeaderStyle import org.jetbrains.jewel.ui.component.styling.HorizontalProgressBarStyle import org.jetbrains.jewel.ui.component.styling.IconButtonStyle +import org.jetbrains.jewel.ui.component.styling.InlineBannerStyles import org.jetbrains.jewel.ui.component.styling.LazyTreeStyle import org.jetbrains.jewel.ui.component.styling.LinkStyle import org.jetbrains.jewel.ui.component.styling.LocalCheckboxStyle @@ -32,6 +33,7 @@ import org.jetbrains.jewel.ui.component.styling.LocalEditorTabStyle import org.jetbrains.jewel.ui.component.styling.LocalGroupHeaderStyle import org.jetbrains.jewel.ui.component.styling.LocalHorizontalProgressBarStyle import org.jetbrains.jewel.ui.component.styling.LocalIconButtonStyle +import org.jetbrains.jewel.ui.component.styling.LocalInlineBannerStyle import org.jetbrains.jewel.ui.component.styling.LocalLazyTreeStyle import org.jetbrains.jewel.ui.component.styling.LocalLinkStyle import org.jetbrains.jewel.ui.component.styling.LocalMenuStyle @@ -78,6 +80,7 @@ public class DefaultComponentStyling( public val groupHeaderStyle: GroupHeaderStyle, public val horizontalProgressBarStyle: HorizontalProgressBarStyle, public val iconButtonStyle: IconButtonStyle, + public val inlineBannerStyle: InlineBannerStyles, public val lazyTreeStyle: LazyTreeStyle, public val linkStyle: LinkStyle, public val menuStyle: MenuStyle, @@ -112,6 +115,7 @@ public class DefaultComponentStyling( LocalGroupHeaderStyle provides groupHeaderStyle, LocalHorizontalProgressBarStyle provides horizontalProgressBarStyle, LocalIconButtonStyle provides iconButtonStyle, + LocalInlineBannerStyle provides inlineBannerStyle, LocalLazyTreeStyle provides lazyTreeStyle, LocalLinkStyle provides linkStyle, LocalMenuStyle provides menuStyle, diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Banner.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/DefaultBanner.kt similarity index 74% rename from ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Banner.kt rename to ui/src/main/kotlin/org/jetbrains/jewel/ui/component/DefaultBanner.kt index 42bc155ed..7ae154d77 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/Banner.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/DefaultBanner.kt @@ -15,6 +15,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import org.jetbrains.jewel.foundation.theme.JewelTheme import org.jetbrains.jewel.ui.Orientation @@ -23,7 +24,7 @@ import org.jetbrains.jewel.ui.icons.AllIconsKeys import org.jetbrains.jewel.ui.theme.defaultBannerStyle @Composable -public fun InformationBanner( +public fun InformationDefaultBanner( text: String, modifier: Modifier = Modifier, icon: (@Composable () -> Unit)? = { Icon(AllIconsKeys.General.BalloonInformation, null) }, @@ -31,11 +32,18 @@ public fun InformationBanner( style: DefaultBannerStyle = JewelTheme.defaultBannerStyle.information, textStyle: TextStyle = JewelTheme.defaultTextStyle, ) { - BannerImpl(text = text, style = style, textStyle = textStyle, icon = icon, actions = actions, modifier = modifier) + DefaultBannerImpl( + text = text, + style = style, + textStyle = textStyle, + icon = icon, + actions = actions, + modifier = modifier, + ) } @Composable -public fun SuccessBanner( +public fun SuccessDefaultBanner( text: String, modifier: Modifier = Modifier, icon: (@Composable () -> Unit)? = { Icon(AllIconsKeys.Debugger.ThreadStates.Idle, null) }, @@ -43,11 +51,18 @@ public fun SuccessBanner( style: DefaultBannerStyle = JewelTheme.defaultBannerStyle.success, textStyle: TextStyle = JewelTheme.defaultTextStyle, ) { - BannerImpl(text = text, style = style, textStyle = textStyle, icon = icon, actions = actions, modifier = modifier) + DefaultBannerImpl( + text = text, + style = style, + textStyle = textStyle, + icon = icon, + actions = actions, + modifier = modifier, + ) } @Composable -public fun WarningBanner( +public fun WarningDefaultBanner( text: String, modifier: Modifier = Modifier, icon: (@Composable () -> Unit)? = { Icon(AllIconsKeys.General.BalloonWarning, null) }, @@ -55,11 +70,18 @@ public fun WarningBanner( style: DefaultBannerStyle = JewelTheme.defaultBannerStyle.warning, textStyle: TextStyle = JewelTheme.defaultTextStyle, ) { - BannerImpl(text = text, style = style, textStyle = textStyle, icon = icon, actions = actions, modifier = modifier) + DefaultBannerImpl( + text = text, + style = style, + textStyle = textStyle, + icon = icon, + actions = actions, + modifier = modifier, + ) } @Composable -public fun ErrorBanner( +public fun ErrorDefaultBanner( text: String, modifier: Modifier = Modifier, icon: (@Composable () -> Unit)? = { Icon(AllIconsKeys.General.BalloonError, null) }, @@ -67,11 +89,18 @@ public fun ErrorBanner( style: DefaultBannerStyle = JewelTheme.defaultBannerStyle.error, textStyle: TextStyle = JewelTheme.defaultTextStyle, ) { - BannerImpl(text = text, style = style, textStyle = textStyle, icon = icon, actions = actions, modifier = modifier) + DefaultBannerImpl( + text = text, + style = style, + textStyle = textStyle, + icon = icon, + actions = actions, + modifier = modifier, + ) } @Composable -private fun BannerImpl( +private fun DefaultBannerImpl( text: String, style: DefaultBannerStyle, textStyle: TextStyle, @@ -89,9 +118,18 @@ private fun BannerImpl( Box(Modifier.size(16.dp), contentAlignment = Alignment.Center) { icon() } Spacer(modifier = Modifier.width(8.dp)) } - Text(text = text, style = textStyle) - Spacer(modifier = Modifier.weight(1f)) + + Text( + text = text, + modifier = Modifier.weight(1f), + style = textStyle, + maxLines = 1, + overflow = TextOverflow.Ellipsis, + ) + if (actions != null) { + Spacer(Modifier.width(8.dp)) + Row( horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically, diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/InlineBanner.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/InlineBanner.kt new file mode 100644 index 000000000..ace3c27bb --- /dev/null +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/InlineBanner.kt @@ -0,0 +1,200 @@ +@file:OptIn(ExperimentalLayoutApi::class) + +package org.jetbrains.jewel.ui.component + +import androidx.compose.foundation.background +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.ExperimentalLayoutApi +import androidx.compose.foundation.layout.FlowRow +import androidx.compose.foundation.layout.FlowRowScope +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.RowScope +import androidx.compose.foundation.layout.Spacer +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.shape.CornerSize +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.runtime.Composable +import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.testTag +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import org.jetbrains.jewel.foundation.theme.JewelTheme +import org.jetbrains.jewel.foundation.theme.LocalContentColor +import org.jetbrains.jewel.ui.component.styling.InlineBannerStyle +import org.jetbrains.jewel.ui.icons.AllIconsKeys +import org.jetbrains.jewel.ui.theme.inlineBannerStyle +import org.jetbrains.jewel.ui.util.thenIf + +@Composable +public fun InformationInlineBanner( + text: String, + modifier: Modifier = Modifier, + icon: (@Composable () -> Unit)? = { Icon(AllIconsKeys.General.BalloonInformation, null) }, + actions: (@Composable FlowRowScope.() -> Unit)? = null, + actionIcons: (@Composable RowScope.() -> Unit)? = null, + style: InlineBannerStyle = JewelTheme.inlineBannerStyle.information, + textStyle: TextStyle = JewelTheme.defaultTextStyle, +) { + InlineBannerImpl( + text = text, + style = style, + textStyle = textStyle, + icon = icon, + actions = actions, + modifier = modifier, + actionIcons = actionIcons, + ) +} + +@Composable +public fun SuccessInlineBanner( + text: String, + modifier: Modifier = Modifier, + icon: (@Composable () -> Unit)? = { Icon(AllIconsKeys.Debugger.ThreadStates.Idle, null) }, + actions: (@Composable FlowRowScope.() -> Unit)? = null, + actionIcons: (@Composable RowScope.() -> Unit)? = null, + style: InlineBannerStyle = JewelTheme.inlineBannerStyle.success, + textStyle: TextStyle = JewelTheme.defaultTextStyle, +) { + InlineBannerImpl( + text = text, + style = style, + textStyle = textStyle, + icon = icon, + actions = actions, + modifier = modifier, + actionIcons = actionIcons, + ) +} + +@Composable +public fun WarningInlineBanner( + text: String, + modifier: Modifier = Modifier, + icon: (@Composable () -> Unit)? = { Icon(AllIconsKeys.General.BalloonWarning, null) }, + actions: (@Composable FlowRowScope.() -> Unit)? = null, + actionIcons: (@Composable RowScope.() -> Unit)? = null, + style: InlineBannerStyle = JewelTheme.inlineBannerStyle.warning, + textStyle: TextStyle = JewelTheme.defaultTextStyle, +) { + InlineBannerImpl( + text = text, + style = style, + textStyle = textStyle, + icon = icon, + actions = actions, + modifier = modifier, + actionIcons = actionIcons, + ) +} + +@Composable +public fun ErrorInlineBanner( + text: String, + modifier: Modifier = Modifier, + icon: (@Composable () -> Unit)? = { Icon(AllIconsKeys.General.BalloonError, null) }, + actions: (@Composable FlowRowScope.() -> Unit)? = null, + actionIcons: (@Composable RowScope.() -> Unit)? = null, + style: InlineBannerStyle = JewelTheme.inlineBannerStyle.error, + textStyle: TextStyle = JewelTheme.defaultTextStyle, +) { + InlineBannerImpl( + text = text, + style = style, + textStyle = textStyle, + icon = icon, + actions = actions, + modifier = modifier, + actionIcons = actionIcons, + ) +} + +@OptIn(ExperimentalLayoutApi::class) +@Composable +private fun InlineBannerImpl( + text: String, + style: InlineBannerStyle, + textStyle: TextStyle, + icon: @Composable (() -> Unit)?, + actions: @Composable (FlowRowScope.() -> Unit)?, + actionIcons: @Composable (RowScope.() -> Unit)?, + modifier: Modifier, +) { + val borderColor = style.colors.border + RoundedCornerBox( + modifier = modifier.testTag("InlineBanner"), + borderColor = borderColor, + backgroundColor = style.colors.background, + contentColor = JewelTheme.contentColor, + borderWidth = 1.dp, + cornerSize = CornerSize(8.dp), + padding = PaddingValues(), + ) { + Row(modifier = Modifier.padding(start = 12.dp)) { + if (icon != null) { + Box(modifier = Modifier.padding(top = 12.dp, bottom = 12.dp).size(16.dp)) { icon() } + Spacer(Modifier.width(8.dp)) + } + + Column( + modifier = + Modifier.weight(1f) + .padding(top = 12.dp, bottom = 12.dp) // kftmt plz behave + .thenIf(actionIcons == null) { padding(end = 12.dp) } + ) { + Text(text = text, style = textStyle) + + if (actions != null) { + Spacer(Modifier.height(8.dp)) + FlowRow(horizontalArrangement = Arrangement.spacedBy(16.dp)) { actions() } + } + } + + if (actionIcons != null) { + Spacer(Modifier.width(8.dp)) + Row( + modifier = Modifier.align(Alignment.Top).padding(top = 8.dp, end = 8.dp, bottom = 8.dp), + horizontalArrangement = Arrangement.spacedBy(2.dp), + ) { + actionIcons() + } + } + } + } +} + +@Composable +internal fun RoundedCornerBox( + modifier: Modifier = Modifier, + contentColor: Color, + borderColor: Color, + borderWidth: Dp, + cornerSize: CornerSize, + backgroundColor: Color, + padding: PaddingValues, + content: @Composable () -> Unit, +) { + val shape = RoundedCornerShape(cornerSize) + Box( + modifier = + modifier + .border(borderWidth, borderColor, shape) + .background(backgroundColor, shape) + .clip(shape) + .padding(padding) + ) { + CompositionLocalProvider(LocalContentColor provides contentColor) { content() } + } +} diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/BannerStyling.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/BannerStyling.kt index fa009fd45..99f797398 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/BannerStyling.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/BannerStyling.kt @@ -25,6 +25,23 @@ public class DefaultBannerStyle(public val colors: BannerColors, public val metr public companion object } +@Stable +@GenerateDataFunctions +public class InlineBannerStyles( + public val information: InlineBannerStyle, + public val success: InlineBannerStyle, + public val warning: InlineBannerStyle, + public val error: InlineBannerStyle, +) { + public companion object +} + +@Stable +@GenerateDataFunctions +public class InlineBannerStyle(public val colors: BannerColors, public val metrics: BannerMetrics) { + public companion object +} + @Immutable @GenerateDataFunctions public class BannerColors(public val background: Color, public val border: Color) { @@ -40,3 +57,7 @@ public class BannerMetrics(public val borderWidth: Dp) { public val LocalDefaultBannerStyle: ProvidableCompositionLocal = staticCompositionLocalOf { error("No DefaultBannerStyle provided. Have you forgotten the theme?") } + +public val LocalInlineBannerStyle: ProvidableCompositionLocal = staticCompositionLocalOf { + error("No InlineBannerStyle provided. Have you forgotten the theme?") +} diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/theme/JewelTheme.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/theme/JewelTheme.kt index d5a2b5d6d..348aebe9c 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/theme/JewelTheme.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/theme/JewelTheme.kt @@ -21,6 +21,7 @@ import org.jetbrains.jewel.ui.component.styling.DropdownStyle import org.jetbrains.jewel.ui.component.styling.GroupHeaderStyle import org.jetbrains.jewel.ui.component.styling.HorizontalProgressBarStyle import org.jetbrains.jewel.ui.component.styling.IconButtonStyle +import org.jetbrains.jewel.ui.component.styling.InlineBannerStyles import org.jetbrains.jewel.ui.component.styling.LazyTreeStyle import org.jetbrains.jewel.ui.component.styling.LinkStyle import org.jetbrains.jewel.ui.component.styling.LocalCheckboxStyle @@ -36,6 +37,7 @@ import org.jetbrains.jewel.ui.component.styling.LocalEditorTabStyle import org.jetbrains.jewel.ui.component.styling.LocalGroupHeaderStyle import org.jetbrains.jewel.ui.component.styling.LocalHorizontalProgressBarStyle import org.jetbrains.jewel.ui.component.styling.LocalIconButtonStyle +import org.jetbrains.jewel.ui.component.styling.LocalInlineBannerStyle import org.jetbrains.jewel.ui.component.styling.LocalLazyTreeStyle import org.jetbrains.jewel.ui.component.styling.LocalLinkStyle import org.jetbrains.jewel.ui.component.styling.LocalMenuStyle @@ -102,6 +104,9 @@ public val JewelTheme.Companion.comboBoxStyle: ComboBoxStyle public val JewelTheme.Companion.groupHeaderStyle: GroupHeaderStyle @Composable @ReadOnlyComposable get() = LocalGroupHeaderStyle.current +public val JewelTheme.Companion.inlineBannerStyle: InlineBannerStyles + @Composable @ReadOnlyComposable get() = LocalInlineBannerStyle.current + public val JewelTheme.Companion.linkStyle: LinkStyle @Composable @ReadOnlyComposable get() = LocalLinkStyle.current