Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

All notable changes to this project will be documented in this file.

### Unreleased

The table's text fields run on Compose's state-based text field. Source compatible; recompile libraries that call
these text fields.

- Added: `outputTransformation: OutputTransformation?` on `TableTextField`, `TableCellTextField` and
`TableCellTextFieldWithTooltipError`. It changes how the text is shown and leaves `value` as is.
- Deprecated: the overloads with `visualTransformation`, because Compose 1.13.0 deprecated `VisualTransformation`. Pass
an `OutputTransformation` instead; the overloads will be removed in 4.0.

### 3.11.0 — 2026-12-03

The library builds against Compose Multiplatform 1.13.0 and stable Material 3. No API change.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Migrate off APIs deprecated in Compose 1.13.0

Status: approved 2026-12-03.

## Intent

Build without the deprecation warnings Compose Multiplatform / Material 3 1.13.0 introduced, without breaking
consumers' source. Only `@Deprecated` public overloads kept for compatibility may still use the old APIs.

Non-goals: removing the old API (4.0), clearing unrelated warnings, a public `TextFieldState` API.

## Approaches

1. **`value` + `outputTransformation` (chosen).** Overloads of `TableTextField`, `TableCellTextField` and
`TableCellTextFieldWithTooltipError` take `outputTransformation: OutputTransformation? = null` in place of
`visualTransformation`. Only callers passing a transformation migrate. Cost: an internal bridge between
`value` / `onValueChange` and `TextFieldState`.
2. `TextFieldState` overloads, all value overloads deprecated. No bridge in the public fields, but every consumer
migrates and the filter fields need the same synchronisation.
3. Both. Twice the API to maintain.

## Design

- The new overload runs on `BasicTextField(state)` with `OutlinedTextFieldDefaults.decorator`. The bridge reports
user edits through `onValueChange`, writes a differing `value` back into the state, and treats a value the caller
rejects or rewrites as the truth. A value change from the caller is not reported back.
- The old overload is `@Deprecated` (warning), keeps today's `BasicTextField(value)` implementation under a local
suppression, and has `visualTransformation` without a default; two overloads with every default would be
ambiguous. Source stays compatible; binaries built against the old default must be recompiled.
- `TableDatePicker` text input uses `OutlinedTextField(state)`: an `InputTransformation` keeps digits up to the
format's maximum, an `OutputTransformation` inserts the separators.
- `RangeSlider`, `ListItem`, `runComposeUiTest` and `compose.desktop.currentOs` move to their replacements.
- Tests pin the current text-field and date-input behaviour before the change; CHANGELOG and the docs follow the API.

