Skip to content

Commit

Permalink
Merge pull request #298 from Spendesk/release/1.18.1
Browse files Browse the repository at this point in the history
Release/1.18.1
  • Loading branch information
Scythe14 committed Nov 15, 2023
2 parents e7cdbb1 + 3d04bcb commit 3fc0380
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
grapes-version = '1.18.0'
grapes-version = '1.18.1'
androidMinSdk = "21"
androidTargetSdk = "34"
androidCompileSdk = "34"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.OutlinedTextFieldDefaults
import androidx.compose.material3.Text
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
Expand Down Expand Up @@ -56,12 +55,14 @@ internal fun GrapesBaseTextField(
enabled: Boolean = true,
readOnly: Boolean = false,
textStyle: TextStyle = GrapesTheme.typography.bodyRegular,
singleLine: Boolean = false,
maxLines: Int = if (singleLine) 1 else Int.MAX_VALUE,
minLines: Int = 1,
textPadding: PaddingValues = GrapesTextFieldDefaults.textFieldPadding(),
isError: Boolean = false,
onClick: (() -> Unit)? = null,
keyboardActions: KeyboardActions = KeyboardActions.Default,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
singleLine: Boolean = false,
colors: GrapesTextFieldColors = GrapesTextFieldDefaults.textFieldColors(),
visualTransformation: VisualTransformation = VisualTransformation.None,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
Expand Down Expand Up @@ -118,11 +119,13 @@ internal fun GrapesBaseTextField(
readOnly = readOnly,
textStyle = textStyle,
textPadding = textPadding,
singleLine = singleLine,
minLines = minLines,
maxLines = maxLines,
isError = isError,
onClick = onClick,
keyboardActions = keyboardActions,
keyboardOptions = keyboardOptions,
singleLine = singleLine,
colors = colors,
visualTransformation = visualTransformation,
interactionSource = interactionSource,
Expand All @@ -145,10 +148,12 @@ internal fun GrapesBaseTextField(
textStyle: TextStyle = GrapesTheme.typography.bodyRegular,
textPadding: PaddingValues = GrapesTextFieldDefaults.textFieldPadding(),
isError: Boolean = false,
singleLine: Boolean = false,
maxLines: Int = if (singleLine) 1 else Int.MAX_VALUE,
minLines: Int = 1,
onClick: (() -> Unit)? = null,
keyboardActions: KeyboardActions = KeyboardActions.Default,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
singleLine: Boolean = false,
colors: GrapesTextFieldColors = GrapesTextFieldDefaults.textFieldColors(),
visualTransformation: VisualTransformation = VisualTransformation.None,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
Expand Down Expand Up @@ -184,6 +189,8 @@ internal fun GrapesBaseTextField(
keyboardActions = keyboardActions,
interactionSource = interactionSource,
singleLine = singleLine,
minLines = minLines,
maxLines = maxLines,
decorationBox = @Composable { innerTextField ->
GrapesBasicTextFieldDecorationBox(
value = value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import kotlinx.coroutines.launch
* @author jean-philippe
* @since 05/01/2023, Thu
**/
@SuppressWarnings("LongParameterList")
@ExperimentalMaterial3Api
@Composable
fun GrapesTextInput(
Expand All @@ -62,6 +63,9 @@ fun GrapesTextInput(
colors: GrapesTextFieldColors = GrapesTextFieldDefaults.textFieldColors(),
isError: Boolean = false,
onClick: (() -> Unit)? = null,
singleLine: Boolean = true,
maxLines: Int = if (singleLine) 1 else Int.MAX_VALUE,
minLines: Int = 1,
keyboardActions: KeyboardActions = KeyboardActions.Default,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
visualTransformation: VisualTransformation = VisualTransformation.None,
Expand All @@ -82,13 +86,16 @@ fun GrapesTextInput(
onClick = onClick,
keyboardActions = keyboardActions,
keyboardOptions = keyboardOptions,
singleLine = true,
singleLine = singleLine,
minLines = minLines,
maxLines = maxLines,
visualTransformation = visualTransformation,
leadingIcon = leadingIcon,
trailingIcon = trailingIcon
)
}

@SuppressWarnings("LongParameterList")
@ExperimentalMaterial3Api
@Composable
fun GrapesTextInput(
Expand All @@ -103,6 +110,9 @@ fun GrapesTextInput(
colors: GrapesTextFieldColors = GrapesTextFieldDefaults.textFieldColors(),
isError: Boolean = false,
onClick: (() -> Unit)? = null,
singleLine: Boolean = true,
maxLines: Int = if (singleLine) 1 else Int.MAX_VALUE,
minLines: Int = 1,
keyboardActions: KeyboardActions = KeyboardActions.Default,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
visualTransformation: VisualTransformation = VisualTransformation.None,
Expand All @@ -121,9 +131,11 @@ fun GrapesTextInput(
colors = colors,
isError = isError,
onClick = onClick,
singleLine = singleLine,
minLines = minLines,
maxLines = maxLines,
keyboardActions = keyboardActions,
keyboardOptions = keyboardOptions,
singleLine = true,
visualTransformation = visualTransformation,
leadingIcon = leadingIcon,
trailingIcon = trailingIcon
Expand All @@ -138,6 +150,7 @@ fun GrapesTextInput(
fun PreviewGrapesTextField() {

var isEnabled by remember { mutableStateOf(true) }
var isSingleLine by remember { mutableStateOf(false) }
var isReadOnly by remember { mutableStateOf(false) }
var showLeadingIcon by remember { mutableStateOf(false) }
var showTrailingIcon by remember { mutableStateOf(false) }
Expand Down Expand Up @@ -262,6 +275,12 @@ fun PreviewGrapesTextField() {
isChecked = isReadOnly,
onCheckedChange = { isChecked -> isReadOnly = isChecked }
)

PreviewRowOptionSwitch(
label = "SingleLIne",
isChecked = isSingleLine,
onCheckedChange = { isChecked -> isSingleLine = isChecked }
)
}
)
}
Expand All @@ -273,6 +292,7 @@ fun PreviewGrapesTextField() {
placeholderValue = "This is a placeholder",
enabled = isEnabled,
readOnly = isReadOnly,
singleLine = isSingleLine,
helperText = helperText,
isError = isError,
onValueChange = { textFieldValue = it },
Expand Down

0 comments on commit 3fc0380

Please sign in to comment.