diff --git a/VDS/Components/TextFields/EntryFieldBase.swift b/VDS/Components/TextFields/EntryFieldBase.swift index e015444f..30df7699 100644 --- a/VDS/Components/TextFields/EntryFieldBase.swift +++ b/VDS/Components/TextFields/EntryFieldBase.swift @@ -101,6 +101,14 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable { /// This is set by a local method. internal var bottomContainerView: UIView! + internal var containerBackgroundColor: UIColor { + if showError || hasInternalError { + return backgroundColorConfiguration.getColor(self) + } else { + return transparentBackground ? .clear : backgroundColorConfiguration.getColor(self) + } + } + //-------------------------------------------------- // MARK: - Constraints //-------------------------------------------------- @@ -441,7 +449,7 @@ open class EntryFieldBase: Control, Changeable, FormFieldInternalValidatable { } internal func updateContainerView() { - containerView.backgroundColor = backgroundColorConfiguration.getColor(self) + containerView.backgroundColor = containerBackgroundColor containerView.layer.borderColor = borderColorConfiguration.getColor(self).cgColor containerView.layer.borderWidth = VDSFormControls.borderWidth containerView.layer.cornerRadius = VDSFormControls.borderRadius diff --git a/VDS/Components/TextFields/InputField/InputField.swift b/VDS/Components/TextFields/InputField/InputField.swift index 70c6ecd0..76cdaa2a 100644 --- a/VDS/Components/TextFields/InputField/InputField.swift +++ b/VDS/Components/TextFields/InputField/InputField.swift @@ -34,6 +34,14 @@ open class InputField: EntryFieldBase { //-------------------------------------------------- // MARK: - Private Properties //-------------------------------------------------- + internal override var containerBackgroundColor: UIColor { + if showSuccess { + return backgroundColorConfiguration.getColor(self) + } else { + return super.containerBackgroundColor + } + } + internal override var minWidth: CGFloat { fieldType.handler().minWidth } internal override var maxWidth: CGFloat { let frameWidth = frame.size.width diff --git a/VDS/Components/TextFields/TextArea/TextArea.swift b/VDS/Components/TextFields/TextArea/TextArea.swift index f03300d1..870cf6b6 100644 --- a/VDS/Components/TextFields/TextArea/TextArea.swift +++ b/VDS/Components/TextFields/TextArea/TextArea.swift @@ -163,9 +163,6 @@ open class TextArea: EntryFieldBase { textViewHeightConstraint = textView.heightAnchor.constraint(greaterThanOrEqualToConstant: containerSize.height) textViewHeightConstraint?.isActive = true - backgroundColorConfiguration.setSurfaceColors(VDSColor.feedbackSuccessBackgroundOnlight, VDSColor.feedbackSuccessBackgroundOndark, forState: .success) - borderColorConfiguration.setSurfaceColors(VDSColor.feedbackSuccessOnlight, VDSColor.feedbackSuccessOndark, forState: .success) - borderColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .focused) characterCounterLabel.textColorConfiguration = primaryColorConfiguration.eraseToAnyColorable() bottomContainerStackView.spacing = VDSLayout.space2X @@ -190,11 +187,7 @@ open class TextArea: EntryFieldBase { textViewHeightConstraint?.constant = minHeight.value characterCounterLabel.text = getCharacterCounterText() - - statusIcon.color = iconColorConfiguration.getColor(self) - containerView.layer.borderColor = isReadOnly ? readOnlyBorderColorConfiguration.getColor(self).cgColor : borderColorConfiguration.getColor(self).cgColor textView.isEditable = !isEnabled || isReadOnly ? false : true - textView.backgroundColor = backgroundColorConfiguration.getColor(self) textView.tintColor = iconColorConfiguration.getColor(self) characterCounterLabel.surface = surface highlightCharacterOverflow()