Package-level declarations

Types

Link copied to clipboard
class PasswordRule(val description: String, val predicate: (password: String) -> Boolean)

Represents a rule that can be applied to a password.

Link copied to clipboard
data class PasswordRuleResult(val description: String, val isFulfilled: Boolean)

Represents the result of a PasswordRule, when applied to a password.

Functions

Link copied to clipboard
fun OutlinedPasswordField(value: TextFieldValue, onValueChange: (TextFieldValue) -> Unit, rules: List<PasswordRule> = rememberPasswordRuleList(), modifier: Modifier = Modifier, visualTransformation: (showPassword: Boolean) -> VisualTransformation = { if(it) VisualTransformation.None else PasswordVisualTransformation() }, keyboardActions: KeyboardActions = KeyboardActions(), 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, shape: Shape = OutlinedTextFieldDefaults.shape, colors: TextFieldColors = OutlinedTextFieldDefaults.colors(), label: @Composable () -> Unit? = null, leadingIcon: @Composable () -> Unit? = { Icon(AuthIcons.rememberLockIcon(), "Lock") }, supportingText: @Composable (rules: List<PasswordRuleResult>) -> Unit? = { if (value.text.isNotEmpty()) it.firstUnfulfilled()?.let { rule -> Text(rule.description) } }, trailingIcon: @Composable (showPassword: MutableState<Boolean>) -> Unit? = { showPassword -> IconButton(onClick = { showPassword.value = !showPassword.value }) { Icon(if(showPassword.value) AuthIcons.rememberVisibilityIcon() else AuthIcons.rememberVisibilityOffIcon(), "Visibility") } }, placeholder: @Composable () -> Unit? = null, formKey: String = "PASSWORD", mandatory: Boolean = true)
fun OutlinedPasswordField(value: String, onValueChange: (String) -> Unit, rules: List<PasswordRule> = rememberPasswordRuleList(), modifier: Modifier = Modifier, visualTransformation: (showPassword: Boolean) -> VisualTransformation = { if(it) VisualTransformation.None else PasswordVisualTransformation() }, keyboardActions: KeyboardActions = KeyboardActions(), keyboardOptions: KeyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password), readOnly: Boolean = false, enabled: Boolean = true, singleLine: Boolean = true, isError: Boolean? = null, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, textStyle: TextStyle = LocalTextStyle.current, shape: Shape = OutlinedTextFieldDefaults.shape, colors: TextFieldColors = OutlinedTextFieldDefaults.colors(), label: @Composable () -> Unit? = null, leadingIcon: @Composable () -> Unit? = { Icon(AuthIcons.rememberLockIcon(), "Lock") }, supportingText: @Composable (rules: List<PasswordRuleResult>) -> Unit? = { if (value.isNotEmpty()) it.firstUnfulfilled()?.let { rule -> Text(rule.description) } }, trailingIcon: @Composable (showPassword: MutableState<Boolean>) -> Unit? = { showPassword -> IconButton(onClick = { showPassword.value = !showPassword.value }) { Icon(if(showPassword.value) AuthIcons.rememberVisibilityIcon() else AuthIcons.rememberVisibilityOffIcon(), "Visibility") } }, placeholder: @Composable () -> Unit? = null, formKey: String = "PASSWORD", mandatory: Boolean = true)

A custom password input field with custom rules and pre-defined styling.

Link copied to clipboard
fun PasswordField(value: TextFieldValue, onValueChange: (TextFieldValue) -> Unit, rules: List<PasswordRule> = rememberPasswordRuleList(), modifier: Modifier = Modifier, visualTransformation: (showPassword: Boolean) -> VisualTransformation = { if(it) VisualTransformation.None else PasswordVisualTransformation() }, keyboardActions: KeyboardActions = KeyboardActions(), keyboardOptions: KeyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password), readOnly: Boolean = false, enabled: Boolean = true, singleLine: Boolean = true, isError: Boolean? = null, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, textStyle: TextStyle = LocalTextStyle.current, shape: Shape = TextFieldDefaults.shape, colors: TextFieldColors = TextFieldDefaults.colors(), label: @Composable () -> Unit? = null, leadingIcon: @Composable () -> Unit? = { Icon(AuthIcons.rememberLockIcon(), "Lock") }, supportingText: @Composable (rules: List<PasswordRuleResult>) -> Unit? = { if (value.text.isNotEmpty()) it.firstUnfulfilled()?.let { rule -> Text(rule.description) } }, trailingIcon: @Composable (showPassword: MutableState<Boolean>) -> Unit? = { showPassword -> IconButton(onClick = { showPassword.value = !showPassword.value }) { Icon(if(showPassword.value) AuthIcons.rememberVisibilityIcon() else AuthIcons.rememberVisibilityOffIcon(), "Visibility") } }, placeholder: @Composable () -> Unit? = null, formKey: String = "PASSWORD", mandatory: Boolean = true)
fun PasswordField(value: String, onValueChange: (String) -> Unit, rules: List<PasswordRule> = rememberPasswordRuleList(), modifier: Modifier = Modifier, visualTransformation: (showPassword: Boolean) -> VisualTransformation = { if(it) VisualTransformation.None else PasswordVisualTransformation() }, keyboardActions: KeyboardActions = KeyboardActions(), keyboardOptions: KeyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password), readOnly: Boolean = false, enabled: Boolean = true, singleLine: Boolean = true, isError: Boolean? = null, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, textStyle: TextStyle = LocalTextStyle.current, shape: Shape = TextFieldDefaults.shape, colors: TextFieldColors = TextFieldDefaults.colors(), label: @Composable () -> Unit? = null, leadingIcon: @Composable () -> Unit? = { Icon(AuthIcons.rememberLockIcon(), "Lock") }, supportingText: @Composable (rules: List<PasswordRuleResult>) -> Unit? = { if (value.isNotEmpty()) it.firstUnfulfilled()?.let { rule -> Text(rule.description) } }, trailingIcon: @Composable (showPassword: MutableState<Boolean>) -> Unit? = { showPassword -> IconButton(onClick = { showPassword.value = !showPassword.value }) { Icon(if(showPassword.value) AuthIcons.rememberVisibilityIcon() else AuthIcons.rememberVisibilityOffIcon(), "Visibility") } }, placeholder: @Composable () -> Unit? = null, formKey: String = "PASSWORD", mandatory: Boolean = true)

A custom password input field with custom rules and pre-defined styling.

Link copied to clipboard

Creates a List of PasswordRules from the specified rules.