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

@ -76,13 +76,10 @@ open class DropdownSelect: Control {
/// A callback when the selected option changes. Passes parameters (option). /// A callback when the selected option changes. Passes parameters (option).
open var onDropdownItemSelect: ((DropdownOptionModel) -> Void)? 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 { open override var state: UIControl.State {
get { get {
var state = super.state var state = super.state
if showError { if error {
state.insert(.error) state.insert(.error)
} }
return state return state
@ -210,7 +207,6 @@ open class DropdownSelect: Control {
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations. /// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
open override func setup() { open override func setup() {
super.setup() super.setup()
isAccessibilityElement = true isAccessibilityElement = true
accessibilityLabel = "Dropdown Select" accessibilityLabel = "Dropdown Select"
@ -271,7 +267,7 @@ open class DropdownSelect: Control {
container.backgroundColor = backgroundColorConfiguration.getColor(self) container.backgroundColor = backgroundColorConfiguration.getColor(self)
container.layer.borderWidth = VDSFormControls.widthBorder container.layer.borderWidth = VDSFormControls.widthBorder
container.layer.cornerRadius = VDSFormControls.borderradius 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 dropdownField.isUserInteractionEnabled = readOnly ? false : true
stackView.backgroundColor = transparentBackground ? .clear : surface.color stackView.backgroundColor = transparentBackground ? .clear : surface.color
@ -289,7 +285,7 @@ open class DropdownSelect: Control {
/// Used to update any Accessibility properties. /// Used to update any Accessibility properties.
open override func updateAccessibility() { open override func updateAccessibility() {
super.updateAccessibility() super.updateAccessibility()
if showError { if error {
setAccessibilityLabel(for: [eyebrowLabel, selectedOptionLabel, errorLabel, helperLabel]) setAccessibilityLabel(for: [eyebrowLabel, selectedOptionLabel, errorLabel, helperLabel])
} else { } else {
setAccessibilityLabel(for: [eyebrowLabel, selectedOptionLabel, helperLabel]) setAccessibilityLabel(for: [eyebrowLabel, selectedOptionLabel, helperLabel])
@ -378,7 +374,7 @@ open class DropdownSelect: Control {
} }
open func updateErrorLabel() { open func updateErrorLabel() {
if showError, let errorText { if error, let errorText {
errorLabel.text = errorText errorLabel.text = errorText
errorLabel.surface = surface errorLabel.surface = surface
errorLabel.isEnabled = isEnabled errorLabel.isEnabled = isEnabled