diff --git a/components/src/main/kotlin/de/jeanlucmakiola/floret/components/InlineTextField.kt b/components/src/main/kotlin/de/jeanlucmakiola/floret/components/InlineTextField.kt index f36aa93..4ec755a 100644 --- a/components/src/main/kotlin/de/jeanlucmakiola/floret/components/InlineTextField.kt +++ b/components/src/main/kotlin/de/jeanlucmakiola/floret/components/InlineTextField.kt @@ -16,6 +16,7 @@ import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.text.input.KeyboardCapitalization import androidx.compose.ui.text.input.KeyboardType +import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.unit.dp /** @@ -42,6 +43,14 @@ fun InlineTextField( imeAction: ImeAction = ImeAction.Default, /** Invoked when the IME action key (e.g. Done) is pressed. */ onImeAction: (() -> Unit)? = null, + /** + * How the value is rendered, as opposed to stored. + * + * Exists so a password can be masked. [KeyboardType.Password] alone does + * not mask anything — it only tells the IME to drop suggestions — so a + * borderless field without this renders the secret in the clear. + */ + visualTransformation: VisualTransformation = VisualTransformation.None, ) { val resolvedStyle = textStyle.copy( color = when { @@ -66,6 +75,7 @@ fun InlineTextField( keyboardActions = onImeAction?.let { action -> KeyboardActions(onAny = { action() }) } ?: KeyboardActions.Default, + visualTransformation = visualTransformation, cursorBrush = SolidColor(MaterialTheme.colorScheme.primary), decorationBox = { innerTextField -> Box {