diff --git a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/SwingBridgeService.kt b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/SwingBridgeService.kt index 21d38cb8fc..390f0af74a 100644 --- a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/SwingBridgeService.kt +++ b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/SwingBridgeService.kt @@ -77,10 +77,9 @@ internal class SwingBridgeService : Disposable { themeDefinition = createBridgeThemeDefinition(TextStyle.Default), componentStyling = createBridgeComponentStyling( theme = themeDefinition, - textAreaTextStyle = TextStyle.Default, textFieldTextStyle = TextStyle.Default, + textAreaTextStyle = TextStyle.Default, dropdownTextStyle = TextStyle.Default, - labelTextStyle = TextStyle.Default, linkTextStyle = TextStyle.Default, ), ) 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 501d8fdaeb..097666496f 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 @@ -20,11 +20,9 @@ import com.intellij.ui.JBColor import com.intellij.util.ui.DirProvider import com.intellij.util.ui.JBUI import com.intellij.util.ui.NamedColorUtil -import com.intellij.util.ui.StatusText import org.jetbrains.jewel.bridge.bridgePainterProvider import org.jetbrains.jewel.bridge.createVerticalBrush import org.jetbrains.jewel.bridge.dp -import org.jetbrains.jewel.bridge.minus import org.jetbrains.jewel.bridge.readFromLaF import org.jetbrains.jewel.bridge.retrieveArcAsCornerSizeWithFallbacks import org.jetbrains.jewel.bridge.retrieveColorOrUnspecified @@ -67,11 +65,6 @@ import org.jetbrains.jewel.ui.component.styling.HorizontalProgressBarStyle import org.jetbrains.jewel.ui.component.styling.IconButtonColors import org.jetbrains.jewel.ui.component.styling.IconButtonMetrics import org.jetbrains.jewel.ui.component.styling.IconButtonStyle -import org.jetbrains.jewel.ui.component.styling.InputFieldStyle -import org.jetbrains.jewel.ui.component.styling.LabelledTextFieldColors -import org.jetbrains.jewel.ui.component.styling.LabelledTextFieldMetrics -import org.jetbrains.jewel.ui.component.styling.LabelledTextFieldStyle -import org.jetbrains.jewel.ui.component.styling.LabelledTextFieldTextStyles import org.jetbrains.jewel.ui.component.styling.LazyTreeColors import org.jetbrains.jewel.ui.component.styling.LazyTreeIcons import org.jetbrains.jewel.ui.component.styling.LazyTreeMetrics @@ -146,12 +139,11 @@ internal fun createBridgeThemeDefinition(textStyle: TextStyle): ThemeDefinition @OptIn(DependsOnJBR::class) internal suspend fun createBridgeComponentStyling( theme: ThemeDefinition, -): ComponentStyling = createBridgeComponentStyling( +) = createBridgeComponentStyling( theme = theme, - textAreaTextStyle = retrieveTextStyle("TextArea.font", "TextArea.foreground"), textFieldTextStyle = retrieveTextStyle("TextField.font", "TextField.foreground"), + textAreaTextStyle = retrieveTextStyle("TextArea.font", "TextArea.foreground"), dropdownTextStyle = retrieveTextStyle("ComboBox.font"), - labelTextStyle = retrieveTextStyle("Label.font"), linkTextStyle = retrieveTextStyle("Label.font"), ) @@ -160,7 +152,6 @@ internal fun createBridgeComponentStyling( textFieldTextStyle: TextStyle, textAreaTextStyle: TextStyle, dropdownTextStyle: TextStyle, - labelTextStyle: TextStyle, linkTextStyle: TextStyle, ): ComponentStyling { logger.debug("Obtaining Int UI component styling from Swing...") @@ -180,7 +171,6 @@ internal fun createBridgeComponentStyling( groupHeaderStyle = readGroupHeaderStyle(), horizontalProgressBarStyle = readHorizontalProgressBarStyle(), iconButtonStyle = readIconButtonStyle(), - labelledTextFieldStyle = readLabelledTextFieldStyle(textFieldStyle, labelTextStyle), lazyTreeStyle = readLazyTreeStyle(), linkStyle = readLinkStyle(linkTextStyle), menuStyle = menuStyle, @@ -502,54 +492,6 @@ private fun readHorizontalProgressBarStyle() = HorizontalProgressBarStyle( indeterminateCycleDuration = 800.milliseconds, // See DarculaProgressBarUI.CYCLE_TIME_DEFAULT ) -private fun readLabelledTextFieldStyle( - inputFieldStyle: InputFieldStyle, - labelTextStyle: TextStyle, -): LabelledTextFieldStyle { - val colors = LabelledTextFieldColors( - background = inputFieldStyle.colors.background, - backgroundDisabled = inputFieldStyle.colors.backgroundDisabled, - backgroundFocused = inputFieldStyle.colors.backgroundFocused, - backgroundPressed = inputFieldStyle.colors.backgroundPressed, - backgroundHovered = inputFieldStyle.colors.backgroundHovered, - content = inputFieldStyle.colors.content, - contentDisabled = inputFieldStyle.colors.contentDisabled, - contentFocused = inputFieldStyle.colors.contentFocused, - contentPressed = inputFieldStyle.colors.contentPressed, - contentHovered = inputFieldStyle.colors.contentHovered, - border = inputFieldStyle.colors.border, - borderDisabled = inputFieldStyle.colors.borderDisabled, - borderFocused = inputFieldStyle.colors.borderFocused, - borderPressed = inputFieldStyle.colors.borderPressed, - borderHovered = inputFieldStyle.colors.borderHovered, - caret = inputFieldStyle.colors.caret, - caretDisabled = inputFieldStyle.colors.caretDisabled, - caretFocused = inputFieldStyle.colors.caretFocused, - caretPressed = inputFieldStyle.colors.caretPressed, - caretHovered = inputFieldStyle.colors.caretHovered, - placeholder = retrieveColorOrUnspecified("Label.infoForeground"), - label = retrieveColorOrUnspecified("Label.foreground"), - hint = StatusText.DEFAULT_ATTRIBUTES.fgColor.toComposeColor(), - ) - - return LabelledTextFieldStyle( - colors = colors, - metrics = LabelledTextFieldMetrics( - cornerSize = inputFieldStyle.metrics.cornerSize, - contentPadding = inputFieldStyle.metrics.contentPadding, - minSize = inputFieldStyle.metrics.minSize, - borderWidth = inputFieldStyle.metrics.borderWidth, - labelSpacing = 6.dp, - hintSpacing = 6.dp, - ), - textStyle = inputFieldStyle.textStyle, - textStyles = LabelledTextFieldTextStyles( - label = labelTextStyle, - hint = labelTextStyle.copy(fontSize = labelTextStyle.fontSize - 1f), - ), - ) -} - private fun readLinkStyle( linkTextStyle: TextStyle, ): LinkStyle { 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 441ece9b24..6933d8b7c7 100644 --- a/int-ui/int-ui-standalone/api/int-ui-standalone.api +++ b/int-ui/int-ui-standalone/api/int-ui-standalone.api @@ -177,19 +177,6 @@ public final class org/jetbrains/jewel/intui/standalone/styling/IntUiIconButtonS public static final fun light-cAAHkqY (Lorg/jetbrains/jewel/ui/component/styling/IconButtonColors$Companion;JJJJJJJJJJLandroidx/compose/runtime/Composer;III)Lorg/jetbrains/jewel/ui/component/styling/IconButtonColors; } -public final class org/jetbrains/jewel/intui/standalone/styling/IntUiLabelledTextFieldStylingKt { - public static final fun dark (Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldStyle$Companion;Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldColors;Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldMetrics;Landroidx/compose/ui/text/TextStyle;Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldTextStyles;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldStyle; - public static final fun dark (Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldTextStyles$Companion;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;)Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldTextStyles; - public static synthetic fun dark$default (Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldTextStyles$Companion;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;ILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldTextStyles; - public static final fun dark-uKsWAxw (Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldColors$Companion;JJJJJJJJJJJJJJJJJJJJJJJLandroidx/compose/runtime/Composer;IIII)Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldColors; - public static final fun defaults-KJzYnEk (Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldMetrics$Companion;Landroidx/compose/foundation/shape/CornerSize;Landroidx/compose/foundation/layout/PaddingValues;JFFF)Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldMetrics; - public static synthetic fun defaults-KJzYnEk$default (Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldMetrics$Companion;Landroidx/compose/foundation/shape/CornerSize;Landroidx/compose/foundation/layout/PaddingValues;JFFFILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldMetrics; - public static final fun light (Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldStyle$Companion;Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldColors;Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldMetrics;Landroidx/compose/ui/text/TextStyle;Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldTextStyles;Landroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldStyle; - public static final fun light (Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldTextStyles$Companion;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;)Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldTextStyles; - public static synthetic fun light$default (Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldTextStyles$Companion;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;ILjava/lang/Object;)Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldTextStyles; - public static final fun light-uKsWAxw (Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldColors$Companion;JJJJJJJJJJJJJJJJJJJJJJJLandroidx/compose/runtime/Composer;IIII)Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldColors; -} - 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/LazyTreeColors;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 dark-v1fvUNM (Lorg/jetbrains/jewel/ui/component/styling/LazyTreeColors$Companion;JJJJJJJLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/ui/component/styling/LazyTreeColors; @@ -345,11 +332,11 @@ 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;Lkotlin/jvm/functions/Function3;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 darkComponentStyling (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;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/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/LabelledTextFieldStyle;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/RadioButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;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 darkComponentStyling (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;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/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/RadioButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;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 darkThemeDefinition-RFMEUTM (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;JLandroidx/compose/runtime/Composer;II)Lorg/jetbrains/jewel/foundation/theme/ThemeDefinition; public static final fun defaultComponentStyling (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Lorg/jetbrains/jewel/foundation/theme/ThemeDefinition;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/ComponentStyling; public static final fun getDefaultTextStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;)Landroidx/compose/ui/text/TextStyle; - public static final fun lightComponentStyling (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;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/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/LabelledTextFieldStyle;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/RadioButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;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 lightComponentStyling (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;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/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/RadioButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;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 lightThemeDefinition-RFMEUTM (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;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/IntUiLabelledTextFieldStyling.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiLabelledTextFieldStyling.kt deleted file mode 100644 index 29fb8af61c..0000000000 --- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiLabelledTextFieldStyling.kt +++ /dev/null @@ -1,169 +0,0 @@ -package org.jetbrains.jewel.intui.standalone.styling - -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.shape.CornerSize -import androidx.compose.runtime.Composable -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.DpSize -import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp -import org.jetbrains.jewel.foundation.theme.JewelTheme -import org.jetbrains.jewel.intui.core.theme.IntUiDarkTheme -import org.jetbrains.jewel.intui.core.theme.IntUiLightTheme -import org.jetbrains.jewel.intui.standalone.theme.defaultTextStyle -import org.jetbrains.jewel.ui.component.styling.LabelledTextFieldColors -import org.jetbrains.jewel.ui.component.styling.LabelledTextFieldMetrics -import org.jetbrains.jewel.ui.component.styling.LabelledTextFieldStyle -import org.jetbrains.jewel.ui.component.styling.LabelledTextFieldTextStyles - -@Composable -fun LabelledTextFieldStyle.Companion.light( - colors: LabelledTextFieldColors = LabelledTextFieldColors.light(), - metrics: LabelledTextFieldMetrics = LabelledTextFieldMetrics.defaults(), - textStyle: TextStyle = JewelTheme.defaultTextStyle, - textStyles: LabelledTextFieldTextStyles = LabelledTextFieldTextStyles.light(), -) = LabelledTextFieldStyle(colors, metrics, textStyle, textStyles) - -@Composable -fun LabelledTextFieldStyle.Companion.dark( - colors: LabelledTextFieldColors = LabelledTextFieldColors.dark(), - metrics: LabelledTextFieldMetrics = LabelledTextFieldMetrics.defaults(), - textStyle: TextStyle = JewelTheme.defaultTextStyle, - textStyles: LabelledTextFieldTextStyles = LabelledTextFieldTextStyles.dark(), -) = LabelledTextFieldStyle(colors, metrics, textStyle, textStyles) - -@Composable -fun LabelledTextFieldColors.Companion.light( - background: Color = IntUiLightTheme.colors.grey(14), - backgroundDisabled: Color = IntUiLightTheme.colors.grey(13), - backgroundFocused: Color = background, - backgroundPressed: Color = background, - backgroundHovered: Color = background, - content: Color = IntUiLightTheme.colors.grey(1), - contentDisabled: Color = IntUiLightTheme.colors.grey(8), - contentFocused: Color = content, - contentPressed: Color = content, - contentHovered: Color = content, - border: Color = IntUiLightTheme.colors.grey(9), - borderDisabled: Color = IntUiLightTheme.colors.grey(11), - borderFocused: Color = IntUiLightTheme.colors.blue(4), - borderPressed: Color = border, - borderHovered: Color = border, - caret: Color = IntUiLightTheme.colors.grey(1), - caretDisabled: Color = caret, - caretFocused: Color = caret, - caretPressed: Color = caret, - caretHovered: Color = caret, - placeholder: Color = IntUiLightTheme.colors.grey(8), - label: Color = Color.Unspecified, - hint: Color = IntUiLightTheme.colors.grey(6), -) = LabelledTextFieldColors( - background, - backgroundDisabled, - backgroundFocused, - backgroundPressed, - backgroundHovered, - content, - contentDisabled, - contentFocused, - contentPressed, - contentHovered, - border, - borderDisabled, - borderFocused, - borderPressed, - borderHovered, - caret, - caretDisabled, - caretFocused, - caretPressed, - caretHovered, - placeholder, - label, - hint, -) - -@Composable -fun LabelledTextFieldColors.Companion.dark( - background: Color = IntUiDarkTheme.colors.grey(2), - backgroundDisabled: Color = background, - backgroundFocused: Color = background, - backgroundPressed: Color = background, - backgroundHovered: Color = background, - content: Color = IntUiDarkTheme.colors.grey(12), - contentDisabled: Color = IntUiDarkTheme.colors.grey(7), - contentFocused: Color = content, - contentPressed: Color = content, - contentHovered: Color = content, - border: Color = IntUiDarkTheme.colors.grey(5), - borderDisabled: Color = border, - borderFocused: Color = IntUiDarkTheme.colors.blue(6), - borderPressed: Color = border, - borderHovered: Color = border, - caret: Color = IntUiDarkTheme.colors.grey(12), - caretDisabled: Color = caret, - caretFocused: Color = caret, - caretPressed: Color = caret, - caretHovered: Color = caret, - placeholder: Color = IntUiDarkTheme.colors.grey(7), - label: Color = Color.Unspecified, - hint: Color = IntUiDarkTheme.colors.grey(7), -) = LabelledTextFieldColors( - background, - backgroundDisabled, - backgroundFocused, - backgroundPressed, - backgroundHovered, - content, - contentDisabled, - contentFocused, - contentPressed, - contentHovered, - border, - borderDisabled, - borderFocused, - borderPressed, - borderHovered, - caret, - caretDisabled, - caretFocused, - caretPressed, - caretHovered, - placeholder, - label, - hint, -) - -fun LabelledTextFieldMetrics.Companion.defaults( - cornerSize: CornerSize = CornerSize(4.dp), - contentPadding: PaddingValues = PaddingValues(horizontal = 9.dp, vertical = 6.dp), - minSize: DpSize = DpSize(49.dp, 24.dp), - borderWidth: Dp = 1.dp, - labelSpacing: Dp = 6.dp, - hintSpacing: Dp = 6.dp, -) = LabelledTextFieldMetrics( - borderWidth, - contentPadding, - cornerSize, - minSize, - labelSpacing, - hintSpacing, -) - -fun LabelledTextFieldTextStyles.Companion.light( - label: TextStyle = JewelTheme.defaultTextStyle, - hint: TextStyle = JewelTheme.defaultTextStyle.copy( - fontSize = 12.sp, - lineHeight = 16.sp, - ), -) = LabelledTextFieldTextStyles(label, hint) - -fun LabelledTextFieldTextStyles.Companion.dark( - label: TextStyle = JewelTheme.defaultTextStyle, - hint: TextStyle = JewelTheme.defaultTextStyle.copy( - fontSize = 12.sp, - lineHeight = 16.sp, - ), -) = LabelledTextFieldTextStyles(label, hint) 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 e15b486e6c..e61e53350f 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 @@ -34,7 +34,6 @@ 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.LabelledTextFieldStyle import org.jetbrains.jewel.ui.component.styling.LazyTreeStyle import org.jetbrains.jewel.ui.component.styling.LinkStyle import org.jetbrains.jewel.ui.component.styling.MenuStyle @@ -93,7 +92,6 @@ fun JewelTheme.Companion.darkComponentStyling( groupHeaderStyle: GroupHeaderStyle = GroupHeaderStyle.dark(), horizontalProgressBarStyle: HorizontalProgressBarStyle = HorizontalProgressBarStyle.dark(), iconButtonStyle: IconButtonStyle = IconButtonStyle.dark(), - labelledTextFieldStyle: LabelledTextFieldStyle = LabelledTextFieldStyle.dark(), lazyTreeStyle: LazyTreeStyle = LazyTreeStyle.dark(), linkStyle: LinkStyle = LinkStyle.dark(), menuStyle: MenuStyle = MenuStyle.dark(), @@ -116,7 +114,6 @@ fun JewelTheme.Companion.darkComponentStyling( groupHeaderStyle = groupHeaderStyle, horizontalProgressBarStyle = horizontalProgressBarStyle, iconButtonStyle = iconButtonStyle, - labelledTextFieldStyle = labelledTextFieldStyle, lazyTreeStyle = lazyTreeStyle, linkStyle = linkStyle, menuStyle = menuStyle, @@ -142,7 +139,6 @@ fun JewelTheme.Companion.lightComponentStyling( groupHeaderStyle: GroupHeaderStyle = GroupHeaderStyle.light(), horizontalProgressBarStyle: HorizontalProgressBarStyle = HorizontalProgressBarStyle.light(), iconButtonStyle: IconButtonStyle = IconButtonStyle.light(), - labelledTextFieldStyle: LabelledTextFieldStyle = LabelledTextFieldStyle.light(), lazyTreeStyle: LazyTreeStyle = LazyTreeStyle.light(), linkStyle: LinkStyle = LinkStyle.light(), menuStyle: MenuStyle = MenuStyle.light(), @@ -165,7 +161,6 @@ fun JewelTheme.Companion.lightComponentStyling( groupHeaderStyle = groupHeaderStyle, horizontalProgressBarStyle = horizontalProgressBarStyle, iconButtonStyle = iconButtonStyle, - labelledTextFieldStyle = labelledTextFieldStyle, lazyTreeStyle = lazyTreeStyle, linkStyle = linkStyle, menuStyle = menuStyle, diff --git a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/TextFields.kt b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/TextFields.kt index 8ad2c560fa..8a97973e59 100644 --- a/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/TextFields.kt +++ b/samples/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/TextFields.kt @@ -1,23 +1,35 @@ package org.jetbrains.jewel.samples.standalone.components +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.animation.fadeIn +import androidx.compose.animation.fadeOut +import androidx.compose.animation.slideInHorizontally +import androidx.compose.animation.slideOutHorizontally +import androidx.compose.foundation.clickable +import androidx.compose.foundation.interaction.HoverInteraction +import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.size import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.input.pointer.PointerIcon +import androidx.compose.ui.input.pointer.pointerHoverIcon +import androidx.compose.ui.semantics.Role import androidx.compose.ui.unit.dp import org.jetbrains.jewel.samples.standalone.StandaloneSampleIcons import org.jetbrains.jewel.ui.Outline import org.jetbrains.jewel.ui.component.GroupHeader import org.jetbrains.jewel.ui.component.Icon -import org.jetbrains.jewel.ui.component.LabelledTextField import org.jetbrains.jewel.ui.component.Text import org.jetbrains.jewel.ui.component.TextField +import org.jetbrains.jewel.ui.painter.rememberResourcePainterProvider @Composable fun TextFields() { @@ -47,29 +59,74 @@ fun TextFields() { verticalAlignment = Alignment.Top, ) { var text1 by remember { mutableStateOf("") } - LabelledTextField( - value = text1, - onValueChange = { text1 = it }, - label = { Text("Label:") }, - placeholder = { Text("Labelled TextField") }, + TextField( + text1, + { text1 = it }, + enabled = true, + leadingIcon = { + Icon( + resource = "icons/search.svg", + contentDescription = "SearchIcon", + iconClass = StandaloneSampleIcons::class.java, + modifier = Modifier.size(16.dp), + ) + }, + placeholder = { + Text("With leading icon") + }, ) var text2 by remember { mutableStateOf("") } - LabelledTextField( - value = text2, - onValueChange = { text2 = it }, - label = { Text("Label:") }, - hint = { Text("Attached hint text") }, - placeholder = { Text("Labelled TextField with hint") }, + TextField( + text2, + { text2 = it }, + enabled = true, + trailingIcon = { + AnimatedVisibility( + visible = text2.isNotEmpty(), + enter = fadeIn() + slideInHorizontally { it / 2 }, + exit = fadeOut() + slideOutHorizontally { it / 2 }, + ) { + CloseIconButton { text2 = "" } + } + }, + placeholder = { + Text("With trailing button") + }, ) } - Row( - horizontalArrangement = Arrangement.spacedBy(16.dp), - verticalAlignment = Alignment.Top, - ) { - var text by remember { mutableStateOf("With leading icon") } - TextField(text, { text = it }, enabled = true, leadingIcon = { - Icon("icons/search.svg", "SearchIcon", StandaloneSampleIcons::class.java, Modifier.size(16.dp)) - }) +} + +@Composable +private fun CloseIconButton(onClick: () -> Unit) { + val interactionSource = remember { MutableInteractionSource() } + var hovered by remember { mutableStateOf(false) } + + LaunchedEffect(interactionSource) { + interactionSource.interactions.collect { + when (it) { + is HoverInteraction.Enter -> hovered = true + is HoverInteraction.Exit -> hovered = false + } + } } + + val closeIconProvider = rememberResourcePainterProvider("icons/close.svg", StandaloneSampleIcons::class.java) + val closeIcon by closeIconProvider.getPainter() + + val hoveredCloseIconProvider = + rememberResourcePainterProvider("icons/closeHovered.svg", StandaloneSampleIcons::class.java) + val hoveredCloseIcon by hoveredCloseIconProvider.getPainter() + + Icon( + painter = if (hovered) hoveredCloseIcon else closeIcon, + contentDescription = "Clear", + modifier = Modifier + .pointerHoverIcon(PointerIcon.Default) + .clickable( + interactionSource = interactionSource, + indication = null, + role = Role.Button, + ) { onClick() }, + ) } diff --git a/ui/api/ui.api b/ui/api/ui.api index 03febb736f..a6b6838926 100644 --- a/ui/api/ui.api +++ b/ui/api/ui.api @@ -1,6 +1,6 @@ public final class 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/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/LabelledTextFieldStyle;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/RadioButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;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/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/RadioButtonStyle;Lorg/jetbrains/jewel/ui/component/styling/ScrollbarStyle;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; @@ -13,7 +13,6 @@ public final class org/jetbrains/jewel/ui/ComponentStyling { 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 getLabelledTextFieldStyle ()Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldStyle; 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; @@ -314,11 +313,6 @@ public final class org/jetbrains/jewel/ui/component/InputFieldState$Companion { public static synthetic fun of-raUdB0Y$default (Lorg/jetbrains/jewel/ui/component/InputFieldState$Companion;ZZZZZILjava/lang/Object;)J } -public final class org/jetbrains/jewel/ui/component/LabelledTextFieldKt { - public static final fun LabelledTextField (Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;Landroidx/compose/ui/Modifier;Landroidx/compose/ui/Modifier;ZZLorg/jetbrains/jewel/ui/Outline;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;ZLandroidx/compose/ui/text/input/VisualTransformation;Landroidx/compose/foundation/text/KeyboardOptions;Landroidx/compose/foundation/text/KeyboardActions;Lkotlin/jvm/functions/Function1;Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/foundation/interaction/MutableInteractionSource;Landroidx/compose/runtime/Composer;III)V - public static final fun LabelledTextField (Lkotlin/jvm/functions/Function2;Landroidx/compose/ui/text/input/TextFieldValue;Lkotlin/jvm/functions/Function1;Landroidx/compose/ui/Modifier;Landroidx/compose/ui/Modifier;ZZLorg/jetbrains/jewel/ui/Outline;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;ZLandroidx/compose/ui/text/input/VisualTransformation;Landroidx/compose/foundation/text/KeyboardOptions;Landroidx/compose/foundation/text/KeyboardActions;Lkotlin/jvm/functions/Function1;Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldStyle;Landroidx/compose/ui/text/TextStyle;Landroidx/compose/foundation/interaction/MutableInteractionSource;Landroidx/compose/runtime/Composer;III)V -} - public final class org/jetbrains/jewel/ui/component/LazyTreeKt { public static final fun LazyTree (Lorg/jetbrains/jewel/foundation/lazy/tree/Tree;Landroidx/compose/ui/Modifier;Lkotlin/jvm/functions/Function1;Lorg/jetbrains/jewel/foundation/lazy/tree/TreeState;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lorg/jetbrains/jewel/foundation/lazy/tree/KeyBindingActions;Lorg/jetbrains/jewel/ui/component/styling/LazyTreeStyle;Lkotlin/jvm/functions/Function4;Landroidx/compose/runtime/Composer;II)V } @@ -1198,102 +1192,6 @@ public abstract interface class org/jetbrains/jewel/ui/component/styling/InputFi public abstract fun getTextStyle ()Landroidx/compose/ui/text/TextStyle; } -public final class org/jetbrains/jewel/ui/component/styling/LabelledTextFieldColors : org/jetbrains/jewel/ui/component/styling/InputFieldColors { - public static final field $stable I - public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldColors$Companion; - public synthetic fun (JJJJJJJJJJJJJJJJJJJJJJJLkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun asTextFieldColors ()Lorg/jetbrains/jewel/ui/component/styling/TextFieldColors; - public fun backgroundFor-xB6EZ8U (JLandroidx/compose/runtime/Composer;I)Landroidx/compose/runtime/State; - public fun borderFor-xB6EZ8U (JLandroidx/compose/runtime/Composer;I)Landroidx/compose/runtime/State; - public fun caretFor-xB6EZ8U (JLandroidx/compose/runtime/Composer;I)Landroidx/compose/runtime/State; - public fun contentFor-xB6EZ8U (JLandroidx/compose/runtime/Composer;I)Landroidx/compose/runtime/State; - public fun equals (Ljava/lang/Object;)Z - public fun getBackground-0d7_KjU ()J - public fun getBackgroundDisabled-0d7_KjU ()J - public fun getBackgroundFocused-0d7_KjU ()J - public fun getBackgroundHovered-0d7_KjU ()J - public fun getBackgroundPressed-0d7_KjU ()J - public fun getBorder-0d7_KjU ()J - public fun getBorderDisabled-0d7_KjU ()J - public fun getBorderFocused-0d7_KjU ()J - public fun getBorderHovered-0d7_KjU ()J - public fun getBorderPressed-0d7_KjU ()J - public fun getCaret-0d7_KjU ()J - public fun getCaretDisabled-0d7_KjU ()J - public fun getCaretFocused-0d7_KjU ()J - public fun getCaretHovered-0d7_KjU ()J - public fun getCaretPressed-0d7_KjU ()J - public fun getContent-0d7_KjU ()J - public fun getContentDisabled-0d7_KjU ()J - public fun getContentFocused-0d7_KjU ()J - public fun getContentHovered-0d7_KjU ()J - public fun getContentPressed-0d7_KjU ()J - public final fun getHint-0d7_KjU ()J - public final fun getLabel-0d7_KjU ()J - public final fun getPlaceholder-0d7_KjU ()J - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class org/jetbrains/jewel/ui/component/styling/LabelledTextFieldColors$Companion { -} - -public final class org/jetbrains/jewel/ui/component/styling/LabelledTextFieldMetrics : org/jetbrains/jewel/ui/component/styling/InputFieldMetrics { - public static final field $stable I - public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldMetrics$Companion; - public synthetic fun (FLandroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/shape/CornerSize;JFFLkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun asTextFieldMetrics ()Lorg/jetbrains/jewel/ui/component/styling/TextFieldMetrics; - public fun equals (Ljava/lang/Object;)Z - public fun getBorderWidth-D9Ej5fM ()F - public fun getContentPadding ()Landroidx/compose/foundation/layout/PaddingValues; - public fun getCornerSize ()Landroidx/compose/foundation/shape/CornerSize; - public final fun getHintSpacing-D9Ej5fM ()F - public final fun getLabelSpacing-D9Ej5fM ()F - public fun getMinSize-MYxV2XQ ()J - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class org/jetbrains/jewel/ui/component/styling/LabelledTextFieldMetrics$Companion { -} - -public final class org/jetbrains/jewel/ui/component/styling/LabelledTextFieldStyle : org/jetbrains/jewel/ui/component/styling/InputFieldStyle { - public static final field $stable I - public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldStyle$Companion; - public fun (Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldColors;Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldMetrics;Landroidx/compose/ui/text/TextStyle;Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldTextStyles;)V - public final fun asTextFieldStyle ()Lorg/jetbrains/jewel/ui/component/styling/TextFieldStyle; - public fun equals (Ljava/lang/Object;)Z - public synthetic fun getColors ()Lorg/jetbrains/jewel/ui/component/styling/InputFieldColors; - public fun getColors ()Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldColors; - public synthetic fun getMetrics ()Lorg/jetbrains/jewel/ui/component/styling/InputFieldMetrics; - public fun getMetrics ()Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldMetrics; - public fun getTextStyle ()Landroidx/compose/ui/text/TextStyle; - public final fun getTextStyles ()Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldTextStyles; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class org/jetbrains/jewel/ui/component/styling/LabelledTextFieldStyle$Companion { -} - -public final class org/jetbrains/jewel/ui/component/styling/LabelledTextFieldStylingKt { - public static final fun getLocalLabelledTextFieldStyle ()Landroidx/compose/runtime/ProvidableCompositionLocal; -} - -public final class org/jetbrains/jewel/ui/component/styling/LabelledTextFieldTextStyles { - public static final field $stable I - public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldTextStyles$Companion; - public fun (Landroidx/compose/ui/text/TextStyle;Landroidx/compose/ui/text/TextStyle;)V - public fun equals (Ljava/lang/Object;)Z - public final fun getHint ()Landroidx/compose/ui/text/TextStyle; - public final fun getLabel ()Landroidx/compose/ui/text/TextStyle; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class org/jetbrains/jewel/ui/component/styling/LabelledTextFieldTextStyles$Companion { -} - public final class org/jetbrains/jewel/ui/component/styling/LazyTreeColors { public static final field $stable I public static final field Companion Lorg/jetbrains/jewel/ui/component/styling/LazyTreeColors$Companion; @@ -2248,7 +2146,6 @@ 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 getLabelledTextFieldStyle (Lorg/jetbrains/jewel/foundation/theme/JewelTheme$Companion;Landroidx/compose/runtime/Composer;I)Lorg/jetbrains/jewel/ui/component/styling/LabelledTextFieldStyle; 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/ComponentStyling.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/ComponentStyling.kt index a4a5a9f637..d74f039169 100644 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/ComponentStyling.kt +++ b/ui/src/main/kotlin/org/jetbrains/jewel/ui/ComponentStyling.kt @@ -6,11 +6,41 @@ import androidx.compose.runtime.ProvidedValue import androidx.compose.runtime.Stable import org.jetbrains.jewel.foundation.GenerateDataFunctions import org.jetbrains.jewel.ui.component.ContextMenuRepresentation +import org.jetbrains.jewel.ui.component.styling.ButtonStyle +import org.jetbrains.jewel.ui.component.styling.CheckboxStyle +import org.jetbrains.jewel.ui.component.styling.ChipStyle +import org.jetbrains.jewel.ui.component.styling.CircularProgressStyle +import org.jetbrains.jewel.ui.component.styling.DividerStyle +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.LazyTreeStyle +import org.jetbrains.jewel.ui.component.styling.LinkStyle +import org.jetbrains.jewel.ui.component.styling.LocalCheckboxStyle +import org.jetbrains.jewel.ui.component.styling.LocalChipStyle +import org.jetbrains.jewel.ui.component.styling.LocalCircularProgressStyle +import org.jetbrains.jewel.ui.component.styling.LocalDefaultButtonStyle +import org.jetbrains.jewel.ui.component.styling.LocalDefaultDropdownStyle import org.jetbrains.jewel.ui.component.styling.LocalDefaultTabStyle +import org.jetbrains.jewel.ui.component.styling.LocalDividerStyle import org.jetbrains.jewel.ui.component.styling.LocalEditorTabStyle +import org.jetbrains.jewel.ui.component.styling.LocalGroupHeaderStyle +import org.jetbrains.jewel.ui.component.styling.LocalHorizontalProgressBarStyle +import org.jetbrains.jewel.ui.component.styling.LocalIconButtonStyle +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.LocalRadioButtonStyle +import org.jetbrains.jewel.ui.component.styling.LocalScrollbarStyle import org.jetbrains.jewel.ui.component.styling.LocalTextAreaStyle import org.jetbrains.jewel.ui.component.styling.LocalTextFieldStyle import org.jetbrains.jewel.ui.component.styling.LocalTooltipStyle +import org.jetbrains.jewel.ui.component.styling.LocalUndecoratedDropdownStyle +import org.jetbrains.jewel.ui.component.styling.MenuStyle +import org.jetbrains.jewel.ui.component.styling.RadioButtonStyle +import org.jetbrains.jewel.ui.component.styling.ScrollbarStyle import org.jetbrains.jewel.ui.component.styling.TabStyle import org.jetbrains.jewel.ui.component.styling.TextAreaStyle import org.jetbrains.jewel.ui.component.styling.TextFieldStyle @@ -19,54 +49,52 @@ import org.jetbrains.jewel.ui.component.styling.TooltipStyle @Stable @GenerateDataFunctions class ComponentStyling( - val checkboxStyle: org.jetbrains.jewel.ui.component.styling.CheckboxStyle, - val chipStyle: org.jetbrains.jewel.ui.component.styling.ChipStyle, - val circularProgressStyle: org.jetbrains.jewel.ui.component.styling.CircularProgressStyle, - val defaultButtonStyle: org.jetbrains.jewel.ui.component.styling.ButtonStyle, - val defaultDropdownStyle: org.jetbrains.jewel.ui.component.styling.DropdownStyle, + val checkboxStyle: CheckboxStyle, + val chipStyle: ChipStyle, + val circularProgressStyle: CircularProgressStyle, + val defaultButtonStyle: ButtonStyle, + val defaultDropdownStyle: DropdownStyle, val defaultTabStyle: TabStyle, - val dividerStyle: org.jetbrains.jewel.ui.component.styling.DividerStyle, + val dividerStyle: DividerStyle, val editorTabStyle: TabStyle, - val groupHeaderStyle: org.jetbrains.jewel.ui.component.styling.GroupHeaderStyle, - val horizontalProgressBarStyle: org.jetbrains.jewel.ui.component.styling.HorizontalProgressBarStyle, - val iconButtonStyle: org.jetbrains.jewel.ui.component.styling.IconButtonStyle, - val labelledTextFieldStyle: org.jetbrains.jewel.ui.component.styling.LabelledTextFieldStyle, - val lazyTreeStyle: org.jetbrains.jewel.ui.component.styling.LazyTreeStyle, - val linkStyle: org.jetbrains.jewel.ui.component.styling.LinkStyle, - val menuStyle: org.jetbrains.jewel.ui.component.styling.MenuStyle, - val outlinedButtonStyle: org.jetbrains.jewel.ui.component.styling.ButtonStyle, - val radioButtonStyle: org.jetbrains.jewel.ui.component.styling.RadioButtonStyle, - val scrollbarStyle: org.jetbrains.jewel.ui.component.styling.ScrollbarStyle, + val groupHeaderStyle: GroupHeaderStyle, + val horizontalProgressBarStyle: HorizontalProgressBarStyle, + val iconButtonStyle: IconButtonStyle, + val lazyTreeStyle: LazyTreeStyle, + val linkStyle: LinkStyle, + val menuStyle: MenuStyle, + val outlinedButtonStyle: ButtonStyle, + val radioButtonStyle: RadioButtonStyle, + val scrollbarStyle: ScrollbarStyle, val textAreaStyle: TextAreaStyle, val textFieldStyle: TextFieldStyle, val tooltipStyle: TooltipStyle, - val undecoratedDropdownStyle: org.jetbrains.jewel.ui.component.styling.DropdownStyle, + val undecoratedDropdownStyle: DropdownStyle, ) { @Composable fun providedStyles(): Array> = arrayOf( - org.jetbrains.jewel.ui.component.styling.LocalCheckboxStyle provides checkboxStyle, - org.jetbrains.jewel.ui.component.styling.LocalChipStyle provides chipStyle, - org.jetbrains.jewel.ui.component.styling.LocalCircularProgressStyle provides circularProgressStyle, + LocalCheckboxStyle provides checkboxStyle, + LocalChipStyle provides chipStyle, + LocalCircularProgressStyle provides circularProgressStyle, LocalContextMenuRepresentation provides ContextMenuRepresentation, - org.jetbrains.jewel.ui.component.styling.LocalDefaultButtonStyle provides defaultButtonStyle, - org.jetbrains.jewel.ui.component.styling.LocalDefaultDropdownStyle provides defaultDropdownStyle, + LocalDefaultButtonStyle provides defaultButtonStyle, + LocalDefaultDropdownStyle provides defaultDropdownStyle, LocalDefaultTabStyle provides defaultTabStyle, - org.jetbrains.jewel.ui.component.styling.LocalDividerStyle provides dividerStyle, + LocalDividerStyle provides dividerStyle, LocalEditorTabStyle provides editorTabStyle, - org.jetbrains.jewel.ui.component.styling.LocalGroupHeaderStyle provides groupHeaderStyle, - org.jetbrains.jewel.ui.component.styling.LocalHorizontalProgressBarStyle provides horizontalProgressBarStyle, - org.jetbrains.jewel.ui.component.styling.LocalIconButtonStyle provides iconButtonStyle, - org.jetbrains.jewel.ui.component.styling.LocalLabelledTextFieldStyle provides labelledTextFieldStyle, - org.jetbrains.jewel.ui.component.styling.LocalLazyTreeStyle provides lazyTreeStyle, - org.jetbrains.jewel.ui.component.styling.LocalLinkStyle provides linkStyle, - org.jetbrains.jewel.ui.component.styling.LocalMenuStyle provides menuStyle, - org.jetbrains.jewel.ui.component.styling.LocalOutlinedButtonStyle provides outlinedButtonStyle, - org.jetbrains.jewel.ui.component.styling.LocalRadioButtonStyle provides radioButtonStyle, - org.jetbrains.jewel.ui.component.styling.LocalScrollbarStyle provides scrollbarStyle, + LocalGroupHeaderStyle provides groupHeaderStyle, + LocalHorizontalProgressBarStyle provides horizontalProgressBarStyle, + LocalIconButtonStyle provides iconButtonStyle, + LocalLazyTreeStyle provides lazyTreeStyle, + LocalLinkStyle provides linkStyle, + LocalMenuStyle provides menuStyle, + LocalOutlinedButtonStyle provides outlinedButtonStyle, + LocalRadioButtonStyle provides radioButtonStyle, + LocalScrollbarStyle provides scrollbarStyle, LocalTextAreaStyle provides textAreaStyle, LocalTextFieldStyle provides textFieldStyle, LocalTooltipStyle provides tooltipStyle, - org.jetbrains.jewel.ui.component.styling.LocalUndecoratedDropdownStyle provides undecoratedDropdownStyle, + LocalUndecoratedDropdownStyle provides undecoratedDropdownStyle, ) } diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/LabelledTextField.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/LabelledTextField.kt deleted file mode 100644 index 826ca81ec9..0000000000 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/LabelledTextField.kt +++ /dev/null @@ -1,230 +0,0 @@ -package org.jetbrains.jewel.ui.component - -import androidx.compose.foundation.interaction.MutableInteractionSource -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.text.KeyboardActions -import androidx.compose.foundation.text.KeyboardOptions -import androidx.compose.runtime.Composable -import androidx.compose.runtime.CompositionLocalProvider -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.layout.Layout -import androidx.compose.ui.layout.layoutId -import androidx.compose.ui.text.TextLayoutResult -import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.text.input.TextFieldValue -import androidx.compose.ui.text.input.VisualTransformation -import androidx.compose.ui.unit.offset -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.Outline -import org.jetbrains.jewel.ui.component.styling.LabelledTextFieldStyle -import org.jetbrains.jewel.ui.theme.labelledTextFieldStyle - -/** - * @param label the label to display above the component. - * @param hint the optional hint to be displayed underneath the component. - * By default it will have a greyed out appearance and smaller text. - * @param placeholder the optional placeholder to be displayed over the - * component when the [value] is empty. - */ -@Composable -fun LabelledTextField( - value: String, - onValueChange: (String) -> Unit, - label: @Composable () -> Unit, - modifier: Modifier = Modifier, - textFieldModifier: Modifier = Modifier, - enabled: Boolean = true, - readOnly: Boolean = false, - outline: Outline = Outline.None, - hint: @Composable (() -> Unit)? = null, - placeholder: @Composable (() -> Unit)? = null, - trailingIcon: @Composable (() -> Unit)? = null, - leadingIcon: @Composable (() -> Unit)? = null, - undecorated: Boolean = false, - visualTransformation: VisualTransformation = VisualTransformation.None, - keyboardOptions: KeyboardOptions = KeyboardOptions.Default, - keyboardActions: KeyboardActions = KeyboardActions(), - onTextLayout: (TextLayoutResult) -> Unit = {}, - style: LabelledTextFieldStyle = JewelTheme.labelledTextFieldStyle, - textStyle: TextStyle = JewelTheme.textStyle, - interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, -) { - var textFieldValueState by remember { mutableStateOf(TextFieldValue(text = value)) } - val textFieldValue = textFieldValueState.copy(text = value) - var lastTextValue by remember(value) { mutableStateOf(value) } - - LabelledTextField( - label = label, - value = textFieldValue, - onValueChange = { - textFieldValueState = it - if (it.text != lastTextValue) { - lastTextValue = it.text - onValueChange(it.text) - } - }, - modifier = modifier, - textFieldModifier = textFieldModifier, - enabled = enabled, - readOnly = readOnly, - outline = outline, - hint = hint, - placeholder = placeholder, - trailingIcon = trailingIcon, - leadingIcon = leadingIcon, - undecorated = undecorated, - visualTransformation = visualTransformation, - keyboardOptions = keyboardOptions, - keyboardActions = keyboardActions, - onTextLayout = onTextLayout, - style = style, - textStyle = textStyle, - interactionSource = interactionSource, - ) -} - -/** - * @param label the label to display above the component. - * @param hint the optional hint to be displayed underneath the component. - * By default it will have a greyed out appearance and smaller text. - * @param placeholder the optional placeholder to be displayed over the - * component when the [value] is empty. - */ -@Composable -fun LabelledTextField( - label: @Composable () -> Unit, - value: TextFieldValue, - onValueChange: (TextFieldValue) -> Unit, - modifier: Modifier = Modifier, - textFieldModifier: Modifier = Modifier, - enabled: Boolean = true, - readOnly: Boolean = false, - outline: Outline = Outline.None, - hint: @Composable (() -> Unit)? = null, - placeholder: @Composable (() -> Unit)? = null, - trailingIcon: @Composable (() -> Unit)? = null, - leadingIcon: @Composable (() -> Unit)? = null, - undecorated: Boolean = false, - visualTransformation: VisualTransformation = VisualTransformation.None, - keyboardOptions: KeyboardOptions = KeyboardOptions.Default, - keyboardActions: KeyboardActions = KeyboardActions(), - onTextLayout: (TextLayoutResult) -> Unit = {}, - style: LabelledTextFieldStyle = JewelTheme.labelledTextFieldStyle, - textStyle: TextStyle = JewelTheme.textStyle, - interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, -) { - LabelledTextFieldLayout( - modifier = modifier, - label = label, - textField = { - TextField( - value = value, - onValueChange = onValueChange, - modifier = textFieldModifier, - enabled = enabled, - readOnly = readOnly, - outline = outline, - placeholder = placeholder, - trailingIcon = trailingIcon, - leadingIcon = leadingIcon, - undecorated = undecorated, - visualTransformation = visualTransformation, - keyboardOptions = keyboardOptions, - keyboardActions = keyboardActions, - onTextLayout = onTextLayout, - style = style.asTextFieldStyle(), - textStyle = textStyle, - interactionSource = interactionSource, - ) - }, - hint = hint?.let { - { - CompositionLocalProvider( - LocalTextStyle provides style.textStyles.hint, - LocalContentColor provides style.colors.hint, - content = it, - ) - } - }, - style = style, - ) -} - -@Composable -private fun LabelledTextFieldLayout( - modifier: Modifier, - label: @Composable () -> Unit, - textField: @Composable () -> Unit, - hint: (@Composable () -> Unit)?, - style: LabelledTextFieldStyle, -) { - val labelSpacing = style.metrics.labelSpacing - val hintSpacing = style.metrics.hintSpacing - Layout( - modifier = modifier, - content = { - Box(modifier = Modifier.layoutId(LABEL_ID), contentAlignment = Alignment.Center) { - label() - } - Box(modifier = Modifier.layoutId(TEXT_FIELD_ID), propagateMinConstraints = true) { - textField() - } - if (hint != null) { - Box(modifier = Modifier.layoutId(HINT_ID), contentAlignment = Alignment.Center) { - hint() - } - } - }, - ) { measurables, incomingConstraints -> - val hintMeasurable = measurables.firstOrNull { it.layoutId == HINT_ID } - - val horizontalSpacing = labelSpacing.roundToPx() - val verticalSpacing = if (hintMeasurable == null) 0 else hintSpacing.roundToPx() - - val constraintsWithoutSpacing = incomingConstraints.offset( - horizontal = -horizontalSpacing, - vertical = -verticalSpacing, - ) - - val textFieldPlaceable = measurables.first { it.layoutId == TEXT_FIELD_ID } - .measure(constraintsWithoutSpacing) - - val labelPlaceable = measurables.first { it.layoutId == LABEL_ID } - .measure(constraintsWithoutSpacing.offset(horizontal = -textFieldPlaceable.width)) - - val hintPlaceable = hintMeasurable?.measure( - constraintsWithoutSpacing - .offset(vertical = -textFieldPlaceable.height) - .copy(maxWidth = textFieldPlaceable.width), - ) - - val width = labelPlaceable.width + textFieldPlaceable.width + horizontalSpacing - val height = (hintPlaceable?.height ?: 0) + textFieldPlaceable.height + verticalSpacing - - layout(width, height) { - labelPlaceable.placeRelative( - x = 0, - y = Alignment.CenterVertically.align(labelPlaceable.height, textFieldPlaceable.height), - ) - textFieldPlaceable.placeRelative( - x = labelPlaceable.width + horizontalSpacing, - y = 0, - ) - hintPlaceable?.placeRelative( - x = labelPlaceable.width + horizontalSpacing, - y = textFieldPlaceable.height + verticalSpacing, - ) - } - } -} - -private const val LABEL_ID = "Label" -private const val TEXT_FIELD_ID = "TextField" -private const val HINT_ID = "Hint" diff --git a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/LabelledTextFieldStyling.kt b/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/LabelledTextFieldStyling.kt deleted file mode 100644 index 5394161dce..0000000000 --- a/ui/src/main/kotlin/org/jetbrains/jewel/ui/component/styling/LabelledTextFieldStyling.kt +++ /dev/null @@ -1,118 +0,0 @@ -package org.jetbrains.jewel.ui.component.styling - -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.shape.CornerSize -import androidx.compose.runtime.Immutable -import androidx.compose.runtime.Stable -import androidx.compose.runtime.staticCompositionLocalOf -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.DpSize -import org.jetbrains.jewel.foundation.GenerateDataFunctions - -@Stable -@GenerateDataFunctions -class LabelledTextFieldStyle( - override val colors: LabelledTextFieldColors, - override val metrics: LabelledTextFieldMetrics, - override val textStyle: TextStyle, - val textStyles: LabelledTextFieldTextStyles, -) : InputFieldStyle { - - fun asTextFieldStyle(): TextFieldStyle = - TextFieldStyle( - colors = colors.asTextFieldColors(), - metrics = metrics.asTextFieldMetrics(), - textStyle = textStyle, - ) - - companion object -} - -@Immutable -@GenerateDataFunctions -class LabelledTextFieldColors( - override val background: Color, - override val backgroundDisabled: Color, - override val backgroundFocused: Color, - override val backgroundPressed: Color, - override val backgroundHovered: Color, - override val content: Color, - override val contentDisabled: Color, - override val contentFocused: Color, - override val contentPressed: Color, - override val contentHovered: Color, - override val border: Color, - override val borderDisabled: Color, - override val borderFocused: Color, - override val borderPressed: Color, - override val borderHovered: Color, - override val caret: Color, - override val caretDisabled: Color, - override val caretFocused: Color, - override val caretPressed: Color, - override val caretHovered: Color, - val placeholder: Color, - val label: Color, - val hint: Color, -) : InputFieldColors { - - fun asTextFieldColors() = - TextFieldColors( - background, - backgroundDisabled, - backgroundFocused, - backgroundPressed, - backgroundHovered, - content, - contentDisabled, - contentFocused, - contentPressed, - contentHovered, - border, - borderDisabled, - borderFocused, - borderPressed, - borderHovered, - caret, - caretDisabled, - caretFocused, - caretPressed, - caretHovered, - placeholder, - ) - - companion object -} - -@Stable -@GenerateDataFunctions -class LabelledTextFieldMetrics( - override val borderWidth: Dp, - override val contentPadding: PaddingValues, - override val cornerSize: CornerSize, - override val minSize: DpSize, - val labelSpacing: Dp, - val hintSpacing: Dp, -) : InputFieldMetrics { - - fun asTextFieldMetrics() = - TextFieldMetrics(borderWidth, contentPadding, cornerSize, minSize) - - companion object -} - -@Immutable -@GenerateDataFunctions -class LabelledTextFieldTextStyles( - val label: TextStyle, - val hint: TextStyle, -) { - - companion object -} - -val LocalLabelledTextFieldStyle = staticCompositionLocalOf { - error("No LabelledTextFieldStyle provided") -} 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 e7c6e8faa5..8256ec7cec 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,7 +21,6 @@ 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.LabelledTextFieldStyle import org.jetbrains.jewel.ui.component.styling.LazyTreeStyle import org.jetbrains.jewel.ui.component.styling.LinkStyle import org.jetbrains.jewel.ui.component.styling.LocalCheckboxStyle @@ -35,7 +34,6 @@ 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.LocalLabelledTextFieldStyle 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,11 +100,6 @@ val JewelTheme.Companion.groupHeaderStyle: GroupHeaderStyle @ReadOnlyComposable get() = LocalGroupHeaderStyle.current -val JewelTheme.Companion.labelledTextFieldStyle: LabelledTextFieldStyle - @Composable - @ReadOnlyComposable - get() = LocalLabelledTextFieldStyle.current - val JewelTheme.Companion.linkStyle: LinkStyle @Composable @ReadOnlyComposable