Builder's call: how the bridge detects edits, and the internal split between the overloads.
2 changes: 1 addition & 1 deletion table-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ kotlin {
implementation(libs.compose.ui.test)
}
jvmTest.dependencies {
implementation(compose.desktop.currentOs)
implementation(libs.compose.desktop.jvm)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.text.input.OutputTransformation
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.TextFieldColors
import androidx.compose.material3.TextFieldDefaults
Expand Down Expand Up @@ -39,7 +40,70 @@ public fun TableCellTextField(
suffix: @Composable (() -> Unit)? = null,
supportingText: @Composable (() -> Unit)? = null,
isError: Boolean = false,
visualTransformation: VisualTransformation = VisualTransformation.None,
outputTransformation: OutputTransformation? = null,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
keyboardActions: KeyboardActions = KeyboardActions.Default,
singleLine: Boolean = false,
maxLines: Int = if (singleLine) 1 else Int.MAX_VALUE,
minLines: Int = 1,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
shape: Shape = RectangleShape,
colors: TextFieldColors = TextFieldDefaults.colors(),
contentPadding: PaddingValues = TableTextFieldDefaults.reducedContentPadding(),
) {
TableTextField(
value = value,
onValueChange = onValueChange,
modifier = modifier.syncEditCellFocus().fillMaxSize(),
enabled = enabled,
readOnly = readOnly,
textStyle = textStyle,
label = label,
placeholder = placeholder,
leadingIcon = leadingIcon,
trailingIcon = trailingIcon,
prefix = prefix,
suffix = suffix,
supportingText = supportingText,
isError = isError,
outputTransformation = outputTransformation,
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
singleLine = singleLine,
maxLines = maxLines,
minLines = minLines,
interactionSource = interactionSource,
shape = shape,
colors = colors,
contentPadding = contentPadding,
showBorder = false,
)
}

@Deprecated(
message =
"Compose deprecated VisualTransformation. Use the overload with outputTransformation; " +
"this one will be removed in 4.0.",
)
// The parameter order is that of the released signature.
@Suppress("DEPRECATION", "ComposableParamOrder")
@Composable
public fun TableCellTextField(
value: String,
onValueChange: (String) -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
readOnly: Boolean = false,
textStyle: TextStyle = LocalTextStyle.current,
label: @Composable (() -> Unit)? = null,
placeholder: @Composable (() -> Unit)? = null,
leadingIcon: @Composable (() -> Unit)? = null,
trailingIcon: @Composable (() -> Unit)? = null,
prefix: @Composable (() -> Unit)? = null,
suffix: @Composable (() -> Unit)? = null,
supportingText: @Composable (() -> Unit)? = null,
isError: Boolean = false,
visualTransformation: VisualTransformation,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
keyboardActions: KeyboardActions = KeyboardActions.Default,
singleLine: Boolean = false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package ua.wwind.table.component

import androidx.compose.foundation.interaction.InteractionSource
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsFocusedAsState
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.text.input.OutputTransformation
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.MaterialTheme
Expand Down Expand Up @@ -50,7 +52,7 @@ import ua.wwind.table.strings.currentStrings
* @param trailingIcon the optional trailing icon to be displayed at the end of the text field container
* @param prefix the optional prefix to be displayed before the input text in the text field
* @param suffix the optional suffix to be displayed after the input text in the text field
* @param visualTransformation transforms the visual representation of the input value
* @param outputTransformation changes how the text is shown, leaving [value] as is
* @param keyboardOptions software keyboard options that contains configuration
* @param keyboardActions when the input service emits an IME action, the corresponding callback is called
* @param singleLine when true, this text field becomes a single horizontally scrolling text field
Expand All @@ -61,7 +63,6 @@ import ua.wwind.table.strings.currentStrings
* @param colors [TextFieldColors] that will be used to resolve the colors used for this text field in different states
* @param contentPadding the padding applied to the inner text field
*/
@OptIn(ExperimentalMaterial3Api::class)
@Composable
public fun TableCellTextFieldWithTooltipError(
value: String,
Expand All @@ -77,7 +78,7 @@ public fun TableCellTextFieldWithTooltipError(
trailingIcon: @Composable (() -> Unit)? = null,
prefix: @Composable (() -> Unit)? = null,
suffix: @Composable (() -> Unit)? = null,
visualTransformation: VisualTransformation = VisualTransformation.None,
outputTransformation: OutputTransformation? = null,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
keyboardActions: KeyboardActions = KeyboardActions.Default,
singleLine: Boolean = false,
Expand All @@ -87,6 +88,103 @@ public fun TableCellTextFieldWithTooltipError(
shape: Shape = RectangleShape,
colors: TextFieldColors = TextFieldDefaults.colors(),
contentPadding: PaddingValues = TableTextFieldDefaults.reducedContentPadding(),
) {
TooltipErrorBox(errorMessage, interactionSource, modifier) {
TableCellTextField(
value = value,
onValueChange = onValueChange,
enabled = enabled,
readOnly = readOnly,
textStyle = textStyle,
label = label,
placeholder = placeholder,
leadingIcon = leadingIcon,
trailingIcon = trailingIcon,
prefix = prefix,
suffix = suffix,
isError = errorMessage.isNotEmpty(),
outputTransformation = outputTransformation,
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
singleLine = singleLine,
maxLines = maxLines,
minLines = minLines,
interactionSource = interactionSource,
shape = shape,
colors = colors,
contentPadding = contentPadding,
)
}
}

@Deprecated(
message =
"Compose deprecated VisualTransformation. Use the overload with outputTransformation; " +
"this one will be removed in 4.0.",
)
// The parameter order is that of the released signature.
@Suppress("DEPRECATION", "ComposableParamOrder")
@Composable
public fun TableCellTextFieldWithTooltipError(
value: String,
onValueChange: (String) -> Unit,
errorMessage: String,
modifier: Modifier = Modifier,
enabled: Boolean = true,
readOnly: Boolean = false,
textStyle: TextStyle = LocalTextStyle.current,
label: @Composable (() -> Unit)? = null,
placeholder: @Composable (() -> Unit)? = null,
leadingIcon: @Composable (() -> Unit)? = null,
trailingIcon: @Composable (() -> Unit)? = null,
prefix: @Composable (() -> Unit)? = null,
suffix: @Composable (() -> Unit)? = null,
visualTransformation: VisualTransformation,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
keyboardActions: KeyboardActions = KeyboardActions.Default,
singleLine: Boolean = false,
maxLines: Int = if (singleLine) 1 else Int.MAX_VALUE,
minLines: Int = 1,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
shape: Shape = RectangleShape,
colors: TextFieldColors = TextFieldDefaults.colors(),
contentPadding: PaddingValues = TableTextFieldDefaults.reducedContentPadding(),
) {
TooltipErrorBox(errorMessage, interactionSource, modifier) {
TableCellTextField(
value = value,
onValueChange = onValueChange,
enabled = enabled,
readOnly = readOnly,
textStyle = textStyle,
label = label,
placeholder = placeholder,
leadingIcon = leadingIcon,
trailingIcon = trailingIcon,
prefix = prefix,
suffix = suffix,
isError = errorMessage.isNotEmpty(),
visualTransformation = visualTransformation,
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
singleLine = singleLine,
maxLines = maxLines,
minLines = minLines,
interactionSource = interactionSource,
shape = shape,
colors = colors,
contentPadding = contentPadding,
)
}
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun TooltipErrorBox(
errorMessage: String,
interactionSource: InteractionSource,
modifier: Modifier = Modifier,
content: @Composable () -> Unit,
) {
val tooltipState = rememberTooltipState(isPersistent = true)
val hasError = errorMessage.isNotEmpty()
Expand Down Expand Up @@ -135,30 +233,7 @@ public fun TableCellTextFieldWithTooltipError(
hasAction = true,
focusable = true,
) {
TableCellTextField(
value = value,
onValueChange = onValueChange,
enabled = enabled,
readOnly = readOnly,
textStyle = textStyle,
label = label,
placeholder = placeholder,
leadingIcon = leadingIcon,
trailingIcon = trailingIcon,
prefix = prefix,
suffix = suffix,
isError = hasError,
visualTransformation = visualTransformation,
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
singleLine = singleLine,
maxLines = maxLines,
minLines = minLines,
interactionSource = interactionSource,
shape = shape,
colors = colors,
contentPadding = contentPadding,
)
content()
}
}
}
Loading
Loading