Digital ACT-191 ONEAPP-7135 story: updated variable name for error boolean

This commit is contained in:
vasavk 2024-04-05 21:08:52 +05:30
parent 791bfc8870
commit 51d1ded4c8

View File

@ -75,14 +75,11 @@ open class DropdownSelect: Control {
/// A callback when the selected option changes. Passes parameters (option).
open var onDropdownItemSelect: ((DropdownOptionModel) -> Void)?
/// Boolean value that determines if component should show the error state/error message. Functon receives the 'event' object on input change.
open var showError: Bool = false { didSet { setNeedsUpdate() }}
open override var state: UIControl.State {
get {
var state = super.state
if showError {
if error {
state.insert(.error)
}
return state
@ -209,8 +206,7 @@ open class DropdownSelect: Control {
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
open override func setup() {
super.setup()
super.setup()
isAccessibilityElement = true
accessibilityLabel = "Dropdown Select"
@ -271,7 +267,7 @@ open class DropdownSelect: Control {
container.backgroundColor = backgroundColorConfiguration.getColor(self)
container.layer.borderWidth = VDSFormControls.widthBorder
container.layer.cornerRadius = VDSFormControls.borderradius
container.layer.borderColor = readOnly ? readOnlyBorderColorConfiguration.getColor(self).cgColor : (showError ? errorBorderColorConfiguration.getColor(self).cgColor : containerBorderColorConfiguration.getColor(self).cgColor)
container.layer.borderColor = readOnly ? readOnlyBorderColorConfiguration.getColor(self).cgColor : (error ? errorBorderColorConfiguration.getColor(self).cgColor : containerBorderColorConfiguration.getColor(self).cgColor)
dropdownField.isUserInteractionEnabled = readOnly ? false : true
stackView.backgroundColor = transparentBackground ? .clear : surface.color
@ -289,7 +285,7 @@ open class DropdownSelect: Control {
/// Used to update any Accessibility properties.
open override func updateAccessibility() {
super.updateAccessibility()
if showError {
if error {
setAccessibilityLabel(for: [eyebrowLabel, selectedOptionLabel, errorLabel, helperLabel])
} else {
setAccessibilityLabel(for: [eyebrowLabel, selectedOptionLabel, helperLabel])
@ -378,7 +374,7 @@ open class DropdownSelect: Control {
}
open func updateErrorLabel() {
if showError, let errorText {
if error, let errorText {
errorLabel.text = errorText
errorLabel.surface = surface
errorLabel.isEnabled = isEnabled