IdentificationTextField
A PCI-compliant identification input component for handling identification document numbers.
This component provides a secure input field for identification numbers (CPF, DNI, etc.), with automatic validation based on the selected identification type. It wraps the base PCITextField with identification-specific logic while maintaining all the security features.
The component integrates with PCIFieldState for secure input management and provides events through IdentificationTextFieldEvent for handling focus changes and value changes.
Features:
PCI-compliant input handling
Automatic max length validation based on identification type
Configurable keyboard type (numeric or alphanumeric) based on identification type
Real-time input state feedback
Customizable appearance and behavior
Example usage:
val state = rememberPCIFieldState()
val selectedType = IdentificationType(
id = "CPF",
name = "CPF",
type = "number",
minLength = 11,
maxLength = 11
)
IdentificationTextField(
state = state,
identificationType = selectedType,
onEvent = { event ->
when (event) {
is IdentificationTextFieldEvent.OnValueChanged -> {
// Handle value change
}
is IdentificationTextFieldEvent.OnFocusChanged -> {
// Handle focus change
}
}
},
textStyle = MaterialTheme.typography.bodyLarge
)Parameters
Modifier to customize the style and behavior of the field
A PCIFieldState object that manages the secure input data
The selected IdentificationType that defines validation rules
Callback triggered for field events (focus changes, value changes)
Controls whether the field is interactive
Controls whether the field is editable
Composable for adding decorative elements around the text field
Text style applied to the input content
Configuration for the software keyboard (defaults based on identification type)
Callbacks for keyboard action events
Brush applied to customize the cursor appearance
Visual transformations applied to the input text