updated icon to statusIcon and iconColorConfiguration
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
3497807d1c
commit
37890e0c88
@ -89,12 +89,6 @@ open class DropdownSelect: EntryFieldBase {
|
||||
// MARK: - Configuration Properties
|
||||
//--------------------------------------------------
|
||||
internal override var containerSize: CGSize { CGSize(width: showInlineLabel ? minWidthInlineLabel : width ?? minWidthDefault, height: 44) }
|
||||
|
||||
internal let iconColorConfiguration = ControlColorConfiguration().with {
|
||||
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .normal)
|
||||
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: .disabled)
|
||||
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .error)
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Overrides
|
||||
@ -240,11 +234,11 @@ open class DropdownSelect: EntryFieldBase {
|
||||
open override func updateErrorLabel() {
|
||||
super.updateErrorLabel()
|
||||
if !showError && !hasInternalError {
|
||||
icon.name = .downCaret
|
||||
statusIcon.name = .downCaret
|
||||
}
|
||||
icon.surface = surface
|
||||
icon.isHidden = readOnly ? true : false
|
||||
icon.color = iconColorConfiguration.getColor(self)
|
||||
statusIcon.surface = surface
|
||||
statusIcon.isHidden = readOnly ? true : false
|
||||
statusIcon.color = iconColorConfiguration.getColor(self)
|
||||
}
|
||||
|
||||
@objc open func pickerDoneClicked() {
|
||||
|
||||
@ -112,6 +112,12 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
|
||||
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: [.disabled,.error])
|
||||
}
|
||||
|
||||
internal let iconColorConfiguration = ControlColorConfiguration().with {
|
||||
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .normal)
|
||||
$0.setSurfaceColors(VDSColor.interactiveDisabledOnlight, VDSColor.interactiveDisabledOndark, forState: .disabled)
|
||||
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .error)
|
||||
}
|
||||
|
||||
internal var readOnlyBorderColorConfiguration = ControlColorConfiguration().with {
|
||||
$0.setSurfaceColors(VDSFormControlsColor.borderReadonlyOnlight, VDSFormControlsColor.borderReadonlyOndark, forState: .normal)
|
||||
}
|
||||
@ -142,7 +148,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
|
||||
$0.textStyle = .bodySmall
|
||||
}
|
||||
|
||||
open var icon: Icon = Icon().with {
|
||||
open var statusIcon: Icon = Icon().with {
|
||||
$0.size = .medium
|
||||
}
|
||||
|
||||
@ -248,7 +254,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
|
||||
|
||||
//add the view to add input fields
|
||||
containerStackView.addArrangedSubview(controlContainerView)
|
||||
containerStackView.addArrangedSubview(icon)
|
||||
containerStackView.addArrangedSubview(statusIcon)
|
||||
containerStackView.setCustomSpacing(VDSLayout.space3X, after: controlContainerView)
|
||||
|
||||
//get the container this is what show helper text, error text
|
||||
@ -379,32 +385,30 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable {
|
||||
errorLabel.surface = surface
|
||||
errorLabel.isEnabled = isEnabled
|
||||
errorLabel.isHidden = false
|
||||
icon.name = .error
|
||||
icon.color = VDSColor.paletteBlack
|
||||
icon.surface = surface
|
||||
icon.isHidden = !isEnabled
|
||||
statusIcon.name = .error
|
||||
statusIcon.surface = surface
|
||||
statusIcon.isHidden = !isEnabled
|
||||
} else if showError, let errorText {
|
||||
errorLabel.text = errorText
|
||||
errorLabel.surface = surface
|
||||
errorLabel.isEnabled = isEnabled
|
||||
errorLabel.isHidden = false
|
||||
icon.name = .error
|
||||
icon.color = VDSColor.paletteBlack
|
||||
icon.surface = surface
|
||||
icon.isHidden = !isEnabled
|
||||
statusIcon.name = .error
|
||||
statusIcon.surface = surface
|
||||
statusIcon.isHidden = !isEnabled
|
||||
} else if hasInternalError, let internalErrorText {
|
||||
errorLabel.text = internalErrorText
|
||||
errorLabel.surface = surface
|
||||
errorLabel.isEnabled = isEnabled
|
||||
errorLabel.isHidden = false
|
||||
icon.name = .error
|
||||
icon.color = VDSColor.paletteBlack
|
||||
icon.surface = surface
|
||||
icon.isHidden = !isEnabled
|
||||
statusIcon.name = .error
|
||||
statusIcon.surface = surface
|
||||
statusIcon.isHidden = !isEnabled
|
||||
} else {
|
||||
icon.isHidden = true
|
||||
statusIcon.isHidden = true
|
||||
errorLabel.isHidden = true
|
||||
}
|
||||
statusIcon.color = iconColorConfiguration.getColor(self)
|
||||
}
|
||||
|
||||
open func updateHelperLabel(){
|
||||
|
||||
@ -138,12 +138,7 @@ open class TextArea: EntryFieldBase {
|
||||
setNeedsUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
/// Color configuration for error icon.
|
||||
internal var iconColorConfiguration = ControlColorConfiguration().with {
|
||||
$0.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .normal)
|
||||
}
|
||||
|
||||
|
||||
/// Color configuration for character counter's highlight background color
|
||||
internal var highlightBackgroundColor = ControlColorConfiguration().with {
|
||||
$0.setSurfaceColors(VDSColor.backgroundPrimaryDark, VDSColor.backgroundPrimaryLight, forState: .normal)
|
||||
@ -219,8 +214,7 @@ open class TextArea: EntryFieldBase {
|
||||
|
||||
characterCounterLabel.text = getCharacterCounterText()
|
||||
|
||||
icon.size = .medium
|
||||
icon.color = iconColorConfiguration.getColor(self)
|
||||
statusIcon.color = iconColorConfiguration.getColor(self)
|
||||
containerView.layer.borderColor = readOnly ? readOnlyBorderColorConfiguration.getColor(self).cgColor : borderColorConfiguration.getColor(self).cgColor
|
||||
textView.isEditable = readOnly ? false : true
|
||||
textView.backgroundColor = backgroundColorConfiguration.getColor(self)
|
||||
@ -240,7 +234,7 @@ open class TextArea: EntryFieldBase {
|
||||
open override func updateAccessibility() {
|
||||
super.updateAccessibility()
|
||||
if showError {
|
||||
accessibilityElements = [titleLabel, textView, icon, errorLabel, helperLabel]
|
||||
accessibilityElements = [titleLabel, textView, statusIcon, errorLabel, helperLabel]
|
||||
} else {
|
||||
accessibilityElements = [titleLabel, textView, helperLabel]
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user