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
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.TextFieldValue
import io.github.jan.supabase.compose.auth.ui.AuthIcons
import io.github.jan.supabase.compose.auth.ui.AuthState
import io.github.jan.supabase.compose.auth.ui.FormComponent
import io.github.jan.supabase.compose.auth.ui.FormValidator
import io.github.jan.supabase.compose.auth.ui.annotations.AuthUiExperimental
Expand All @@ -38,6 +39,7 @@ import io.github.jan.supabase.compose.auth.ui.rememberMailIcon
* @param keyboardActions The keyboard actions for the email field. Defaults to KeyboardActions.Default.
* @param leadingIcon The leading icon for the email field. Defaults to an email icon.
* @param singleLine Whether the email field should be a single line or multiline. Defaults to true.
* @param isError Whether the email field should display an error state. Defaults to null (handled automatically).
* @param enabled Whether the email field should be enabled for user interaction. Defaults to true.
* @param interactionSource The interaction source for the email field. Defaults to MutableInteractionSource.
* @param textStyle The text style for the email field. Defaults to LocalTextStyle.current.
Expand Down Expand Up @@ -70,6 +72,7 @@ fun EmailField(
},
singleLine: Boolean = true,
enabled: Boolean = true,
isError: Boolean? = null,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
textStyle: TextStyle = LocalTextStyle.current,
shape: Shape = TextFieldDefaults.shape,
Expand All @@ -94,7 +97,7 @@ fun EmailField(
keyboardActions = keyboardActions,
leadingIcon = leadingIcon,
singleLine = singleLine,
isError = !isValidEmail && value.isNotEmpty(),
isError = isError ?: (!isValidEmail && value.isNotEmpty()),
interactionSource = interactionSource,
textStyle = textStyle,
shape = shape,
Expand All @@ -119,6 +122,7 @@ fun EmailField(
* @param keyboardActions The keyboard actions for the email field. Defaults to KeyboardActions.Default.
* @param leadingIcon The leading icon for the email field. Defaults to an email icon.
* @param singleLine Whether the email field should be a single line or multiline. Defaults to true.
* @param isError Whether the email field should display an error state. Defaults to null (handled automatically).
* @param enabled Whether the email field should be enabled for user interaction. Defaults to true.
* @param interactionSource The interaction source for the email field. Defaults to MutableInteractionSource.
* @param textStyle The text style for the email field. Defaults to LocalTextStyle.current.
Expand Down Expand Up @@ -151,6 +155,7 @@ fun EmailField(
},
singleLine: Boolean = true,
enabled: Boolean = true,
isError: Boolean? = null,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
textStyle: TextStyle = LocalTextStyle.current,
shape: Shape = TextFieldDefaults.shape,
Expand All @@ -175,7 +180,7 @@ fun EmailField(
keyboardActions = keyboardActions,
leadingIcon = leadingIcon,
singleLine = singleLine,
isError = !isValidEmail && value.text.isNotEmpty(),
isError = isError ?: (!isValidEmail && value.text.isNotEmpty()),
interactionSource = interactionSource,
textStyle = textStyle,
shape = shape,
Expand All @@ -201,6 +206,7 @@ fun EmailField(
* @param leadingIcon The leading icon for the email field. Defaults to an email icon.
* @param singleLine Whether the email field should be a single line or multiline. Defaults to true.
* @param enabled Whether the email field should be enabled for user interaction. Defaults to true.
* @param isError Whether the email field should display an error state. Defaults to null (handled automatically).
* @param interactionSource The interaction source for the email field. Defaults to MutableInteractionSource.
* @param textStyle The text style for the email field. Defaults to LocalTextStyle.current.
* @param shape The shape of the email field. Defaults to TextFieldDefaults.shape.
Expand Down Expand Up @@ -232,6 +238,7 @@ fun OutlinedEmailField(
},
singleLine: Boolean = true,
enabled: Boolean = true,
isError: Boolean? = null,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
textStyle: TextStyle = LocalTextStyle.current,
shape: Shape = OutlinedTextFieldDefaults.shape,
Expand All @@ -256,7 +263,7 @@ fun OutlinedEmailField(
keyboardActions = keyboardActions,
leadingIcon = leadingIcon,
singleLine = singleLine,
isError = !isValidEmail && value.isNotEmpty(),
isError = isError ?: (!isValidEmail && value.isNotEmpty()),
interactionSource = interactionSource,
textStyle = textStyle,
shape = shape,
Expand All @@ -282,6 +289,7 @@ fun OutlinedEmailField(
* @param leadingIcon The leading icon for the email field. Defaults to an email icon.
* @param singleLine Whether the email field should be a single line or multiline. Defaults to true.
* @param enabled Whether the email field should be enabled for user interaction. Defaults to true.
* @param isError Whether the email field should display an error state. Defaults to null (handled automatically).
* @param interactionSource The interaction source for the email field. Defaults to MutableInteractionSource.
* @param textStyle The text style for the email field. Defaults to LocalTextStyle.current.
* @param shape The shape of the email field. Defaults to TextFieldDefaults.shape.
Expand Down Expand Up @@ -313,6 +321,7 @@ fun OutlinedEmailField(
},
singleLine: Boolean = true,
enabled: Boolean = true,
isError: Boolean? = null,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
textStyle: TextStyle = LocalTextStyle.current,
shape: Shape = OutlinedTextFieldDefaults.shape,
Expand All @@ -337,7 +346,7 @@ fun OutlinedEmailField(
keyboardActions = keyboardActions,
leadingIcon = leadingIcon,
singleLine = singleLine,
isError = !isValidEmail && value.text.isNotEmpty(),
isError = isError ?: (!isValidEmail && value.text.isNotEmpty()),
interactionSource = interactionSource,
textStyle = textStyle,
shape = shape,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import io.github.jan.supabase.compose.auth.ui.rememberVisibilityOffIcon
* @param leadingIcon The leading icon for the password field. Defaults to an email icon.
* @param singleLine Whether the password field should be a single line or multiline. Defaults to true.
* @param enabled Whether the password field should be enabled for user interaction. Defaults to true.
* @param isError Whether the password field should display an error state. Defaults to null (handled automatically).
* @param interactionSource The interaction source for the password field. Defaults to MutableInteractionSource.
* @param textStyle The text style for the password field. Defaults to LocalTextStyle.current.
* @param shape The shape of the password field. Defaults to TextFieldDefaults.shape.
Expand All @@ -69,6 +70,7 @@ fun PasswordField(
readOnly: Boolean = false,
enabled: Boolean = true,
singleLine: Boolean = true,
isError: Boolean? = null,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
textStyle: TextStyle = LocalTextStyle.current,
shape: Shape = TextFieldDefaults.shape,
Expand Down Expand Up @@ -102,7 +104,7 @@ fun PasswordField(
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
singleLine = singleLine,
isError = ruleResults.firstUnfulfilled() != null && value.isNotEmpty(),
isError = isError ?: (ruleResults.firstUnfulfilled() != null && value.isNotEmpty()),
modifier = modifier,
leadingIcon = leadingIcon,
trailingIcon = { trailingIcon?.invoke(showPassword) },
Expand Down Expand Up @@ -131,6 +133,7 @@ fun PasswordField(
* @param leadingIcon The leading icon for the password field. Defaults to an email icon.
* @param singleLine Whether the password field should be a single line or multiline. Defaults to true.
* @param enabled Whether the password field should be enabled for user interaction. Defaults to true.
* @param isError Whether the password field should display an error state. Defaults to null (handled automatically).
* @param interactionSource The interaction source for the password field. Defaults to MutableInteractionSource.
* @param textStyle The text style for the password field. Defaults to LocalTextStyle.current.
* @param shape The shape of the password field. Defaults to TextFieldDefaults.shape.
Expand All @@ -155,6 +158,7 @@ fun PasswordField(
readOnly: Boolean = false,
enabled: Boolean = true,
singleLine: Boolean = true,
isError: Boolean? = null,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
textStyle: TextStyle = LocalTextStyle.current,
shape: Shape = TextFieldDefaults.shape,
Expand Down Expand Up @@ -189,7 +193,7 @@ fun PasswordField(
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
singleLine = singleLine,
isError = ruleResults.firstUnfulfilled() != null && value.text.isNotEmpty(),
isError = isError ?: (ruleResults.firstUnfulfilled() != null && value.text.isNotEmpty()),
modifier = modifier,
leadingIcon = leadingIcon,
trailingIcon = { trailingIcon?.invoke(showPassword) },
Expand Down Expand Up @@ -218,6 +222,7 @@ fun PasswordField(
* @param leadingIcon The leading icon for the password field. Defaults to an email icon.
* @param singleLine Whether the password field should be a single line or multiline. Defaults to true.
* @param enabled Whether the password field should be enabled for user interaction. Defaults to true.
* @param isError Whether the password field should display an error state. Defaults to null (handled automatically).
* @param interactionSource The interaction source for the password field. Defaults to MutableInteractionSource.
* @param textStyle The text style for the password field. Defaults to LocalTextStyle.current.
* @param shape The shape of the password field. Defaults to TextFieldDefaults.shape.
Expand All @@ -242,6 +247,7 @@ fun OutlinedPasswordField(
readOnly: Boolean = false,
enabled: Boolean = true,
singleLine: Boolean = true,
isError: Boolean? = null,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
textStyle: TextStyle = LocalTextStyle.current,
shape: Shape = OutlinedTextFieldDefaults.shape,
Expand Down Expand Up @@ -275,7 +281,7 @@ fun OutlinedPasswordField(
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
singleLine = singleLine,
isError = ruleResults.firstUnfulfilled() != null && value.isNotEmpty(),
isError = isError ?: (ruleResults.firstUnfulfilled() != null && value.isNotEmpty()),
modifier = modifier,
leadingIcon = leadingIcon,
trailingIcon = { trailingIcon?.invoke(showPassword) },
Expand Down Expand Up @@ -304,6 +310,7 @@ fun OutlinedPasswordField(
* @param leadingIcon The leading icon for the password field. Defaults to an email icon.
* @param singleLine Whether the password field should be a single line or multiline. Defaults to true.
* @param enabled Whether the password field should be enabled for user interaction. Defaults to true.
* @param isError Whether the password field should display an error state. Defaults to null (handled automatically).
* @param interactionSource The interaction source for the password field. Defaults to MutableInteractionSource.
* @param textStyle The text style for the password field. Defaults to LocalTextStyle.current.
* @param shape The shape of the password field. Defaults to TextFieldDefaults.shape.
Expand All @@ -327,6 +334,7 @@ fun OutlinedPasswordField(
keyboardOptions: KeyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),
readOnly: Boolean = false,
enabled: Boolean = true,
isError: Boolean? = null,
singleLine: Boolean = true,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
textStyle: TextStyle = LocalTextStyle.current,
Expand Down Expand Up @@ -361,7 +369,7 @@ fun OutlinedPasswordField(
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
singleLine = singleLine,
isError = ruleResults.firstUnfulfilled() != null && value.text.isNotEmpty(),
isError = isError ?: (ruleResults.firstUnfulfilled() != null && value.text.isNotEmpty()),
modifier = modifier,
leadingIcon = leadingIcon,
trailingIcon = { trailingIcon?.invoke(showPassword) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ private const val DEFAULT_MASK_CHAR = '#'
* @param leadingIcon The leading icon for the phone field. Defaults to an email icon.
* @param singleLine Whether the phone field should be a single line or multiline. Defaults to true.
* @param enabled Whether the phone field should be enabled for user interaction. Defaults to true.
* @param isError Whether the phone field should display an error state. Defaults to null (handled automatically).
* @param interactionSource The interaction source for the phone field. Defaults to MutableInteractionSource.
* @param textStyle The text style for the phone field. Defaults to LocalTextStyle.current.
* @param shape The shape of the phone field. Defaults to TextFieldDefaults.shape.
Expand Down Expand Up @@ -76,6 +77,7 @@ fun PhoneField(
},
singleLine: Boolean = true,
enabled: Boolean = true,
isError: Boolean? = null,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
textStyle: TextStyle = LocalTextStyle.current,
shape: Shape = TextFieldDefaults.shape,
Expand Down Expand Up @@ -104,7 +106,7 @@ fun PhoneField(
keyboardActions = keyboardActions,
leadingIcon = leadingIcon,
singleLine = singleLine,
isError = !isValidPhone && value.isNotEmpty(),
isError = isError ?: (!isValidPhone && value.isNotEmpty()),
interactionSource = interactionSource,
textStyle = textStyle,
shape = shape,
Expand Down Expand Up @@ -132,6 +134,7 @@ fun PhoneField(
* @param keyboardActions The keyboard actions for the phone field. Defaults to KeyboardActions.Default.
* @param leadingIcon The leading icon for the phone field. Defaults to an email icon.
* @param singleLine Whether the phone field should be a single line or multiline. Defaults to true.
* @param isError Whether the phone field should display an error state. Defaults to null (handled automatically).
* @param enabled Whether the phone field should be enabled for user interaction. Defaults to true.
* @param interactionSource The interaction source for the phone field. Defaults to MutableInteractionSource.
* @param textStyle The text style for the phone field. Defaults to LocalTextStyle.current.
Expand Down Expand Up @@ -165,6 +168,7 @@ fun PhoneField(
},
singleLine: Boolean = true,
enabled: Boolean = true,
isError: Boolean? = null,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
textStyle: TextStyle = LocalTextStyle.current,
shape: Shape = TextFieldDefaults.shape,
Expand Down Expand Up @@ -193,7 +197,7 @@ fun PhoneField(
keyboardActions = keyboardActions,
leadingIcon = leadingIcon,
singleLine = singleLine,
isError = !isValidPhone && value.text.isNotEmpty(),
isError = isError ?: (!isValidPhone && value.text.isNotEmpty()),
interactionSource = interactionSource,
textStyle = textStyle,
shape = shape,
Expand Down Expand Up @@ -222,6 +226,7 @@ fun PhoneField(
* @param leadingIcon The leading icon for the phone field. Defaults to an email icon.
* @param singleLine Whether the phone field should be a single line or multiline. Defaults to true.
* @param enabled Whether the phone field should be enabled for user interaction. Defaults to true.
* @param isError Whether the phone field should display an error state. Defaults to null (handled automatically).
* @param interactionSource The interaction source for the phone field. Defaults to MutableInteractionSource.
* @param textStyle The text style for the phone field. Defaults to LocalTextStyle.current.
* @param shape The shape of the phone field. Defaults to TextFieldDefaults.shape.
Expand Down Expand Up @@ -254,6 +259,7 @@ fun OutlinedPhoneField(
},
singleLine: Boolean = true,
enabled: Boolean = true,
isError: Boolean? = null,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
textStyle: TextStyle = LocalTextStyle.current,
shape: Shape = OutlinedTextFieldDefaults.shape,
Expand Down Expand Up @@ -282,7 +288,7 @@ fun OutlinedPhoneField(
keyboardActions = keyboardActions,
leadingIcon = leadingIcon,
singleLine = singleLine,
isError = !isValidPhone && value.text.isNotEmpty(),
isError = isError ?: (!isValidPhone && value.text.isNotEmpty()),
interactionSource = interactionSource,
textStyle = textStyle,
shape = shape,
Expand Down Expand Up @@ -311,6 +317,7 @@ fun OutlinedPhoneField(
* @param leadingIcon The leading icon for the phone field. Defaults to an email icon.
* @param singleLine Whether the phone field should be a single line or multiline. Defaults to true.
* @param enabled Whether the phone field should be enabled for user interaction. Defaults to true.
* @param isError Whether the phone field should display an error state. Defaults to null (handled automatically).
* @param interactionSource The interaction source for the phone field. Defaults to MutableInteractionSource.
* @param textStyle The text style for the phone field. Defaults to LocalTextStyle.current.
* @param shape The shape of the phone field. Defaults to TextFieldDefaults.shape.
Expand Down Expand Up @@ -343,6 +350,7 @@ fun OutlinedPhoneField(
},
singleLine: Boolean = true,
enabled: Boolean = true,
isError: Boolean? = null,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
textStyle: TextStyle = LocalTextStyle.current,
shape: Shape = OutlinedTextFieldDefaults.shape,
Expand All @@ -368,7 +376,7 @@ fun OutlinedPhoneField(
keyboardActions = keyboardActions,
leadingIcon = leadingIcon,
singleLine = singleLine,
isError = !isValidPhone && value.isNotEmpty(),
isError = isError ?: (!isValidPhone && value.isNotEmpty()),
interactionSource = interactionSource,
textStyle = textStyle,
shape = shape,
Expand Down